Logo ROOT   6.18/05
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
27class TGButton;
28
29
30
32
33friend class TGButton;
34
35private:
36 TGButtonGroup(const TGButtonGroup&); // Not implemented
37 TGButtonGroup& operator=(const TGButtonGroup&); // Not implemented
38
39protected:
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
49public:
50 TGButtonGroup(const TGWindow *parent = 0,
51 const TString &title = "",
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
106public:
108 const TString &title = "",
109 GContext_t norm = GetDefaultGC()(),
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
124public:
126 const TString &title = "",
127 GContext_t norm = GetDefaultGC()(),
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
Handle_t GContext_t
Definition: GuiTypes.h:37
Handle_t FontStruct_t
Definition: GuiTypes.h:38
ULong_t Pixel_t
Definition: GuiTypes.h:39
ROOT::R::TRInterface & r
Definition: Object.C:4
#define c(i)
Definition: RSha256.hxx:101
#define h(i)
Definition: RSha256.hxx:106
int Int_t
Definition: RtypesCore.h:41
unsigned int UInt_t
Definition: RtypesCore.h:42
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kTRUE
Definition: RtypesCore.h:87
const char Option_t
Definition: RtypesCore.h:62
#define ClassDef(name, id)
Definition: Rtypes.h:326
@ kChildFrame
Definition: TGFrame.h:57
@ kVerticalFrame
Definition: TGFrame.h:59
@ kHorizontalFrame
Definition: TGFrame.h:60
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
Definition: TCollection.h:182
virtual ~TGButtonGroup()
Destructor, we do not delete the buttons.
Int_t GetCount() const
Definition: TGButtonGroup.h:79
virtual void Clicked(Int_t id)
Definition: TGButtonGroup.h:68
virtual void ButtonClicked()
This slot is activated when one of the buttons in the group emits the Clicked() signal.
virtual void SetRadioButtonExclusive(Bool_t flag=kTRUE)
If enable is kTRUE, this button group will treat radio buttons as mutually exclusive,...
TGButtonGroup(const TGButtonGroup &)
virtual void Show()
Show group of buttons.
virtual void DrawBorder()
Draw border of around the group frame.
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.
virtual void Pressed(Int_t id)
Definition: TGButtonGroup.h:66
virtual void ButtonPressed()
This slot is activated when one of the buttons in the group emits the Pressed() signal.
Bool_t IsEnabled() const
Definition: TGButtonGroup.h:75
Bool_t IsExclusive() const
Definition: TGButtonGroup.h:76
virtual void SetState(Bool_t state=kTRUE)
Sets the state of all the buttons in the group to enable or disable.
virtual void ReleaseButtons()
This slot is activated when one of the buttons in the exclusive group emits the Pressed() signal.
virtual TGButton * Find(Int_t id) const
Finds and returns a pointer to the button with the specified identifier id.
Bool_t fDrawBorder
Definition: TGButtonGroup.h:43
Bool_t IsRadioButtonExclusive() const
Definition: TGButtonGroup.h:77
virtual void DoRedraw()
Redraw the group frame.
TGButtonGroup & operator=(const TGButtonGroup &)
virtual void SetLayoutHints(TGLayoutHints *l, TGButton *button=0)
Set layout hints for the specified button or if button=0 for all buttons.
Bool_t IsBorderDrawn() const
Definition: TGButtonGroup.h:78
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...
Bool_t fExclGroup
Definition: TGButtonGroup.h:41
virtual TGButton * GetButton(Int_t id) const
Definition: TGButtonGroup.h:93
void Init()
Default init.
virtual void ButtonReleased()
This slot is activated when one of the buttons in the group emits the Released() signal.
TMap * fMapOfButtons
Definition: TGButtonGroup.h:44
virtual void SetTitle(TGString *title)
Set or change title.
virtual void Hide()
Hide group of buttons.
virtual void Remove(TGButton *button)
Removes a button from the button group.
virtual Int_t Insert(TGButton *button, int id=-1)
Inserts a button with the identifier id into the button group.
virtual void SetBorderDrawn(Bool_t enable=kTRUE)
Makes border to be visible/invisible.
Bool_t fRadioExcl
Definition: TGButtonGroup.h:42
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a button group widget as a C++ statement(s) on output stream out.
virtual void Released(Int_t id)
Definition: TGButtonGroup.h:67
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition: TGFrame.cxx:665
static const TGGC & GetDefaultGC()
Return default graphics context in use.
Definition: TGFrame.cxx:2301
static FontStruct_t GetDefaultFontStruct()
Return default font structure in use.
Definition: TGFrame.cxx:2291
TGHButtonGroup(const TGWindow *parent, const TString &title="", GContext_t norm=GetDefaultGC()(), FontStruct_t font=GetDefaultFontStruct(), Pixel_t back=GetDefaultFrameBackground())
virtual ~TGHButtonGroup()
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a button group widget as a C++ statement(s) on output stream out.
Handle_t GetId() const
Definition: TGObject.h:47
TGVButtonGroup(const TGWindow *parent, const TString &title="", GContext_t norm=GetDefaultGC()(), FontStruct_t font=GetDefaultFontStruct(), Pixel_t back=GetDefaultFrameBackground())
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a button group widget as a C++ statement(s) on output stream out.
virtual ~TGVButtonGroup()
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
Definition: TMap.h:40
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition: TQObject.h:164
Basic string class.
Definition: TString.h:131
static constexpr double s
auto * l
Definition: textangle.C:4