00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00016
00017 #ifndef MIDAD_GUIBUTTON_H
00018 #define MIDAD_GUIBUTTON_H
00019
00020 #include <Midad/Gui/GuiBase.h>
00021 #include <TGButton.h>
00022 #include <TGPicture.h>
00023
00024 class GuiButtonBase : public GuiBase
00025 {
00026 public:
00027 GuiButtonBase() { SetName("GuiButtonBase"); }
00028 virtual ~GuiButtonBase() {}
00029
00030 SigC::Signal0<void> pressed, released, clicked;
00031 };
00032
00033 class GuiPicButton : public TGPictureButton, public GuiButtonBase
00034 {
00035 public:
00036 GuiPicButton(const TGWindow& p, const char* pic_name)
00037 : TGPictureButton(&p,gClient->GetPicture(pic_name))
00038 { SetLayoutHints(0); }
00039 virtual ~GuiPicButton() { }
00040
00041
00042 virtual TGDimension GetDefaultSize() const {
00043 UInt_t w = (fPic) ? fPic->GetWidth() : fWidth;
00044 UInt_t h = (fPic) ? fPic->GetHeight() : fHeight;
00045
00046 return TGDimension(w,h);
00047 }
00048
00049 virtual UInt_t GetDefaultWidth() const { return GetDefaultSize().fWidth;}
00050 virtual UInt_t GetDefaultHeight() const { return GetDefaultSize().fHeight;}
00051
00052 protected:
00053
00054
00055 void Pressed() { this->TGButton::Pressed(); pressed(); }
00056 void Released() { this->TGButton::Released(); released(); }
00057 void Clicked() { this->TGButton::Clicked(); clicked(); }
00058
00059 };
00060
00061
00062 class GuiTextButton : public TGTextButton, public GuiButtonBase
00063 {
00064 public:
00065
00066 GuiTextButton(const TGWindow& p, const char* label)
00067 : TGTextButton(&p,label)
00068 {
00069
00070 SetLayoutHints(0);
00071 }
00072 virtual ~GuiTextButton() {}
00073
00074 protected:
00075
00076
00077 void Pressed() { this->TGButton::Pressed(); pressed(); }
00078 void Released() { this->TGButton::Released(); released(); }
00079 void Clicked() { this->TGButton::Clicked(); clicked(); }
00080
00081 };
00082
00083 class GuiCheckButton: public TGCheckButton, public GuiButtonBase
00084 {
00085 public:
00086 GuiCheckButton(const TGWindow& p, const char* label)
00087 : TGCheckButton(&p,label)
00088 {
00089
00090 SetLayoutHints(0);
00091 }
00092 virtual ~GuiCheckButton() {}
00093
00094 protected:
00095
00096
00097 void Pressed() { this->TGButton::Pressed(); pressed(); }
00098 void Released() { this->TGButton::Released(); released(); }
00099 void Clicked() { this->TGButton::Clicked(); clicked(); }
00100 };
00101
00102 #endif // MIDAD_GUIBUTTON_H