00001
00002 #ifndef __widgetbase_hh
00003 #define __widgetbase_hh
00004
00005 #include "python.hh"
00006
00007 namespace ob {
00008
00009 class WidgetBase {
00010 public:
00011 enum WidgetType {
00012 Type_Frame,
00013 Type_Titlebar,
00014 Type_Handle,
00015 Type_Plate,
00016 Type_Label,
00017 Type_MaximizeButton,
00018 Type_CloseButton,
00019 Type_IconifyButton,
00020 Type_AllDesktopsButton,
00021 Type_LeftGrip,
00022 Type_RightGrip,
00023 Type_Client,
00024 Type_Root
00025 };
00026
00027 private:
00028 WidgetType _type;
00029
00030 public:
00031 WidgetBase(WidgetType type) : _type(type) {}
00032
00033 inline WidgetType type() const { return _type; }
00034
00035 inline MouseContext::MC mcontext() const {
00036 switch (_type) {
00037 case Type_Frame:
00038 return MouseContext::Frame;
00039 case Type_Titlebar:
00040 return MouseContext::Titlebar;
00041 case Type_Handle:
00042 return MouseContext::Handle;
00043 case Type_Plate:
00044 return MouseContext::Window;
00045 case Type_Label:
00046 return MouseContext::Titlebar;
00047 case Type_MaximizeButton:
00048 return MouseContext::MaximizeButton;
00049 case Type_CloseButton:
00050 return MouseContext::CloseButton;
00051 case Type_IconifyButton:
00052 return MouseContext::IconifyButton;
00053 case Type_AllDesktopsButton:
00054 return MouseContext::AllDesktopsButton;
00055 case Type_LeftGrip:
00056 return MouseContext::Grip;
00057 case Type_RightGrip:
00058 return MouseContext::Grip;
00059 case Type_Client:
00060 return MouseContext::Window;
00061 case Type_Root:
00062 return MouseContext::Root;
00063 default:
00064 assert(false);
00065 }
00066 }
00067 };
00068
00069 }
00070
00071 #endif // __widgetbase_hh