1 // Aseprite
2 // Copyright (C) 2017  David Capello
3 //
4 // This program is distributed under the terms of
5 // the End-User License Agreement for Aseprite.
6 
7 #ifndef APP_UI_EDITOR_HIT_H_INCLUDED
8 #define APP_UI_EDITOR_HIT_H_INCLUDED
9 #pragma once
10 
11 namespace doc {
12   class Slice;
13 }
14 
15 namespace app {
16 
17   // TODO Complete this class to calculate if the mouse hit any Editor
18   //      element/decorator
19   class EditorHit {
20   public:
21     enum Type {
22       None,
23       SliceBounds,
24       SliceCenter,
25     };
26 
EditorHit(Type type)27     EditorHit(Type type)
28       : m_type(type)
29       , m_border(0)
30       , m_slice(nullptr) {
31     }
32 
type()33     Type type() const { return m_type; }
border()34     int border() const { return m_border; }
slice()35     doc::Slice* slice() const { return m_slice; }
36 
setBorder(int border)37     void setBorder(int border) { m_border = border; }
setSlice(doc::Slice * slice)38     void setSlice(doc::Slice* slice) { m_slice = slice; }
39 
40   private:
41     Type m_type;
42     int m_border;
43     doc::Slice* m_slice;
44   };
45 
46 } // namespace app
47 
48 #endif  // APP_UI_EDITOR_HIT_H_INCLUDED
49