2002-12-18 02:28:44 +00:00
|
|
|
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
2003-01-11 19:42:43 +00:00
|
|
|
#ifndef __widgetbase_hh
|
|
|
|
#define __widgetbase_hh
|
2002-12-18 02:28:44 +00:00
|
|
|
|
2003-01-03 05:26:04 +00:00
|
|
|
#include "python.hh"
|
|
|
|
|
2002-12-18 02:28:44 +00:00
|
|
|
namespace ob {
|
|
|
|
|
2003-01-11 19:42:43 +00:00
|
|
|
class WidgetBase {
|
2002-12-18 02:28:44 +00:00
|
|
|
public:
|
|
|
|
enum WidgetType {
|
2002-12-18 11:34:29 +00:00
|
|
|
Type_Frame,
|
2002-12-18 02:28:44 +00:00
|
|
|
Type_Titlebar,
|
|
|
|
Type_Handle,
|
2002-12-18 09:46:24 +00:00
|
|
|
Type_Plate,
|
|
|
|
Type_Label,
|
|
|
|
Type_MaximizeButton,
|
|
|
|
Type_CloseButton,
|
|
|
|
Type_IconifyButton,
|
|
|
|
Type_StickyButton,
|
|
|
|
Type_LeftGrip,
|
2002-12-18 11:34:29 +00:00
|
|
|
Type_RightGrip,
|
2002-12-20 14:44:20 +00:00
|
|
|
Type_Client,
|
|
|
|
Type_Root
|
2002-12-18 02:28:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
private:
|
|
|
|
WidgetType _type;
|
|
|
|
|
|
|
|
public:
|
2003-01-11 19:42:43 +00:00
|
|
|
WidgetBase(WidgetType type) : _type(type) {}
|
2002-12-18 02:28:44 +00:00
|
|
|
|
|
|
|
inline WidgetType type() const { return _type; }
|
2003-01-03 05:26:04 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|
2002-12-18 02:28:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2003-01-11 19:42:43 +00:00
|
|
|
#endif // __widgetbase_hh
|