#ifndef ROOT_TGButton
#define ROOT_TGButton
#ifndef ROOT_TGFrame
#include "TGFrame.h"
#endif
#ifndef ROOT_TGWidget
#include "TGWidget.h"
#endif
enum EButtonState {
kButtonUp,
kButtonDown,
kButtonEngaged,
kButtonDisabled
};
class TGWidget;
class TGHotString;
class TGPicture;
class TGToolTip;
class TGButtonGroup;
class TGButton : public TGFrame, public TGWidget {
friend class TGButtonGroup;
protected:
UInt_t fTWidth;
UInt_t fTHeight;
EButtonState fState;
Bool_t fStayDown;
GContext_t fNormGC;
void *fUserData;
TGToolTip *fTip;
TGButtonGroup *fGroup;
virtual void SetToggleButton(Bool_t) { }
virtual void EmitSignals(Bool_t wasUp);
static const TGGC *fgDefaultGC;
static const TGGC *fgHibckgndGC;
static Window_t fgReleaseBtn;
private:
TGButton(const TGButton&);
TGButton& operator=(const TGButton&);
public:
static const TGGC &GetDefaultGC();
static const TGGC &GetHibckgndGC();
TGButton(const TGWindow *p = 0, Int_t id = -1, GContext_t norm = GetDefaultGC()(),
UInt_t option = kRaisedFrame | kDoubleBorder);
virtual ~TGButton();
virtual Bool_t HandleButton(Event_t *event);
virtual Bool_t HandleCrossing(Event_t *event);
virtual void SetUserData(void *userData) { fUserData = userData; }
virtual void *GetUserData() const { return fUserData; }
virtual void SetToolTipText(const char *text, Long_t delayms = 400);
virtual TGToolTip *GetToolTip() const { return fTip; }
virtual void SetState(EButtonState state, Bool_t emit = kFALSE);
virtual EButtonState GetState() const { return fState; }
virtual void AllowStayDown(Bool_t a) { fStayDown = a; }
virtual void SetGroup(TGButtonGroup *gr);
TGButtonGroup *GetGroup() const { return fGroup; }
virtual Bool_t IsDown() const { return !(fOptions & kRaisedFrame); }
virtual void SetDown(Bool_t on = kTRUE, Bool_t emit = kFALSE);
virtual Bool_t IsOn() const { return IsDown(); }
virtual void SetOn(Bool_t on = kTRUE, Bool_t emit = kFALSE) { SetDown(on, emit); }
virtual Bool_t IsToggleButton() const { return kFALSE; }
virtual Bool_t IsExclusiveToggle() const { return kFALSE; }
virtual void Toggle(Bool_t emit = kFALSE) { SetDown(IsDown() ? kFALSE : kTRUE, emit); }
virtual void SetEnabled(Bool_t e = kTRUE);
virtual void SavePrimitive(ostream &out, Option_t *option = "");
GContext_t GetNormGC() const { return fNormGC; }
virtual void Pressed() { Emit("Pressed()"); }
virtual void Released() { Emit("Released()"); }
virtual void Clicked() { Emit("Clicked()"); }
virtual void Toggled(Bool_t on) { Emit("Toggled(Bool_t)", on); }
ClassDef(TGButton,0)
};
class TGTextButton : public TGButton {
protected:
TGHotString *fLabel;
Int_t fTMode;
Int_t fHKeycode;
FontStruct_t fFontStruct;
Bool_t fHasOwnFont;
static const TGFont *fgDefaultFont;
void Init();
virtual void DoRedraw();
private:
TGTextButton(const TGTextButton&);
TGTextButton& operator=(const TGTextButton&);
public:
static FontStruct_t GetDefaultFontStruct();
TGTextButton(const TGWindow *p, TGHotString *s, Int_t id = -1,
GContext_t norm = GetDefaultGC()(),
FontStruct_t font = GetDefaultFontStruct(),
UInt_t option = kRaisedFrame | kDoubleBorder);
TGTextButton(const TGWindow *p = 0, const char *s = 0, Int_t id = -1,
GContext_t norm = GetDefaultGC()(),
FontStruct_t font = GetDefaultFontStruct(),
UInt_t option = kRaisedFrame | kDoubleBorder);
TGTextButton(const TGWindow *p, const char *s, const char *cmd,
Int_t id = -1, GContext_t norm = GetDefaultGC()(),
FontStruct_t font = GetDefaultFontStruct(),
UInt_t option = kRaisedFrame | kDoubleBorder);
virtual ~TGTextButton();
virtual TGDimension GetDefaultSize() const
{ return TGDimension(fTWidth+8, fTHeight+7); }
virtual Bool_t HandleKey(Event_t *event);
const TGHotString *GetText() const { return fLabel; }
virtual const char *GetTitle() const { return fLabel->Data(); }
TString GetString() const { return TString(fLabel->GetString()); }
virtual void SetTextJustify(Int_t tmode);
Int_t GetTextJustify() const { return fTMode; }
virtual void SetText(TGHotString *new_label);
virtual void SetText(const TString &new_label);
virtual void SetTitle(const char *label) { SetText(label); }
virtual void SetFont(FontStruct_t font, Bool_t global = kFALSE);
virtual void SetFont(const char *fontName, Bool_t global = kFALSE);
virtual void SetTextColor(Pixel_t color, Bool_t global = kFALSE);
virtual void SetForegroundColor(Pixel_t fore) { SetTextColor(fore); }
Bool_t HasOwnFont() const;
void ChangeText(const char *title) { SetTitle(title); }
FontStruct_t GetFontStruct() const { return fFontStruct; }
virtual void SavePrimitive(ostream &out, Option_t *option = "");
ClassDef(TGTextButton,0)
};
class TGPictureButton : public TGButton {
protected:
const TGPicture *fPic;
const TGPicture *fPicD;
Bool_t fOwnDisabledPic;
virtual void DoRedraw();
virtual void CreateDisabledPicture();
private:
TGPictureButton(const TGPictureButton&);
TGPictureButton& operator=(const TGPictureButton&);
public:
TGPictureButton(const TGWindow *p, const TGPicture *pic, Int_t id = -1,
GContext_t norm = GetDefaultGC()(),
UInt_t option = kRaisedFrame | kDoubleBorder);
TGPictureButton(const TGWindow *p, const TGPicture *pic, const char *cmd,
Int_t id = -1, GContext_t norm = GetDefaultGC()(),
UInt_t option = kRaisedFrame | kDoubleBorder);
TGPictureButton(const TGWindow *p = 0, const char* pic = 0, Int_t id = -1,
GContext_t norm = GetDefaultGC()(),
UInt_t option = kRaisedFrame | kDoubleBorder);
virtual ~TGPictureButton();
virtual void SetPicture(const TGPicture *new_pic);
virtual void SetDisabledPicture(const TGPicture *pic);
const TGPicture *GetPicture() const { return fPic; };
const TGPicture *GetDisabledPicture() const { return fPicD; };
virtual void SavePrimitive(ostream &out, Option_t *option = "");
ClassDef(TGPictureButton,0)
};
class TGCheckButton : public TGTextButton {
protected:
EButtonState fPrevState;
void Init();
void PSetState(EButtonState state, Bool_t emit);
virtual void DoRedraw();
virtual void EmitSignals(Bool_t wasUp = kTRUE);
static const TGFont *fgDefaultFont;
static const TGGC *fgDefaultGC;
public:
static FontStruct_t GetDefaultFontStruct();
static const TGGC &GetDefaultGC();
TGCheckButton(const TGWindow *p, TGHotString *s, Int_t id = -1,
GContext_t norm = GetDefaultGC()(),
FontStruct_t font = GetDefaultFontStruct(),
UInt_t option = 0);
TGCheckButton(const TGWindow *p = 0, const char *s = 0, Int_t id = -1,
GContext_t norm = GetDefaultGC()(),
FontStruct_t font = GetDefaultFontStruct(),
UInt_t option = 0);
TGCheckButton(const TGWindow *p, const char *s, const char *cmd, Int_t id = -1,
GContext_t norm = GetDefaultGC()(),
FontStruct_t font = GetDefaultFontStruct(),
UInt_t option = 0);
virtual ~TGCheckButton();
virtual TGDimension GetDefaultSize() const
{ return TGDimension(fTWidth+22, fTHeight+2); }
virtual Bool_t HandleButton(Event_t *event);
virtual Bool_t HandleKey(Event_t *event);
virtual Bool_t HandleCrossing(Event_t *event);
virtual Bool_t IsToggleButton() const { return kTRUE; }
virtual Bool_t IsOn() const { return fState == kButtonDown; }
virtual Bool_t IsDown() const { return fState == kButtonDown; }
virtual void SetState(EButtonState state, Bool_t emit = kFALSE);
virtual void SavePrimitive(ostream &out, Option_t *option = "");
ClassDef(TGCheckButton,0)
};
class TGRadioButton : public TGTextButton {
private:
TGRadioButton(const TGRadioButton&);
TGRadioButton& operator=(const TGRadioButton&);
protected:
EButtonState fPrevState;
const TGPicture *fOn;
const TGPicture *fOff;
void Init();
void PSetState(EButtonState state, Bool_t emit);
virtual void DoRedraw();
virtual void EmitSignals(Bool_t wasUp = kTRUE);
static const TGFont *fgDefaultFont;
static const TGGC *fgDefaultGC;
public:
static FontStruct_t GetDefaultFontStruct();
static const TGGC &GetDefaultGC();
TGRadioButton(const TGWindow *p, TGHotString *s, Int_t id = -1,
GContext_t norm = GetDefaultGC()(),
FontStruct_t font = GetDefaultFontStruct(),
UInt_t option = 0);
TGRadioButton(const TGWindow *p = 0, const char *s = 0, Int_t id = -1,
GContext_t norm = GetDefaultGC()(),
FontStruct_t font = GetDefaultFontStruct(),
UInt_t option = 0);
TGRadioButton(const TGWindow *p, const char *s, const char *cmd, Int_t id = -1,
GContext_t norm = GetDefaultGC()(),
FontStruct_t font = GetDefaultFontStruct(),
UInt_t option = 0);
virtual ~TGRadioButton();
virtual TGDimension GetDefaultSize() const
{ return TGDimension(fTWidth+22, fTHeight+2); }
virtual Bool_t HandleButton(Event_t *event);
virtual Bool_t HandleKey(Event_t *event);
virtual Bool_t HandleCrossing(Event_t *event);
virtual void SetState(EButtonState state, Bool_t emit = kFALSE);
virtual Bool_t IsToggleButton() const { return kTRUE; }
virtual Bool_t IsExclusiveToggle() const { return kTRUE; }
virtual Bool_t IsOn() const { return fState == kButtonDown; }
virtual Bool_t IsDown() const { return fState == kButtonDown; }
virtual void SavePrimitive(ostream &out, Option_t *option = "");
ClassDef(TGRadioButton,0)
};
#endif
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.