Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
25class TGButton;
26class TMap;
27
29
30friend class TGButton;
31
32private:
33 TGButtonGroup(const TGButtonGroup&) = delete;
35
36protected:
37 Bool_t fState; // kTRUE if group is enabled
38 Bool_t fExclGroup; // kTRUE if group is exclusive
39 Bool_t fRadioExcl; // kTRUE if radio buttons are exclusive
40 Bool_t fDrawBorder; // kTRUE if border and title are drawn
41 TMap *fMapOfButtons; // map of button/id pairs in this group
42
43 void Init();
44 virtual void DoRedraw();
45
46public:
47 TGButtonGroup(const TGWindow *parent = 0,
48 const TString &title = "",
50 GContext_t norm = GetDefaultGC()(),
53
54 TGButtonGroup(const TGWindow *parent,
55 UInt_t r, UInt_t c, Int_t s = 0, Int_t h = 0 ,
56 const TString &title = "",
57 GContext_t norm = GetDefaultGC()(),
60
61 virtual ~TGButtonGroup();
62
63 virtual void Pressed(Int_t id) { Emit("Pressed(Int_t)",id); } //*SIGNAL*
64 virtual void Released(Int_t id) { Emit("Released(Int_t)",id);} //*SIGNAL*
65 virtual void Clicked(Int_t id) { Emit("Clicked(Int_t)",id); } //*SIGNAL*
66
67 virtual void ButtonPressed();
68 virtual void ButtonReleased();
69 virtual void ButtonClicked();
70 virtual void ReleaseButtons();
71
72 Bool_t IsEnabled() const { return fState; }
73 Bool_t IsExclusive() const { return fExclGroup; }
75 Bool_t IsBorderDrawn() const { return fDrawBorder; }
76 Int_t GetCount() const;
77 Int_t GetId(TGButton *button) const;
78
79 virtual void SetExclusive(Bool_t flag = kTRUE);
80 virtual void SetRadioButtonExclusive(Bool_t flag = kTRUE);
81 virtual void SetState(Bool_t state = kTRUE);
82 virtual void SetBorderDrawn(Bool_t enable = kTRUE);
83 virtual void SetButton(Int_t id, Bool_t down = kTRUE);
84 virtual void SetTitle(TGString *title);
85 virtual void SetTitle(const char *title);
86
87 virtual Int_t Insert(TGButton *button, int id = -1);
88 virtual void Remove(TGButton *button);
89 virtual TGButton *Find(Int_t id) const;
90 virtual TGButton *GetButton(Int_t id) const { return Find(id); }
91 virtual void Show();
92 virtual void Hide();
93 virtual void DrawBorder();
94 virtual void SetLayoutHints(TGLayoutHints *l, TGButton *button = 0);
95 virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
96
97 ClassDef(TGButtonGroup,0) // Organizes TGButtons in a group
98};
99
100
102
103public:
105 const TString &title = "",
106 GContext_t norm = GetDefaultGC()(),
110 norm, font, back) { }
111
112 virtual ~TGVButtonGroup() { }
113 virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
114
115 ClassDef(TGVButtonGroup,0) // A button group with one vertical column
116};
117
118
120
121public:
123 const TString &title = "",
124 GContext_t norm = GetDefaultGC()(),
128 norm, font, back) { }
129
130 virtual ~TGHButtonGroup() { }
131 virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
132
133 ClassDef(TGHButtonGroup,0) // A button group with one horizontal row
134};
135
136#endif
@ kChildFrame
Definition GuiTypes.h:379
@ kVerticalFrame
Definition GuiTypes.h:381
@ kHorizontalFrame
Definition GuiTypes.h:382
Handle_t GContext_t
Graphics context handle.
Definition GuiTypes.h:38
Handle_t FontStruct_t
Pointer to font structure.
Definition GuiTypes.h:39
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
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:45
bool Bool_t
Definition RtypesCore.h:63
const Bool_t kTRUE
Definition RtypesCore.h:91
const char Option_t
Definition RtypesCore.h:66
#define ClassDef(name, id)
Definition Rtypes.h:325
virtual ~TGButtonGroup()
Destructor, we do not delete the buttons.
Int_t GetCount() const
Returns number of buttons in group.
virtual void Clicked(Int_t id)
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,...
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)
virtual void ButtonPressed()
This slot is activated when one of the buttons in the group emits the Pressed() signal.
TGButtonGroup(const TGButtonGroup &)=delete
Bool_t IsEnabled() const
Bool_t IsExclusive() const
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 IsRadioButtonExclusive() const
virtual void DoRedraw()
Redraw the group frame.
TGButtonGroup & operator=(const TGButtonGroup &)=delete
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
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...
virtual TGButton * GetButton(Int_t id) const
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
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.
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)
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition TGFrame.cxx:668
static const TGGC & GetDefaultGC()
Return default graphics context in use.
Definition TGFrame.cxx:2306
static FontStruct_t GetDefaultFontStruct()
Return default font structure in use.
Definition TGFrame.cxx:2296
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:136
auto * l
Definition textangle.C:4