Logo ROOT  
Reference Guide
TGButtonGroup.h
Go to the documentation of this file.
1 // @(#)root/gui:$Id$
2 // Author: Valeriy Onuchin & Fons Rademakers 16/10/2000
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TGButtonGroup
13 #define ROOT_TGButtonGroup
14 
15 
16 #include "TGFrame.h"
17 
18 class TGButton;
19 class TMap;
20 
21 class TGButtonGroup : public TGGroupFrame {
22 
23 friend class TGButton;
24 
25 private:
26  TGButtonGroup(const TGButtonGroup&) = delete;
28 
29 protected:
30  Bool_t fState; ///< kTRUE if group is enabled
31  Bool_t fExclGroup; ///< kTRUE if group is exclusive
32  Bool_t fRadioExcl; ///< kTRUE if radio buttons are exclusive
33  Bool_t fDrawBorder; ///< kTRUE if border and title are drawn
34  TMap *fMapOfButtons; ///< map of button/id pairs in this group
35 
36  void Init();
37  virtual void DoRedraw();
38 
39 public:
40  TGButtonGroup(const TGWindow *parent = 0,
41  const TString &title = "",
42  UInt_t options = kChildFrame | kVerticalFrame,
43  GContext_t norm = GetDefaultGC()(),
46 
47  TGButtonGroup(const TGWindow *parent,
48  UInt_t r, UInt_t c, Int_t s = 0, Int_t h = 0 ,
49  const TString &title = "",
50  GContext_t norm = GetDefaultGC()(),
53 
54  virtual ~TGButtonGroup();
55 
56  virtual void Pressed(Int_t id) { Emit("Pressed(Int_t)",id); } //*SIGNAL*
57  virtual void Released(Int_t id) { Emit("Released(Int_t)",id);} //*SIGNAL*
58  virtual void Clicked(Int_t id) { Emit("Clicked(Int_t)",id); } //*SIGNAL*
59 
60  virtual void ButtonPressed();
61  virtual void ButtonReleased();
62  virtual void ButtonClicked();
63  virtual void ReleaseButtons();
64 
65  Bool_t IsEnabled() const { return fState; }
66  Bool_t IsExclusive() const { return fExclGroup; }
68  Bool_t IsBorderDrawn() const { return fDrawBorder; }
69  Int_t GetCount() const;
70  Int_t GetId(TGButton *button) const;
71 
72  virtual void SetExclusive(Bool_t flag = kTRUE);
73  virtual void SetRadioButtonExclusive(Bool_t flag = kTRUE);
74  virtual void SetState(Bool_t state = kTRUE);
75  virtual void SetBorderDrawn(Bool_t enable = kTRUE);
76  virtual void SetButton(Int_t id, Bool_t down = kTRUE);
77  virtual void SetTitle(TGString *title);
78  virtual void SetTitle(const char *title);
79 
80  virtual Int_t Insert(TGButton *button, int id = -1);
81  virtual void Remove(TGButton *button);
82  virtual TGButton *Find(Int_t id) const;
83  virtual TGButton *GetButton(Int_t id) const { return Find(id); }
84  virtual void Show();
85  virtual void Hide();
86  virtual void DrawBorder();
87  virtual void SetLayoutHints(TGLayoutHints *l, TGButton *button = 0);
88  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
89 
90  ClassDef(TGButtonGroup,0) // Organizes TGButtons in a group
91 };
92 
93 
94 class TGVButtonGroup : public TGButtonGroup {
95 
96 public:
97  TGVButtonGroup(const TGWindow *parent,
98  const TString &title = "",
99  GContext_t norm = GetDefaultGC()(),
102  TGButtonGroup(parent, title, kChildFrame | kVerticalFrame,
103  norm, font, back) { }
104 
105  virtual ~TGVButtonGroup() { }
106  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
107 
108  ClassDef(TGVButtonGroup,0) // A button group with one vertical column
109 };
110 
111 
113 
114 public:
115  TGHButtonGroup(const TGWindow *parent,
116  const TString &title = "",
117  GContext_t norm = GetDefaultGC()(),
120  TGButtonGroup(parent, title, kChildFrame | kHorizontalFrame,
121  norm, font, back) { }
122 
123  virtual ~TGHButtonGroup() { }
124  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
125 
126  ClassDef(TGHButtonGroup,0) // A button group with one horizontal row
127 };
128 
129 #endif
c
#define c(i)
Definition: RSha256.hxx:101
l
auto * l
Definition: textangle.C:4
TGButtonGroup::Insert
virtual Int_t Insert(TGButton *button, int id=-1)
Inserts a button with the identifier id into the button group.
Definition: TGButtonGroup.cxx:371
TGButtonGroup::SetButton
virtual void SetButton(Int_t id, Bool_t down=kTRUE)
Sets the button with id to be on/down, and if this is an exclusive group, all other button in the gro...
Definition: TGButtonGroup.cxx:344
TGButtonGroup::ButtonReleased
virtual void ButtonReleased()
This slot is activated when one of the buttons in the group emits the Released() signal.
Definition: TGButtonGroup.cxx:493
TGWindow
ROOT GUI Window base class.
Definition: TGWindow.h:23
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:100
TGButtonGroup::TGButtonGroup
TGButtonGroup(const TGButtonGroup &)=delete
TGButtonGroup::Pressed
virtual void Pressed(Int_t id)
Definition: TGButtonGroup.h:56
TGButtonGroup::Released
virtual void Released(Int_t id)
Definition: TGButtonGroup.h:57
Option_t
const char Option_t
Definition: RtypesCore.h:66
TGVButtonGroup::TGVButtonGroup
TGVButtonGroup(const TGWindow *parent, const TString &title="", GContext_t norm=GetDefaultGC()(), FontStruct_t font=GetDefaultFontStruct(), Pixel_t back=GetDefaultFrameBackground())
Definition: TGButtonGroup.h:97
TGButtonGroup::Show
virtual void Show()
Show group of buttons.
Definition: TGButtonGroup.cxx:549
Pixel_t
ULong_t Pixel_t
Pixel value.
Definition: GuiTypes.h:40
kVerticalFrame
@ kVerticalFrame
Definition: GuiTypes.h:381
FontStruct_t
Handle_t FontStruct_t
Pointer to font structure.
Definition: GuiTypes.h:39
TGButtonGroup::DrawBorder
virtual void DrawBorder()
Draw border of around the group frame.
Definition: TGButtonGroup.cxx:195
r
ROOT::R::TRInterface & r
Definition: Object.C:4
TGButtonGroup::Clicked
virtual void Clicked(Int_t id)
Definition: TGButtonGroup.h:58
TGVButtonGroup::~TGVButtonGroup
virtual ~TGVButtonGroup()
Definition: TGButtonGroup.h:105
TGeant4Unit::s
static constexpr double s
Definition: TGeant4SystemOfUnits.h:162
TGButtonGroup::SavePrimitive
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a button group widget as a C++ statement(s) on output stream out.
Definition: TGButtonGroup.cxx:619
Int_t
int Int_t
Definition: RtypesCore.h:45
TGButtonGroup::fState
Bool_t fState
kTRUE if group is enabled
Definition: TGButtonGroup.h:30
TGFrame::GetDefaultFrameBackground
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition: TGFrame.cxx:683
TGButtonGroup::SetLayoutHints
virtual void SetLayoutHints(TGLayoutHints *l, TGButton *button=0)
Set layout hints for the specified button or if button=0 for all buttons.
Definition: TGButtonGroup.cxx:603
TGButtonGroup
Organizes TGButton widgets in a group.
Definition: TGButtonGroup.h:21
TString
Basic string class.
Definition: TString.h:136
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TGObject::GetId
Handle_t GetId() const
Definition: TGObject.h:37
TGButtonGroup::Remove
virtual void Remove(TGButton *button)
Removes a button from the button group.
Definition: TGButtonGroup.cxx:411
TGHButtonGroup
Organizes TGButton widgets in a group with one horizontal row.
Definition: TGButtonGroup.h:112
TGButtonGroup::GetCount
Int_t GetCount() const
Returns number of buttons in group.
Definition: TGButtonGroup.cxx:442
bool
TGButtonGroup::ButtonClicked
virtual void ButtonClicked()
This slot is activated when one of the buttons in the group emits the Clicked() signal.
Definition: TGButtonGroup.cxx:508
GContext_t
Handle_t GContext_t
Graphics context handle.
Definition: GuiTypes.h:38
TGHButtonGroup::TGHButtonGroup
TGHButtonGroup(const TGWindow *parent, const TString &title="", GContext_t norm=GetDefaultGC()(), FontStruct_t font=GetDefaultFontStruct(), Pixel_t back=GetDefaultFrameBackground())
Definition: TGButtonGroup.h:115
TGVButtonGroup
Organizes TGButton widgets in a group with one vertical column.
Definition: TGButtonGroup.h:94
TGButtonGroup::SetExclusive
virtual void SetExclusive(Bool_t flag=kTRUE)
Sets the button group to be exclusive if enable is kTRUE, or to be non-exclusive if enable is kFALSE.
Definition: TGButtonGroup.cxx:299
TGButtonGroup::IsExclusive
Bool_t IsExclusive() const
Definition: TGButtonGroup.h:66
TGButtonGroup::ReleaseButtons
virtual void ReleaseButtons()
This slot is activated when one of the buttons in the exclusive group emits the Pressed() signal.
Definition: TGButtonGroup.cxx:523
TGButtonGroup::fDrawBorder
Bool_t fDrawBorder
kTRUE if border and title are drawn
Definition: TGButtonGroup.h:33
TGButtonGroup::SetBorderDrawn
virtual void SetBorderDrawn(Bool_t enable=kTRUE)
Makes border to be visible/invisible.
Definition: TGButtonGroup.cxx:283
TGButtonGroup::SetTitle
virtual void SetTitle(TGString *title)
Set or change title.
Definition: TGButtonGroup.cxx:568
TGButtonGroup::GetButton
virtual TGButton * GetButton(Int_t id) const
Definition: TGButtonGroup.h:83
h
#define h(i)
Definition: RSha256.hxx:106
TGFrame.h
TGLayoutHints
This class describes layout hints used by the layout classes.
Definition: TGLayout.h:50
TGGroupFrame
A composite frame with a border and a title.
Definition: TGFrame.h:522
TGGroupFrame::GetDefaultFontStruct
static FontStruct_t GetDefaultFontStruct()
Return default font structure in use.
Definition: TGFrame.cxx:2311
TGVButtonGroup::SavePrimitive
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a button group widget as a C++ statement(s) on output stream out.
Definition: TGButtonGroup.cxx:803
TGButtonGroup::fMapOfButtons
TMap * fMapOfButtons
map of button/id pairs in this group
Definition: TGButtonGroup.h:34
TGButtonGroup::SetState
virtual void SetState(Bool_t state=kTRUE)
Sets the state of all the buttons in the group to enable or disable.
Definition: TGButtonGroup.cxx:324
TGButtonGroup::ButtonPressed
virtual void ButtonPressed()
This slot is activated when one of the buttons in the group emits the Pressed() signal.
Definition: TGButtonGroup.cxx:464
TGButtonGroup::SetRadioButtonExclusive
virtual void SetRadioButtonExclusive(Bool_t flag=kTRUE)
If enable is kTRUE, this button group will treat radio buttons as mutually exclusive,...
Definition: TGButtonGroup.cxx:313
unsigned int
kHorizontalFrame
@ kHorizontalFrame
Definition: GuiTypes.h:382
TGButtonGroup::Find
virtual TGButton * Find(Int_t id) const
Finds and returns a pointer to the button with the specified identifier id.
Definition: TGButtonGroup.cxx:427
TGButtonGroup::~TGButtonGroup
virtual ~TGButtonGroup()
Destructor, we do not delete the buttons.
Definition: TGButtonGroup.cxx:166
TGButtonGroup::IsRadioButtonExclusive
Bool_t IsRadioButtonExclusive() const
Definition: TGButtonGroup.h:67
TGButtonGroup::Hide
virtual void Hide()
Hide group of buttons.
Definition: TGButtonGroup.cxx:560
TGButtonGroup::DoRedraw
virtual void DoRedraw()
Redraw the group frame.
Definition: TGButtonGroup.cxx:182
TGButtonGroup::IsBorderDrawn
Bool_t IsBorderDrawn() const
Definition: TGButtonGroup.h:68
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TGButtonGroup::fExclGroup
Bool_t fExclGroup
kTRUE if group is exclusive
Definition: TGButtonGroup.h:31
TGButtonGroup::operator=
TGButtonGroup & operator=(const TGButtonGroup &)=delete
TGButtonGroup::fRadioExcl
Bool_t fRadioExcl
kTRUE if radio buttons are exclusive
Definition: TGButtonGroup.h:32
TGHButtonGroup::~TGHButtonGroup
virtual ~TGHButtonGroup()
Definition: TGButtonGroup.h:123
TGButton
A button abstract base class.
Definition: TGButton.h:68
TGGroupFrame::GetDefaultGC
static const TGGC & GetDefaultGC()
Return default graphics context in use.
Definition: TGFrame.cxx:2321
TGButtonGroup::Init
void Init()
Default init.
Definition: TGButtonGroup.cxx:152
TGButtonGroup::IsEnabled
Bool_t IsEnabled() const
Definition: TGButtonGroup.h:65
TGString
TGString wraps a TString and adds some graphics routines like drawing, size of string on screen depen...
Definition: TGString.h:20
TGHButtonGroup::SavePrimitive
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a button group widget as a C++ statement(s) on output stream out.
Definition: TGButtonGroup.cxx:716
TQObject::Emit
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition: TQObject.h:164
kChildFrame
@ kChildFrame
Definition: GuiTypes.h:379
int
TMap
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
Definition: TMap.h:40