X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fwidget.hh;h=85b9dcc597517544a8294224cf3cf0b6c6a78341;hb=a4a8d09f4b9431d6d831cb7aa220e6c952802c95;hp=2af01e2434257a7cf97f4b6689b4cd34ecf6ef8e;hpb=82f4efb4e2d6f836a2f5f7e7b41be4be73ae7518;p=chaz%2Fopenbox diff --git a/src/widget.hh b/src/widget.hh index 2af01e24..85b9dcc5 100644 --- a/src/widget.hh +++ b/src/widget.hh @@ -2,10 +2,13 @@ #ifndef __obwidget_hh #define __obwidget_hh +#include "python.hh" + namespace ob { class OBWidget { public: + // update the enum in openbox.i to match this one enum WidgetType { Type_Frame, Type_Titlebar, @@ -29,6 +32,39 @@ 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 + } + } }; }