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