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