]> icculus.org git repositories - mikachu/openbox.git/blob - src/widgetbase.hh
proper code style
[mikachu/openbox.git] / src / widgetbase.hh
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2 #ifndef   __widgetbase_hh
3 #define   __widgetbase_hh
4
5 #include "python.hh"
6
7 namespace ob {
8
9 class WidgetBase {
10 public:
11   enum WidgetType {
12     Type_Frame,
13     Type_Titlebar,
14     Type_Handle,
15     Type_Plate,
16     Type_Label,
17     Type_MaximizeButton,
18     Type_CloseButton,
19     Type_IconifyButton,
20     Type_StickyButton,
21     Type_LeftGrip,
22     Type_RightGrip,
23     Type_Client,
24     Type_Root
25   };
26
27 private:
28   WidgetType _type;
29
30 public:
31   WidgetBase(WidgetType type) : _type(type) {}
32   
33   inline WidgetType type() const { return _type; }
34
35   inline MouseContext mcontext() const {
36     switch (_type) {
37     case Type_Frame:
38       return MC_Frame;
39     case Type_Titlebar:
40       return MC_Titlebar;
41     case Type_Handle:
42       return MC_Handle;
43     case Type_Plate:
44       return MC_Window;
45     case Type_Label:
46       return MC_Titlebar;
47     case Type_MaximizeButton:
48       return MC_MaximizeButton;
49     case Type_CloseButton:
50       return MC_CloseButton;
51     case Type_IconifyButton:
52       return MC_IconifyButton;
53     case Type_StickyButton:
54       return MC_StickyButton;
55     case Type_LeftGrip:
56       return MC_Grip;
57     case Type_RightGrip:
58       return MC_Grip;
59     case Type_Client:
60       return MC_Window;
61     case Type_Root:
62       return MC_Root;
63     default:
64       assert(false); // unhandled type
65     }
66   }
67 };
68
69 }
70
71 #endif // __widgetbase_hh