00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_TGWidget
00013 #define ROOT_TGWidget
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef ROOT_GuiTypes
00027 #include "GuiTypes.h"
00028 #endif
00029 #ifndef ROOT_TGString
00030 #include "TGString.h"
00031 #endif
00032 #ifndef ROOT_WidgetMessageTypes
00033 #include "WidgetMessageTypes.h"
00034 #endif
00035
00036
00037
00038
00039 enum ETextJustification {
00040 kTextLeft = BIT(0),
00041 kTextRight = BIT(1),
00042 kTextCenterX = BIT(2),
00043 kTextTop = BIT(3),
00044 kTextBottom = BIT(4),
00045 kTextCenterY = BIT(5)
00046 };
00047
00048
00049
00050
00051 enum EWidgetStatus {
00052 kWidgetWantFocus = BIT(0),
00053 kWidgetHasFocus = BIT(1),
00054 kWidgetIsEnabled = BIT(2)
00055 };
00056
00057
00058 class TGWindow;
00059
00060
00061 class TGWidget {
00062
00063 protected:
00064 Int_t fWidgetId;
00065 Int_t fWidgetFlags;
00066 const TGWindow *fMsgWindow;
00067 TString fCommand;
00068
00069 TGWidget(const TGWidget& tgw):
00070 fWidgetId(tgw.fWidgetId), fWidgetFlags(tgw.fWidgetFlags),
00071 fMsgWindow(tgw.fMsgWindow), fCommand(tgw.fCommand) { }
00072 TGWidget& operator=(const TGWidget& tgw) {
00073 if(this!=&tgw) {
00074 fWidgetId=tgw.fWidgetId; fWidgetFlags=tgw.fWidgetFlags;
00075 fMsgWindow=tgw.fMsgWindow; fCommand=tgw.fCommand; } return *this; }
00076 Int_t SetFlags(Int_t flags) { return fWidgetFlags |= flags; }
00077 Int_t ClearFlags(Int_t flags) { return fWidgetFlags &= ~flags; }
00078
00079 public:
00080 TGWidget():
00081 fWidgetId(-1), fWidgetFlags(0), fMsgWindow(0), fCommand() { }
00082 TGWidget(Int_t id):
00083 fWidgetId(id), fWidgetFlags(0), fMsgWindow(0), fCommand() { }
00084 virtual ~TGWidget() { }
00085
00086 Int_t WidgetId() const { return fWidgetId; }
00087 Bool_t IsEnabled() const { return (Bool_t)((fWidgetFlags & kWidgetIsEnabled) != 0); }
00088 Bool_t HasFocus() const { return (Bool_t)((fWidgetFlags & kWidgetHasFocus) != 0); }
00089 Bool_t WantFocus() const { return (Bool_t)((fWidgetFlags & kWidgetWantFocus) != 0); }
00090 virtual void Associate(const TGWindow *w) { fMsgWindow = w; }
00091 virtual void SetCommand(const char *command) { fCommand = command; }
00092 const char *GetCommand() const { return fCommand.Data(); }
00093
00094 ClassDef(TGWidget,0)
00095 };
00096
00097 #endif