Logo ROOT  
Reference Guide
TGButton.h
Go to the documentation of this file.
1// @(#)root/gui:$Id$
2// Author: Fons Rademakers 06/01/98
3
4/*************************************************************************
5 * Copyright (C) 1995-2021, 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_TGButton
13#define ROOT_TGButton
14
15
16//////////////////////////////////////////////////////////////////////////
17// //
18// TGButton, TGTextButton, TGPictureButton, TGCheckButton TGRadioButton //
19// and TGSplitButton //
20// //
21// This header defines all GUI button widgets. //
22// //
23// TGButton is a button abstract base class. It defines general button //
24// behaviour. //
25// //
26// Selecting a text or picture button will generate the event: //
27// kC_COMMAND, kCM_BUTTON, button id, user data. //
28// //
29// Selecting a check button will generate the event: //
30// kC_COMMAND, kCM_CHECKBUTTON, button id, user data. //
31// //
32// Selecting a radio button will generate the event: //
33// kC_COMMAND, kCM_RADIOBUTTON, button id, user data. //
34// //
35// If a command string has been specified (via SetCommand()) then this //
36// command string will be executed via the interpreter whenever a //
37// button is selected. A command string can contain the macros: //
38// $MSG -- kC_COMMAND, kCM[CHECK|RADIO]BUTTON packed message //
39// (use GET_MSG() and GET_SUBMSG() to unpack) //
40// $PARM1 -- button id //
41// $PARM2 -- user data pointer //
42// Before executing these macros are expanded into the respective //
43// Long_t's //
44// //
45//////////////////////////////////////////////////////////////////////////
46
47#include "TGFrame.h"
48#include "TGWidget.h"
49
50//--- Button states
51
57};
58
59
60class TGWidget;
61class TGHotString;
62class TGPicture;
63class TGToolTip;
64class TGButtonGroup;
65class TGPopupMenu;
66class TGTextLayout;
67
68class TGButton : public TGFrame, public TGWidget {
69
70friend class TGButtonGroup;
71
72protected:
73 UInt_t fTWidth; ///< button width
74 UInt_t fTHeight; ///< button height
75 EButtonState fState; ///< button state
76 Bool_t fStayDown; ///< true if button has to stay down
77 GContext_t fNormGC; ///< graphics context used for drawing button
78 void *fUserData; ///< pointer to user data structure
79 TGToolTip *fTip; ///< tool tip associated with button
80 TGButtonGroup *fGroup; ///< button group this button belongs to
81 Pixel_t fBgndColor; ///< actual background color
82 Pixel_t fHighColor; ///< highlight color
83 UInt_t fStyle; ///< button style (modern or classic)
84
85 virtual void SetToggleButton(Bool_t) { }
86 virtual void EmitSignals(Bool_t wasUp);
87
88 static const TGGC *fgDefaultGC;
89 static const TGGC *fgHibckgndGC;
90
91 static Window_t fgReleaseBtn; // the last released button
92
93private:
94 TGButton(const TGButton&) = delete;
95 TGButton& operator=(const TGButton&) = delete;
96
97public:
98 static const TGGC &GetDefaultGC();
99 static const TGGC &GetHibckgndGC();
100
101 TGButton(const TGWindow *p = nullptr, Int_t id = -1, GContext_t norm = GetDefaultGC()(),
103 virtual ~TGButton();
104
107 virtual void SetUserData(void *userData) { fUserData = userData; }
108 virtual void *GetUserData() const { return fUserData; }
109 virtual void SetToolTipText(const char *text, Long_t delayms = 400); //*MENU*
110 virtual TGToolTip *GetToolTip() const { return fTip; }
111 virtual void SetState(EButtonState state, Bool_t emit = kFALSE);
112 virtual EButtonState GetState() const { return fState; }
113 virtual void AllowStayDown(Bool_t a) { fStayDown = a; }
114 virtual void SetGroup(TGButtonGroup *gr);
115 TGButtonGroup *GetGroup() const { return fGroup; }
116
117 virtual Bool_t IsDown() const;// { return !(fOptions & kRaisedFrame); }
118 virtual void SetDown(Bool_t on = kTRUE, Bool_t emit = kFALSE);
119 virtual Bool_t IsOn() const { return IsDown(); }
120 virtual void SetOn(Bool_t on = kTRUE, Bool_t emit = kFALSE) { SetDown(on, emit); }
121 virtual Bool_t IsToggleButton() const { return kFALSE; }
122 virtual Bool_t IsExclusiveToggle() const { return kFALSE; }
123 virtual void Toggle(Bool_t emit = kFALSE) { SetDown(IsDown() ? kFALSE : kTRUE, emit); }
124 virtual void SetEnabled(Bool_t e = kTRUE); //*TOGGLE* *GETTER=IsEnabled
125 virtual UInt_t GetStyle() const { return fStyle; }
126 virtual void SetStyle(UInt_t newstyle);
127 virtual void SetStyle(const char *style);
128
129 virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
130
131 GContext_t GetNormGC() const { return fNormGC; }
132
133 virtual void Pressed() { Emit("Pressed()"); } // *SIGNAL*
134 virtual void Released() { Emit("Released()"); } // *SIGNAL*
135 virtual void Clicked() { Emit("Clicked()"); } // *SIGNAL*
136 virtual void Toggled(Bool_t on) { Emit("Toggled(Bool_t)", on); } // *SIGNAL*
137
138 ClassDef(TGButton,0) // Button widget abstract base class
139};
140
141
142class TGTextButton : public TGButton {
143
144protected:
145 TGHotString *fLabel; // button text
146 Int_t fMLeft; // margin left
147 Int_t fMRight; // margin right
148 Int_t fMTop; // margin top
149 Int_t fMBottom; // margin bottom
150 Int_t fTMode; // text justify mode
151 Int_t fWrapLength; // wrap length
152 Int_t fHKeycode; // hotkey
153 TGTextLayout *fTLayout; // text layout
154 FontStruct_t fFontStruct; // font to draw text
155 Bool_t fHasOwnFont; // kTRUE - font defined locally, kFALSE - globally
156 Bool_t fStateOn; // bit to save the state across disable/enable
157 Bool_t fPrevStateOn; // bit to save previos state On/Off
158
159 static const TGFont *fgDefaultFont;
160
161 void Init();
162 virtual void DoRedraw();
163
164private:
165 TGTextButton(const TGTextButton&) = delete;
167
168public:
170
171 TGTextButton(const TGWindow *p, TGHotString *s, Int_t id = -1,
172 GContext_t norm = GetDefaultGC()(),
175 TGTextButton(const TGWindow *p = 0, const char *s = 0, Int_t id = -1,
176 GContext_t norm = GetDefaultGC()(),
179 TGTextButton(const TGWindow *p, const char *s, const char *cmd,
180 Int_t id = -1, GContext_t norm = GetDefaultGC()(),
183
184 virtual ~TGTextButton();
185
186 virtual TGDimension GetDefaultSize() const;
187
188 virtual Bool_t HandleKey(Event_t *event);
189 const TGHotString *GetText() const { return fLabel; }
190 virtual const char *GetTitle() const { return fLabel->Data(); }
191 TString GetString() const { return TString(fLabel->GetString()); }
192 virtual void SetTextJustify(Int_t tmode);
193 Int_t GetTextJustify() const { return fTMode; }
194 virtual void SetText(TGHotString *new_label);
195 virtual void SetText(const TString &new_label);
196 virtual void SetTitle(const char *label) { SetText(label); }
197 virtual void SetFont(FontStruct_t font, Bool_t global = kFALSE);
198 virtual void SetFont(const char *fontName, Bool_t global = kFALSE);
199 virtual void SetTextColor(Pixel_t color, Bool_t global = kFALSE);
200 virtual void SetForegroundColor(Pixel_t fore) { SetTextColor(fore); }
201 Bool_t HasOwnFont() const;
202 void SetWrapLength(Int_t wl) { fWrapLength = wl; Layout(); }
203 Int_t GetWrapLength() const { return fWrapLength; }
204 void SetMargins(Int_t left=0, Int_t right=0, Int_t top=0, Int_t bottom=0)
205 { fMLeft = left; fMRight = right; fMTop = top; fMBottom = bottom; }
206
207 virtual void SetLeftMargin(Int_t val) { fMLeft = val; }
208 virtual void SetRightMargin(Int_t val) { fMRight = val; }
209 virtual void SetTopMargin(Int_t val) { fMTop = val; }
210 virtual void SetBottomMargin(Int_t val) { fMBottom = val; }
211
212 Int_t GetLeftMargin() const { return fMLeft; }
213 Int_t GetRightMargin() const { return fMRight; }
214 Int_t GetTopMargin() const { return fMTop; }
215 Int_t GetBottomMargin() const { return fMBottom; }
216
217 void ChangeText(const char *title) { SetTitle(title); } //*MENU*icon=bld_rename.png*
218
220
221 virtual void Layout();
222 virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
223
224 ClassDef(TGTextButton,0) // A text button widget
225};
226
227
228class TGPictureButton : public TGButton {
229
230protected:
231 const TGPicture *fPic; ///< picture to be put in button
232 const TGPicture *fPicD; ///< picture shown when button disabled
233 Bool_t fOwnDisabledPic; ///< kTRUE if disabled picture was autogenerated
234
235 virtual void DoRedraw();
236 virtual void CreateDisabledPicture();
237
238private:
241
242public:
243 TGPictureButton(const TGWindow *p, const TGPicture *pic, Int_t id = -1,
244 GContext_t norm = GetDefaultGC()(),
246 TGPictureButton(const TGWindow *p, const TGPicture *pic, const char *cmd,
247 Int_t id = -1, GContext_t norm = GetDefaultGC()(),
249 TGPictureButton(const TGWindow *p = nullptr, const char* pic = 0, Int_t id = -1,
250 GContext_t norm = GetDefaultGC()(),
252 virtual ~TGPictureButton();
253
254 virtual void SetPicture(const TGPicture *new_pic);
255 virtual void SetDisabledPicture(const TGPicture *pic);
256 const TGPicture *GetPicture() const { return fPic; };
257 const TGPicture *GetDisabledPicture() const { return fPicD; };
258 virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
259
260 ClassDef(TGPictureButton,0) // A picture button widget
261};
262
263
265
266private:
267
268 TGCheckButton(const TGCheckButton&) = delete;
270
271protected:
272 EButtonState fPrevState; ///< previous check button state
273 const TGPicture *fOn; ///< button ON picture
274 const TGPicture *fOff; ///< button OFF picture
275 const TGPicture *fDisOn; ///< button disabled and was ON picture
276 const TGPicture *fDisOff; ///< button disabled and was OFF picture
277
278
279 void Init();
280 void PSetState(EButtonState state, Bool_t emit);
281 virtual void DoRedraw();
282 virtual void EmitSignals(Bool_t wasUp = kTRUE);
283
284 static const TGFont *fgDefaultFont;
285 static const TGGC *fgDefaultGC;
286
287public:
289 static const TGGC &GetDefaultGC();
290
291 TGCheckButton(const TGWindow *p, TGHotString *s, Int_t id = -1,
292 GContext_t norm = GetDefaultGC()(),
294 UInt_t option = 0);
295 TGCheckButton(const TGWindow *p = 0, const char *s = 0, Int_t id = -1,
296 GContext_t norm = GetDefaultGC()(),
298 UInt_t option = 0);
299 TGCheckButton(const TGWindow *p, const char *s, const char *cmd, Int_t id = -1,
300 GContext_t norm = GetDefaultGC()(),
302 UInt_t option = 0);
303 virtual ~TGCheckButton();
304
305 virtual TGDimension GetDefaultSize() const;
306
308 virtual Bool_t HandleKey(Event_t *event);
310 virtual Bool_t IsToggleButton() const { return kTRUE; }
311 virtual Bool_t IsOn() const { return fState == kButtonDown; }
312 virtual Bool_t IsDown() const { return fState == kButtonDown; }
313 virtual Bool_t IsDisabledAndSelected() const { return ((fState == kButtonDisabled) && fStateOn); }
314 virtual void SetDisabledAndSelected(Bool_t);
315 virtual void SetState(EButtonState state, Bool_t emit = kFALSE);
316 virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
317
318 ClassDef(TGCheckButton,0) // A check button widget
319};
320
321
323
324private:
325 TGRadioButton(const TGRadioButton&) = delete;
327
328protected:
329 EButtonState fPrevState; ///< previous radio button state
330 const TGPicture *fOn; ///< button ON picture
331 const TGPicture *fOff; ///< button OFF picture
332 const TGPicture *fDisOn; ///< button disabled and was ON picture
333 const TGPicture *fDisOff; ///< button disabled and was OFF picture
334
335 void Init();
336 void PSetState(EButtonState state, Bool_t emit);
337 virtual void DoRedraw();
338 virtual void EmitSignals(Bool_t wasUp = kTRUE);
339
340 static const TGFont *fgDefaultFont;
341 static const TGGC *fgDefaultGC;
342
343public:
345 static const TGGC &GetDefaultGC();
346
347 TGRadioButton(const TGWindow *p, TGHotString *s, Int_t id = -1,
348 GContext_t norm = GetDefaultGC()(),
350 UInt_t option = 0);
351 TGRadioButton(const TGWindow *p = 0, const char *s = 0, Int_t id = -1,
352 GContext_t norm = GetDefaultGC()(),
354 UInt_t option = 0);
355 TGRadioButton(const TGWindow *p, const char *s, const char *cmd, Int_t id = -1,
356 GContext_t norm = GetDefaultGC()(),
358 UInt_t option = 0);
359 virtual ~TGRadioButton();
360
361 virtual TGDimension GetDefaultSize() const;
362
364 virtual Bool_t HandleKey(Event_t *event);
366 virtual void SetState(EButtonState state, Bool_t emit = kFALSE);
367 virtual void SetDisabledAndSelected(Bool_t);
368 virtual Bool_t IsToggleButton() const { return kTRUE; }
369 virtual Bool_t IsExclusiveToggle() const { return kTRUE; }
370 virtual Bool_t IsOn() const { return fStateOn; }
371 virtual Bool_t IsDown() const { return fStateOn; }
372 virtual Bool_t IsDisabledAndSelected() const { return ((fState == kButtonDisabled) && fStateOn); }
373 virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
374
375 ClassDef(TGRadioButton,0) // A radio button widget
376};
377
378
380
381friend class TGPopupMenu;
382
383private:
384 TGSplitButton(const TGSplitButton&) = delete;
386
387 void CalcSize();
388 void DrawTriangle(const GContext_t gc, Int_t x, Int_t y);
392 void SetMenuState(Bool_t state) ;
393
394protected:
395///@{
396/// @name Data members for menu functionality
397 Bool_t fSplit; ///< kTRUE if menu is in split mode
398 EButtonState fMBState; ///< state for menu button in split mode
399 UInt_t fTBWidth; ///< width of text button
400 UInt_t fMBWidth; ///< width of menu button
401 TGPopupMenu *fPopMenu; ///< pointer to popup menu
402 Int_t fEntryId; ///< Id of the currently active menu entry
403 TGHotString *fMenuLabel; ///< Label of the menu;
404 Cursor_t fDefaultCursor; ///< Default Cursor
405 Bool_t fKeyNavigate; ///< kTRUE if key navigation is being used
406 TGString fWidestLabel; ///< longest label that can be on the button
407 TGString fHeighestLabel; ///< highest label that can be on the button
408///@]
409
410 virtual void DoRedraw();
411 void Init();
412 void BindKeys(Bool_t on = kTRUE);
413 void BindMenuKeys(Bool_t on = kTRUE);
414
415public:
416 TGSplitButton(const TGWindow *p, TGHotString *menulabel,
417 TGPopupMenu *popmenu, Bool_t split = kTRUE,
418 Int_t id = -1, GContext_t norm = GetDefaultGC()(),
419 FontStruct_t fontstruct = GetDefaultFontStruct(),
421
422 virtual ~TGSplitButton();
423
424 virtual TGDimension GetDefaultSize() const ;
425
426 virtual void SetText(TGHotString *new_label);
427 virtual void SetText(const TString &new_label);
428 virtual void SetFont(FontStruct_t font, Bool_t global = kFALSE);
429 virtual void SetFont(const char *fontName, Bool_t global = kFALSE);
430 virtual void SetMBState(EButtonState state);
431 virtual void SetSplit(Bool_t split);
432 Bool_t IsSplit() { return fSplit; }
435 virtual Bool_t HandleKey(Event_t *event);
437 virtual void Layout();
438
439 virtual void MBPressed() { Emit("MBPressed()"); } // *SIGNAL*
440 virtual void MBReleased() { Emit("MBReleased()"); } // *SIGNAL*
441 virtual void MBClicked() { Emit("MBClicked()"); } // *SIGNAL*
442 virtual void ItemClicked(Int_t id) { Emit("ItemClicked(Int_t)", id); } // *SIGNAL*
443
444 // Slots
445 void HandleMenu(Int_t id) ;
446
447 ClassDef(TGSplitButton, 0) //a split button widget
448};
449
450#endif
Handle_t Cursor_t
Cursor handle.
Definition: GuiTypes.h:34
@ kRaisedFrame
Definition: GuiTypes.h:384
@ kDoubleBorder
Definition: GuiTypes.h:385
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
Handle_t Window_t
Window handle.
Definition: GuiTypes.h:29
#define e(i)
Definition: RSha256.hxx:103
int Int_t
Definition: RtypesCore.h:45
unsigned int UInt_t
Definition: RtypesCore.h:46
const Bool_t kFALSE
Definition: RtypesCore.h:101
long Long_t
Definition: RtypesCore.h:54
bool Bool_t
Definition: RtypesCore.h:63
const Bool_t kTRUE
Definition: RtypesCore.h:100
const char Option_t
Definition: RtypesCore.h:66
#define ClassDef(name, id)
Definition: Rtypes.h:325
EButtonState
Definition: TGButton.h:52
@ kButtonDown
Definition: TGButton.h:54
@ kButtonDisabled
Definition: TGButton.h:56
@ kButtonUp
Definition: TGButton.h:53
@ kButtonEngaged
Definition: TGButton.h:55
Organizes TGButton widgets in a group.
Definition: TGButtonGroup.h:21
A button abstract base class.
Definition: TGButton.h:68
virtual void SetGroup(TGButtonGroup *gr)
Sets new button-group for this button.
Definition: TGButton.cxx:322
GContext_t GetNormGC() const
Definition: TGButton.h:131
virtual void Pressed()
Definition: TGButton.h:133
static const TGGC & GetDefaultGC()
Return default graphics context.
Definition: TGButton.cxx:470
virtual void SetToolTipText(const char *text, Long_t delayms=400)
Set tool tip text associated with this button.
Definition: TGButton.cxx:445
virtual void SetUserData(void *userData)
Definition: TGButton.h:107
virtual EButtonState GetState() const
Definition: TGButton.h:112
TGButton & operator=(const TGButton &)=delete
UInt_t fStyle
button style (modern or classic)
Definition: TGButton.h:83
TGButtonGroup * fGroup
button group this button belongs to
Definition: TGButton.h:80
virtual void SetOn(Bool_t on=kTRUE, Bool_t emit=kFALSE)
Definition: TGButton.h:120
virtual Bool_t IsExclusiveToggle() const
Definition: TGButton.h:122
Pixel_t fBgndColor
actual background color
Definition: TGButton.h:81
static const TGGC & GetHibckgndGC()
Return graphics context for highlighted frame background.
Definition: TGButton.cxx:480
virtual void SetDown(Bool_t on=kTRUE, Bool_t emit=kFALSE)
Definition: TGButton.cxx:310
virtual UInt_t GetStyle() const
Definition: TGButton.h:125
virtual void * GetUserData() const
Definition: TGButton.h:108
static Window_t fgReleaseBtn
Definition: TGButton.h:91
Pixel_t fHighColor
highlight color
Definition: TGButton.h:82
virtual void Released()
Definition: TGButton.h:134
virtual void AllowStayDown(Bool_t a)
Definition: TGButton.h:113
virtual void EmitSignals(Bool_t wasUp)
Emit button signals.
Definition: TGButton.cxx:385
UInt_t fTWidth
button width
Definition: TGButton.h:73
virtual void Toggle(Bool_t emit=kFALSE)
Definition: TGButton.h:123
UInt_t fTHeight
button height
Definition: TGButton.h:74
virtual void SetStyle(UInt_t newstyle)
Set the button style (modern or classic).
Definition: TGButton.cxx:271
void * fUserData
pointer to user data structure
Definition: TGButton.h:78
virtual TGToolTip * GetToolTip() const
Definition: TGButton.h:110
static const TGGC * fgHibckgndGC
Definition: TGButton.h:89
TGButtonGroup * GetGroup() const
Definition: TGButton.h:115
virtual ~TGButton()
Delete button.
Definition: TGButton.cxx:221
virtual Bool_t HandleCrossing(Event_t *event)
Handle mouse crossing event.
Definition: TGButton.cxx:404
virtual Bool_t IsToggleButton() const
Definition: TGButton.h:121
virtual Bool_t IsOn() const
Definition: TGButton.h:119
virtual void Clicked()
Definition: TGButton.h:135
TGButton(const TGButton &)=delete
EButtonState fState
button state
Definition: TGButton.h:75
virtual void SetEnabled(Bool_t e=kTRUE)
Set enabled or disabled state of button.
Definition: TGButton.cxx:459
static const TGGC * fgDefaultGC
Definition: TGButton.h:88
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set button state.
Definition: TGButton.cxx:235
TGToolTip * fTip
tool tip associated with button
Definition: TGButton.h:79
virtual void Toggled(Bool_t on)
Definition: TGButton.h:136
virtual void SetToggleButton(Bool_t)
Definition: TGButton.h:85
virtual Bool_t IsDown() const
Definition: TGButton.cxx:301
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event.
Definition: TGButton.cxx:330
Bool_t fStayDown
true if button has to stay down
Definition: TGButton.h:76
GContext_t fNormGC
graphics context used for drawing button
Definition: TGButton.h:77
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a button widget as a C++ statement(s) on output stream out.
Definition: TGButton.cxx:1879
Selects different options.
Definition: TGButton.h:264
const TGPicture * fOff
button OFF picture
Definition: TGButton.h:274
virtual ~TGCheckButton()
Delete a check button.
Definition: TGButton.cxx:1225
virtual void EmitSignals(Bool_t wasUp=kTRUE)
Emit signals.
Definition: TGButton.cxx:1262
static const TGFont * fgDefaultFont
Definition: TGButton.h:284
static const TGGC * fgDefaultGC
Definition: TGButton.h:285
virtual Bool_t IsOn() const
Definition: TGButton.h:311
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event.
Definition: TGButton.cxx:1330
const TGPicture * fOn
button ON picture
Definition: TGButton.h:273
void Init()
Common check button initialization.
Definition: TGButton.cxx:1179
virtual void DoRedraw()
Draw the check button widget.
Definition: TGButton.cxx:1437
static const TGGC & GetDefaultGC()
Return default graphics context.
Definition: TGButton.cxx:1503
static FontStruct_t GetDefaultFontStruct()
Return default font structure.
Definition: TGButton.cxx:1493
virtual void SetDisabledAndSelected(Bool_t)
Set the state of a check button to disabled and either on or off.
Definition: TGButton.cxx:1310
virtual Bool_t IsDisabledAndSelected() const
Definition: TGButton.h:313
TGCheckButton & operator=(const TGCheckButton &)=delete
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set check button state.
Definition: TGButton.cxx:1250
TGCheckButton(const TGCheckButton &)=delete
virtual Bool_t HandleKey(Event_t *event)
Handle key event. This function will be called when the hotkey is hit.
Definition: TGButton.cxx:1403
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a check button widget as a C++ statement(s) on output stream out.
Definition: TGButton.cxx:2034
virtual Bool_t IsToggleButton() const
Definition: TGButton.h:310
EButtonState fPrevState
previous check button state
Definition: TGButton.h:272
const TGPicture * fDisOff
button disabled and was OFF picture
Definition: TGButton.h:276
virtual TGDimension GetDefaultSize() const
default size
Definition: TGButton.cxx:1236
const TGPicture * fDisOn
button disabled and was ON picture
Definition: TGButton.h:275
virtual Bool_t HandleCrossing(Event_t *event)
Handle mouse crossing event.
Definition: TGButton.cxx:1374
void PSetState(EButtonState state, Bool_t emit)
Set check button state.
Definition: TGButton.cxx:1273
virtual Bool_t IsDown() const
Definition: TGButton.h:312
Encapsulate fonts used in the GUI system.
Definition: TGFont.h:140
A subclasses of TGWindow, and is used as base class for some simple widgets (buttons,...
Definition: TGFrame.h:80
Encapsulate a graphics context used in the low level graphics.
Definition: TGGC.h:22
TGHotString is a string with a "hot" character underlined.
Definition: TGString.h:42
Yield an action as soon as it is clicked.
Definition: TGButton.h:228
virtual void SetPicture(const TGPicture *new_pic)
Change a picture in a picture button.
Definition: TGButton.cxx:1040
virtual void CreateDisabledPicture()
Creates disabled picture.
Definition: TGButton.cxx:1108
const TGPicture * GetDisabledPicture() const
Definition: TGButton.h:257
virtual void SetDisabledPicture(const TGPicture *pic)
Changes disabled picture.
Definition: TGButton.cxx:1135
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a picture button widget as a C++ statement(s) on output stream out.
Definition: TGButton.cxx:1983
const TGPicture * GetPicture() const
Definition: TGButton.h:256
TGPictureButton & operator=(const TGPictureButton &)=delete
const TGPicture * fPicD
picture shown when button disabled
Definition: TGButton.h:232
const TGPicture * fPic
picture to be put in button
Definition: TGButton.h:231
virtual ~TGPictureButton()
Destructor.
Definition: TGButton.cxx:1030
TGPictureButton(const TGPictureButton &)=delete
Bool_t fOwnDisabledPic
kTRUE if disabled picture was autogenerated
Definition: TGButton.h:233
virtual void DoRedraw()
Redraw picture button.
Definition: TGButton.cxx:1064
The TGPicture class implements pictures and icons used in the different GUI elements and widgets.
Definition: TGPicture.h:25
This class creates a popup menu object.
Definition: TGMenu.h:110
Selects different options.
Definition: TGButton.h:322
const TGPicture * fOn
button ON picture
Definition: TGButton.h:330
static FontStruct_t GetDefaultFontStruct()
Return default font structure.
Definition: TGButton.cxx:1859
static const TGGC * fgDefaultGC
Definition: TGButton.h:341
virtual Bool_t IsExclusiveToggle() const
Definition: TGButton.h:369
virtual Bool_t IsOn() const
Definition: TGButton.h:370
const TGPicture * fDisOn
button disabled and was ON picture
Definition: TGButton.h:332
virtual void DoRedraw()
Draw a radio button.
Definition: TGButton.cxx:1802
virtual Bool_t HandleKey(Event_t *event)
Handle key event. This function will be called when the hotkey is hit.
Definition: TGButton.cxx:1772
virtual ~TGRadioButton()
Delete a radio button.
Definition: TGButton.cxx:1589
virtual Bool_t HandleCrossing(Event_t *event)
Handle mouse crossing event.
Definition: TGButton.cxx:1743
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event.
Definition: TGButton.cxx:1694
EButtonState fPrevState
previous radio button state
Definition: TGButton.h:329
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set radio button state.
Definition: TGButton.cxx:1613
static const TGGC & GetDefaultGC()
Return default graphics context.
Definition: TGButton.cxx:1869
const TGPicture * fDisOff
button disabled and was OFF picture
Definition: TGButton.h:333
virtual TGDimension GetDefaultSize() const
default size
Definition: TGButton.cxx:1600
virtual Bool_t IsDown() const
Definition: TGButton.h:371
static const TGFont * fgDefaultFont
Definition: TGButton.h:340
virtual Bool_t IsDisabledAndSelected() const
Definition: TGButton.h:372
virtual Bool_t IsToggleButton() const
Definition: TGButton.h:368
virtual void SetDisabledAndSelected(Bool_t)
Set the state of a radio button to disabled and either on or off.
Definition: TGButton.cxx:1626
TGRadioButton & operator=(const TGRadioButton &)=delete
const TGPicture * fOff
button OFF picture
Definition: TGButton.h:331
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a radio button widget as a C++ statement(s) on output stream out.
Definition: TGButton.cxx:2102
void PSetState(EButtonState state, Bool_t emit)
Set radio button state.
Definition: TGButton.cxx:1657
void Init()
Common radio button initialization.
Definition: TGButton.cxx:1545
virtual void EmitSignals(Bool_t wasUp=kTRUE)
Emit signals.
Definition: TGButton.cxx:1646
TGRadioButton(const TGRadioButton &)=delete
Implements a button with added menu functionality.
Definition: TGButton.h:379
void CalcSize()
Calculate the size of the button.
Definition: TGButton.cxx:2337
virtual Bool_t HandleKey(Event_t *event)
Handle key event. This function will be called when the hotkey is hit.
Definition: TGButton.cxx:3024
virtual void ItemClicked(Int_t id)
Definition: TGButton.h:442
Bool_t HandleSKey(Event_t *event)
Handle key event. This function will be called when the hotkey is hit.
Definition: TGButton.cxx:2525
TGPopupMenu * fPopMenu
pointer to popup menu
Definition: TGButton.h:401
virtual void Layout()
layout text button
Definition: TGButton.cxx:3182
void DrawTriangle(const GContext_t gc, Int_t x, Int_t y)
Draw triangle (arrow) on which user can click to open Popup.
Definition: TGButton.cxx:2320
Int_t fEntryId
Id of the currently active menu entry.
Definition: TGButton.h:402
Bool_t fSplit
kTRUE if menu is in split mode
Definition: TGButton.h:397
virtual void MBClicked()
Definition: TGButton.h:441
EButtonState fMBState
state for menu button in split mode
Definition: TGButton.h:398
TGSplitButton(const TGSplitButton &)=delete
void Init()
Common initialization used by the different ctors.
Definition: TGButton.cxx:2267
virtual Bool_t HandleButton(Event_t *event)
Handle button events.
Definition: TGButton.cxx:2932
virtual Bool_t HandleCrossing(Event_t *event)
Handle mouse crossing event.
Definition: TGButton.cxx:3012
virtual Bool_t HandleMotion(Event_t *event)
Handle a motion event in a TGSplitButton.
Definition: TGButton.cxx:3158
Bool_t IsSplit()
Definition: TGButton.h:432
Bool_t HandleSButton(Event_t *event)
Handle mouse button event in case the button is split.
Definition: TGButton.cxx:2352
void BindKeys(Bool_t on=kTRUE)
If on kTRUE bind arrow, popup menu hot keys, otherwise remove key bindings.
Definition: TGButton.cxx:2720
Cursor_t fDefaultCursor
Default Cursor.
Definition: TGButton.h:404
virtual void SetText(TGHotString *new_label)
Set new button text.
Definition: TGButton.cxx:2767
void SetMenuState(Bool_t state)
Popup the attached menu.
Definition: TGButton.cxx:2573
UInt_t fMBWidth
width of menu button
Definition: TGButton.h:400
Bool_t HandleSCrossing(Event_t *event)
Handle mouse crossing event in case of split menu.
Definition: TGButton.cxx:2483
void BindMenuKeys(Bool_t on=kTRUE)
If on kTRUE bind Menu hot keys, otherwise remove key bindings.
Definition: TGButton.cxx:2732
virtual ~TGSplitButton()
Delete a split button widget.
Definition: TGButton.cxx:2311
virtual void MBReleased()
Definition: TGButton.h:440
TGHotString * fMenuLabel
Label of the menu;.
Definition: TGButton.h:403
void HandleMenu(Int_t id)
Handle a menu item activation.
Definition: TGButton.cxx:3214
virtual void SetFont(FontStruct_t font, Bool_t global=kFALSE)
Changes text font.
Definition: TGButton.cxx:2846
virtual TGDimension GetDefaultSize() const
returns default size
Definition: TGButton.cxx:2757
TGSplitButton & operator=(const TGSplitButton &)=delete
TGString fHeighestLabel
highest label that can be on the button
Definition: TGButton.h:407
UInt_t fTBWidth
width of text button
Definition: TGButton.h:399
virtual void MBPressed()
Definition: TGButton.h:439
virtual void SetMBState(EButtonState state)
Set the state of the Menu Button part.
Definition: TGButton.cxx:2883
Bool_t fKeyNavigate
kTRUE if key navigation is being used
Definition: TGButton.h:405
virtual void SetSplit(Bool_t split)
Set the split status of a button.
Definition: TGButton.cxx:2894
TGString fWidestLabel
longest label that can be on the button
Definition: TGButton.h:406
virtual void DoRedraw()
@]
Definition: TGButton.cxx:2614
TGString wraps a TString and adds some graphics routines like drawing, size of string on screen depen...
Definition: TGString.h:20
const char * GetString() const
Definition: TGString.h:30
Yield an action as soon as it is clicked.
Definition: TGButton.h:142
void Init()
Common initialization used by the different ctors.
Definition: TGButton.cxx:541
Int_t GetWrapLength() const
Definition: TGButton.h:203
const TGHotString * GetText() const
Definition: TGButton.h:189
Int_t GetLeftMargin() const
Definition: TGButton.h:212
Int_t GetRightMargin() const
Definition: TGButton.h:213
virtual const char * GetTitle() const
Returns title of object.
Definition: TGButton.h:190
virtual void Layout()
layout text button
Definition: TGButton.cxx:624
virtual Bool_t HandleKey(Event_t *event)
Handle key event. This function will be called when the hotkey is hit.
Definition: TGButton.cxx:815
static FontStruct_t GetDefaultFontStruct()
Return default font structure.
Definition: TGButton.cxx:869
virtual void SetTopMargin(Int_t val)
Definition: TGButton.h:209
Int_t GetTopMargin() const
Definition: TGButton.h:214
virtual void SetLeftMargin(Int_t val)
Definition: TGButton.h:207
virtual void SetTitle(const char *label)
Definition: TGButton.h:196
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a text button widget as a C++ statement(s) on output stream out.
Definition: TGButton.cxx:1916
Int_t fMTop
Definition: TGButton.h:148
FontStruct_t GetFontStruct() const
Definition: TGButton.h:219
Int_t fMBottom
Definition: TGButton.h:149
virtual void SetTextJustify(Int_t tmode)
Set text justification.
Definition: TGButton.cxx:695
virtual void SetForegroundColor(Pixel_t fore)
Definition: TGButton.h:200
virtual void SetBottomMargin(Int_t val)
Definition: TGButton.h:210
Bool_t fHasOwnFont
Definition: TGButton.h:155
Bool_t fStateOn
Definition: TGButton.h:156
virtual void SetRightMargin(Int_t val)
Definition: TGButton.h:208
Int_t fHKeycode
Definition: TGButton.h:152
virtual void SetText(TGHotString *new_label)
Set new button text.
Definition: TGButton.cxx:644
TGTextButton(const TGTextButton &)=delete
Int_t GetBottomMargin() const
Definition: TGButton.h:215
static const TGFont * fgDefaultFont
Definition: TGButton.h:159
Int_t GetTextJustify() const
Definition: TGButton.h:193
Int_t fMRight
Definition: TGButton.h:147
void ChangeText(const char *title)
Definition: TGButton.h:217
virtual ~TGTextButton()
Delete a text button widget.
Definition: TGButton.cxx:595
TGHotString * fLabel
Definition: TGButton.h:145
TGTextButton & operator=(const TGTextButton &)=delete
Bool_t HasOwnFont() const
Returns kTRUE if text attributes are unique, returns kFALSE if text attributes are shared (global).
Definition: TGButton.cxx:938
virtual void DoRedraw()
Draw the text button.
Definition: TGButton.cxx:747
Bool_t fPrevStateOn
Definition: TGButton.h:157
void SetWrapLength(Int_t wl)
Definition: TGButton.h:202
virtual void SetFont(FontStruct_t font, Bool_t global=kFALSE)
Changes text font.
Definition: TGButton.cxx:880
virtual TGDimension GetDefaultSize() const
returns default size
Definition: TGButton.cxx:859
Int_t fTMode
Definition: TGButton.h:150
Int_t fWrapLength
Definition: TGButton.h:151
TGTextLayout * fTLayout
Definition: TGButton.h:153
TString GetString() const
Definition: TGButton.h:191
void SetMargins(Int_t left=0, Int_t right=0, Int_t top=0, Int_t bottom=0)
Definition: TGButton.h:204
FontStruct_t fFontStruct
Definition: TGButton.h:154
virtual void SetTextColor(Pixel_t color, Bool_t global=kFALSE)
Changes text color.
Definition: TGButton.cxx:918
Int_t fMLeft
Definition: TGButton.h:146
Is used to keep track of string measurement information when using the text layout facilities.
Definition: TGFont.h:106
The widget base class.
Definition: TGWidget.h:43
ROOT GUI Window base class.
Definition: TGWindow.h:23
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition: TQObject.h:164
Basic string class.
Definition: TString.h:136
const char * Data() const
Definition: TString.h:369
TText * text
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17
TGraphErrors * gr
Definition: legend1.C:25
static constexpr double s
Event structure.
Definition: GuiTypes.h:174
TCanvas * style()
Definition: style.C:1
auto * a
Definition: textangle.C:12