X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fwidgetbase.hh;fp=src%2Fwidgetbase.hh;h=591f150dd8dc6e88e1b01edfd4bc3704af6abc76;hb=c8e246f8de5af9963b22cc104d22ca10772028dd;hp=0000000000000000000000000000000000000000;hpb=e0878c9fc2db8843891816e65917fbcfd1e94cbb;p=chaz%2Fopenbox diff --git a/src/widgetbase.hh b/src/widgetbase.hh new file mode 100644 index 00000000..591f150d --- /dev/null +++ b/src/widgetbase.hh @@ -0,0 +1,71 @@ +// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*- +#ifndef __obwidgetbase_hh +#define __obwidgetbase_hh + +#include "python.hh" + +namespace ob { + +class OBWidget { +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: + OBWidget(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 // __obwidgetbase_hh