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 // //
17 // TGButtonGroup, TGVButtonGroup and TGHButtonGroup //
18 // //
19 // This header defines button group frames. //
20 // //
21 //////////////////////////////////////////////////////////////////////////
22 
23 #include "TGFrame.h"
24 #include "TMap.h"
25 
26 
27 class TGButton;
28 
29 
30 
31 class TGButtonGroup : public TGGroupFrame {
32 
33 friend class TGButton;
34 
35 private:
36  TGButtonGroup(const TGButtonGroup&); // Not implemented
37  TGButtonGroup& operator=(const TGButtonGroup&); // Not implemented
38 
39 protected:
40  Bool_t fState; // kTRUE if group is enabled
41  Bool_t fExclGroup; // kTRUE if group is exclusive
42  Bool_t fRadioExcl; // kTRUE if radio buttons are exclusive
43  Bool_t fDrawBorder; // kTRUE if border and title are drawn
44  TMap *fMapOfButtons; // map of button/id pairs in this group
45 
46  void Init();
47  virtual void DoRedraw();
48 
49 public:
50  TGButtonGroup(const TGWindow *parent = 0,
51  const TString &title = "",
52  UInt_t options = kChildFrame | kVerticalFrame,
53  GContext_t norm = GetDefaultGC()(),
56 
57  TGButtonGroup(const TGWindow *parent,
58  UInt_t r, UInt_t c, Int_t s = 0, Int_t h = 0 ,
59  const TString &title = "",
60  GContext_t norm = GetDefaultGC()(),
63 
64  virtual ~TGButtonGroup();
65 
66  virtual void Pressed(Int_t id) { Emit("Pressed(Int_t)",id); } //*SIGNAL*
67  virtual void Released(Int_t id) { Emit("Released(Int_t)",id);} //*SIGNAL*
68  virtual void Clicked(Int_t id) { Emit("Clicked(Int_t)",id); } //*SIGNAL*
69 
70  virtual void ButtonPressed();
71  virtual void ButtonReleased();
72  virtual void ButtonClicked();
73  virtual void ReleaseButtons();
74 
75  Bool_t IsEnabled() const { return fState; }
76  Bool_t IsExclusive() const { return fExclGroup; }
78  Bool_t IsBorderDrawn() const { return fDrawBorder; }
79  Int_t GetCount() const { return fMapOfButtons->GetSize(); }
80  Int_t GetId(TGButton *button) const;
81 
82  virtual void SetExclusive(Bool_t flag = kTRUE);
83  virtual void SetRadioButtonExclusive(Bool_t flag = kTRUE);
84  virtual void SetState(Bool_t state = kTRUE);
85  virtual void SetBorderDrawn(Bool_t enable = kTRUE);
86  virtual void SetButton(Int_t id, Bool_t down = kTRUE);
87  virtual void SetTitle(TGString *title);
88  virtual void SetTitle(const char *title);
89 
90  virtual Int_t Insert(TGButton *button, int id = -1);
91  virtual void Remove(TGButton *button);
92  virtual TGButton *Find(Int_t id) const;
93  virtual TGButton *GetButton(Int_t id) const { return Find(id); }
94  virtual void Show();
95  virtual void Hide();
96  virtual void DrawBorder();
97  virtual void SetLayoutHints(TGLayoutHints *l, TGButton *button = 0);
98  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
99 
100  ClassDef(TGButtonGroup,0) // Organizes TGButtons in a group
101 };
102 
103 
105 
106 public:
107  TGVButtonGroup(const TGWindow *parent,
108  const TString &title = "",
109  GContext_t norm = GetDefaultGC()(),
112  TGButtonGroup(parent, title, kChildFrame | kVerticalFrame,
113  norm, font, back) { }
114 
115  virtual ~TGVButtonGroup() { }
116  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
117 
118  ClassDef(TGVButtonGroup,0) // A button group with one vertical column
119 };
120 
121 
123 
124 public:
125  TGHButtonGroup(const TGWindow *parent,
126  const TString &title = "",
127  GContext_t norm = GetDefaultGC()(),
130  TGButtonGroup(parent, title, kChildFrame | kHorizontalFrame,
131  norm, font, back) { }
132 
133  virtual ~TGHButtonGroup() { }
134  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
135 
136  ClassDef(TGHButtonGroup,0) // A button group with one horizontal row
137 };
138 
139 #endif
c
#define c(i)
Definition: RSha256.hxx:119
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:361
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:334
TGButtonGroup::ButtonReleased
virtual void ButtonReleased()
This slot is activated when one of the buttons in the group emits the Released() signal.
Definition: TGButtonGroup.cxx:475
TGWindow
Definition: TGWindow.h:31
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
TGButtonGroup::Pressed
virtual void Pressed(Int_t id)
Definition: TGButtonGroup.h:66
TGButtonGroup::Released
virtual void Released(Int_t id)
Definition: TGButtonGroup.h:67
TGVButtonGroup::TGVButtonGroup
TGVButtonGroup(const TGWindow *parent, const TString &title="", GContext_t norm=GetDefaultGC()(), FontStruct_t font=GetDefaultFontStruct(), Pixel_t back=GetDefaultFrameBackground())
Definition: TGButtonGroup.h:107
TGButtonGroup::Show
virtual void Show()
Show group of buttons.
Definition: TGButtonGroup.cxx:531
Pixel_t
ULong_t Pixel_t
Definition: GuiTypes.h:39
kVerticalFrame
@ kVerticalFrame
Definition: GuiTypes.h:381
FontStruct_t
Handle_t FontStruct_t
Definition: GuiTypes.h:38
TGButtonGroup::DrawBorder
virtual void DrawBorder()
Draw border of around the group frame.
Definition: TGButtonGroup.cxx:185
r
ROOT::R::TRInterface & r
Definition: Object.C:4
TGButtonGroup::Clicked
virtual void Clicked(Int_t id)
Definition: TGButtonGroup.h:68
TGVButtonGroup::~TGVButtonGroup
virtual ~TGVButtonGroup()
Definition: TGButtonGroup.h:115
TGeant4Unit::s
static constexpr double s
Definition: TGeant4SystemOfUnits.h:168
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:601
Int_t
int Int_t
Definition: RtypesCore.h:45
TGButtonGroup::fState
Bool_t fState
Definition: TGButtonGroup.h:40
TGFrame::GetDefaultFrameBackground
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition: TGFrame.cxx:668
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:585
TGButtonGroup
Definition: TGButtonGroup.h:31
TString
Definition: TString.h:136
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TGObject::GetId
Handle_t GetId() const
Definition: TGObject.h:47
TGButtonGroup::Remove
virtual void Remove(TGButton *button)
Removes a button from the button group.
Definition: TGButtonGroup.cxx:401
TGHButtonGroup
Definition: TGButtonGroup.h:122
TGButtonGroup::GetCount
Int_t GetCount() const
Definition: TGButtonGroup.h:79
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:490
GContext_t
Handle_t GContext_t
Definition: GuiTypes.h:37
TGHButtonGroup::TGHButtonGroup
TGHButtonGroup(const TGWindow *parent, const TString &title="", GContext_t norm=GetDefaultGC()(), FontStruct_t font=GetDefaultFontStruct(), Pixel_t back=GetDefaultFrameBackground())
Definition: TGButtonGroup.h:125
TGVButtonGroup
Definition: TGButtonGroup.h:104
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:289
TGButtonGroup::IsExclusive
Bool_t IsExclusive() const
Definition: TGButtonGroup.h:76
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:505
TGButtonGroup::fDrawBorder
Bool_t fDrawBorder
Definition: TGButtonGroup.h:43
TGButtonGroup::SetBorderDrawn
virtual void SetBorderDrawn(Bool_t enable=kTRUE)
Makes border to be visible/invisible.
Definition: TGButtonGroup.cxx:273
TGButtonGroup::SetTitle
virtual void SetTitle(TGString *title)
Set or change title.
Definition: TGButtonGroup.cxx:550
Option_t
const typedef char Option_t
Definition: RtypesCore.h:66
TGButtonGroup::GetButton
virtual TGButton * GetButton(Int_t id) const
Definition: TGButtonGroup.h:93
h
#define h(i)
Definition: RSha256.hxx:124
TGFrame.h
TGLayoutHints
Definition: TGLayout.h:57
TGGroupFrame
Definition: TGFrame.h:587
TGGroupFrame::GetDefaultFontStruct
static FontStruct_t GetDefaultFontStruct()
Return default font structure in use.
Definition: TGFrame.cxx:2296
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:785
TGButtonGroup::fMapOfButtons
TMap * fMapOfButtons
Definition: TGButtonGroup.h:44
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:314
TGButtonGroup::ButtonPressed
virtual void ButtonPressed()
This slot is activated when one of the buttons in the group emits the Pressed() signal.
Definition: TGButtonGroup.cxx:446
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:303
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:417
TGButtonGroup::~TGButtonGroup
virtual ~TGButtonGroup()
Destructor, we do not delete the buttons.
Definition: TGButtonGroup.cxx:156
TGButtonGroup::IsRadioButtonExclusive
Bool_t IsRadioButtonExclusive() const
Definition: TGButtonGroup.h:77
TGButtonGroup::Hide
virtual void Hide()
Hide group of buttons.
Definition: TGButtonGroup.cxx:542
TGButtonGroup::DoRedraw
virtual void DoRedraw()
Redraw the group frame.
Definition: TGButtonGroup.cxx:172
TCollection::GetSize
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
Definition: TCollection.h:182
TGButtonGroup::IsBorderDrawn
Bool_t IsBorderDrawn() const
Definition: TGButtonGroup.h:78
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TGButtonGroup::TGButtonGroup
TGButtonGroup(const TGButtonGroup &)
TGButtonGroup::operator=
TGButtonGroup & operator=(const TGButtonGroup &)
TMap.h
TGButtonGroup::fExclGroup
Bool_t fExclGroup
Definition: TGButtonGroup.h:41
TGButtonGroup::fRadioExcl
Bool_t fRadioExcl
Definition: TGButtonGroup.h:42
TGHButtonGroup::~TGHButtonGroup
virtual ~TGHButtonGroup()
Definition: TGButtonGroup.h:133
TGButton
Definition: TGButton.h:68
TGGroupFrame::GetDefaultGC
static const TGGC & GetDefaultGC()
Return default graphics context in use.
Definition: TGFrame.cxx:2306
TGButtonGroup::Init
void Init()
Default init.
Definition: TGButtonGroup.cxx:142
TGButtonGroup::IsEnabled
Bool_t IsEnabled() const
Definition: TGButtonGroup.h:75
TGString
Definition: TGString.h:30
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:698
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
Definition: TMap.h:40