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#include "TGFrame.h"
17
18class TGButton;
19class TMap;
20
22
23friend class TGButton;
24
25private:
26 TGButtonGroup(const TGButtonGroup&) = delete;
28
29protected:
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 void DoRedraw() override;
38
39public:
40 TGButtonGroup(const TGWindow *parent = nullptr,
41 const TString &title = "",
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 void SetTitle(TGString *title) override;
78 void SetTitle(const char *title) override;
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 void DrawBorder() override;
87 virtual void SetLayoutHints(TGLayoutHints *l, TGButton *button = nullptr);
88 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
89
90 ClassDefOverride(TGButtonGroup,0) // Organizes TGButtons in a group
91};
92
93
95
96public:
97 TGVButtonGroup(const TGWindow *parent,
98 const TString &title = "",
99 GContext_t norm = GetDefaultGC()(),
103 norm, font, back) {}
104
105 virtual ~TGVButtonGroup() {}
106 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
107
108 ClassDefOverride(TGVButtonGroup,0) // A button group with one vertical column
109};
110
111
113
114public:
116 const TString &title = "",
117 GContext_t norm = GetDefaultGC()(),
121 norm, font, back) { }
122
123 virtual ~TGHButtonGroup() {}
124 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
125
126 ClassDefOverride(TGHButtonGroup,0) // A button group with one horizontal row
127};
128
129#endif
Handle_t GContext_t
Graphics context handle.
Definition GuiTypes.h:38
@ kChildFrame
Definition GuiTypes.h:379
@ kVerticalFrame
Definition GuiTypes.h:381
@ kHorizontalFrame
Definition GuiTypes.h:382
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
Handle_t FontStruct_t
Pointer to font structure.
Definition GuiTypes.h:39
#define c(i)
Definition RSha256.hxx:101
#define h(i)
Definition RSha256.hxx:106
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t button
Organizes TGButton widgets in a group.
virtual ~TGButtonGroup()
Destructor, we do not delete the buttons.
Int_t GetCount() const
Returns number of buttons in group.
virtual void SetLayoutHints(TGLayoutHints *l, TGButton *button=nullptr)
Set layout hints for the specified button or if button=0 for all buttons.
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,...
void DoRedraw() override
Redraw the group frame.
virtual void Show()
Show group of buttons.
Bool_t fState
kTRUE if group is enabled
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
void DrawBorder() override
Draw border of around the group frame.
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 fDrawBorder
kTRUE if border and title are drawn
Bool_t IsRadioButtonExclusive() const
TGButtonGroup & operator=(const TGButtonGroup &)=delete
Bool_t IsBorderDrawn() const
void SetTitle(TGString *title) override
Set or change title.
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
kTRUE if group is exclusive
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
map of button/id pairs in this group
virtual void Hide()
Hide group of buttons.
virtual void Remove(TGButton *button)
Removes a button from the button group.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a button group widget as a C++ statement(s) on output stream out.
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
kTRUE if radio buttons are exclusive
virtual void Released(Int_t id)
A button abstract base class.
Definition TGButton.h:68
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition TGFrame.cxx:683
A composite frame with a border and a title.
Definition TGFrame.h:522
static const TGGC & GetDefaultGC()
Return default graphics context in use.
Definition TGFrame.cxx:2347
static FontStruct_t GetDefaultFontStruct()
Return default font structure in use.
Definition TGFrame.cxx:2337
Organizes TGButton widgets in a group with one horizontal row.
TGHButtonGroup(const TGWindow *parent, const TString &title="", GContext_t norm=GetDefaultGC()(), FontStruct_t font=GetDefaultFontStruct(), Pixel_t back=GetDefaultFrameBackground())
virtual ~TGHButtonGroup()
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a button group widget as a C++ statement(s) on output stream out.
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
Handle_t GetId() const
Definition TGObject.h:41
TGString wraps a TString and adds some graphics routines like drawing, size of string on screen depen...
Definition TGString.h:20
Organizes TGButton widgets in a group with one vertical column.
TGVButtonGroup(const TGWindow *parent, const TString &title="", GContext_t norm=GetDefaultGC()(), FontStruct_t font=GetDefaultFontStruct(), Pixel_t back=GetDefaultFrameBackground())
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a button group widget as a C++ statement(s) on output stream out.
virtual ~TGVButtonGroup()
ROOT GUI Window base class.
Definition TGWindow.h:23
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:139
TLine l
Definition textangle.C:4