Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 ~TGButton() override;
104
105 Bool_t HandleButton(Event_t *event) override;
106 Bool_t HandleCrossing(Event_t *event) override;
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 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
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 ClassDefOverride(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 previous state On/Off
158
159 static const TGFont *fgDefaultFont;
160
161 void Init();
162 void DoRedraw() override;
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 = nullptr, const char *s = nullptr, 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 ~TGTextButton() override;
185
186 TGDimension GetDefaultSize() const override;
187
188 Bool_t HandleKey(Event_t *event) override;
189 const TGHotString *GetText() const { return fLabel; }
190 const char *GetTitle() const override { 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 void SetForegroundColor(Pixel_t fore) override { 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 void Layout() override;
222 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
223
224 ClassDefOverride(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 void DoRedraw() override;
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 = nullptr, Int_t id = -1,
250 GContext_t norm = GetDefaultGC()(),
252 ~TGPictureButton() override;
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 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
259
260 ClassDefOverride(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 void Init();
279 void PSetState(EButtonState state, Bool_t emit);
280 void DoRedraw() override;
281 void EmitSignals(Bool_t wasUp = kTRUE) override;
282
283 static const TGFont *fgDefaultFont;
284 static const TGGC *fgDefaultGC;
285
286public:
288 static const TGGC &GetDefaultGC();
289
290 TGCheckButton(const TGWindow *p, TGHotString *s, Int_t id = -1,
291 GContext_t norm = GetDefaultGC()(),
293 UInt_t option = 0);
294 TGCheckButton(const TGWindow *p = nullptr, const char *s = nullptr, Int_t id = -1,
295 GContext_t norm = GetDefaultGC()(),
297 UInt_t option = 0);
298 TGCheckButton(const TGWindow *p, const char *s, const char *cmd, Int_t id = -1,
299 GContext_t norm = GetDefaultGC()(),
301 UInt_t option = 0);
302 ~TGCheckButton() override;
303
304 TGDimension GetDefaultSize() const override;
305
306 Bool_t HandleButton(Event_t *event) override;
307 Bool_t HandleKey(Event_t *event) override;
308 Bool_t HandleCrossing(Event_t *event) override;
309 Bool_t IsToggleButton() const override { return kTRUE; }
310 Bool_t IsOn() const override { return fState == kButtonDown; }
311 Bool_t IsDown() const override { return fState == kButtonDown; }
312 virtual Bool_t IsDisabledAndSelected() const { return ((fState == kButtonDisabled) && fStateOn); }
313 virtual void SetDisabledAndSelected(Bool_t);
314 void SetState(EButtonState state, Bool_t emit = kFALSE) override;
315 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
316
317 ClassDefOverride(TGCheckButton,0) // A check button widget
318};
319
320
322
323private:
324 TGRadioButton(const TGRadioButton&) = delete;
326
327protected:
328 EButtonState fPrevState; ///< previous radio button state
329 const TGPicture *fOn; ///< button ON picture
330 const TGPicture *fOff; ///< button OFF picture
331 const TGPicture *fDisOn; ///< button disabled and was ON picture
332 const TGPicture *fDisOff; ///< button disabled and was OFF picture
333
334 void Init();
335 void PSetState(EButtonState state, Bool_t emit);
336 void DoRedraw() override;
337 void EmitSignals(Bool_t wasUp = kTRUE) override;
338
339 static const TGFont *fgDefaultFont;
340 static const TGGC *fgDefaultGC;
341
342public:
344 static const TGGC &GetDefaultGC();
345
346 TGRadioButton(const TGWindow *p, TGHotString *s, Int_t id = -1,
347 GContext_t norm = GetDefaultGC()(),
349 UInt_t option = 0);
350 TGRadioButton(const TGWindow *p = nullptr, const char *s = nullptr, Int_t id = -1,
351 GContext_t norm = GetDefaultGC()(),
353 UInt_t option = 0);
354 TGRadioButton(const TGWindow *p, const char *s, const char *cmd, Int_t id = -1,
355 GContext_t norm = GetDefaultGC()(),
357 UInt_t option = 0);
358 ~TGRadioButton() override;
359
360 TGDimension GetDefaultSize() const override;
361
362 Bool_t HandleButton(Event_t *event) override;
363 Bool_t HandleKey(Event_t *event) override;
364 Bool_t HandleCrossing(Event_t *event) override;
365 void SetState(EButtonState state, Bool_t emit = kFALSE) override;
366 virtual void SetDisabledAndSelected(Bool_t);
367 Bool_t IsToggleButton() const override { return kTRUE; }
368 Bool_t IsExclusiveToggle() const override { return kTRUE; }
369 Bool_t IsOn() const override { return fStateOn; }
370 Bool_t IsDown() const override { return fStateOn; }
371 virtual Bool_t IsDisabledAndSelected() const { return ((fState == kButtonDisabled) && fStateOn); }
372 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
373
374 ClassDefOverride(TGRadioButton,0) // A radio button widget
375};
376
377
379
380friend class TGPopupMenu;
381
382private:
383 TGSplitButton(const TGSplitButton&) = delete;
385
386 void CalcSize();
387 void DrawTriangle(const GContext_t gc, Int_t x, Int_t y);
390 Bool_t HandleSKey(Event_t *event);
391 void SetMenuState(Bool_t state) ;
392
393protected:
394///@{
395/// @name Data members for menu functionality
396 Bool_t fSplit; ///< kTRUE if menu is in split mode
397 EButtonState fMBState; ///< state for menu button in split mode
398 UInt_t fTBWidth; ///< width of text button
399 UInt_t fMBWidth; ///< width of menu button
400 TGPopupMenu *fPopMenu; ///< pointer to popup menu
401 Int_t fEntryId; ///< Id of the currently active menu entry
402 TGHotString *fMenuLabel; ///< Label of the menu;
403 Cursor_t fDefaultCursor; ///< Default Cursor
404 Bool_t fKeyNavigate; ///< kTRUE if key navigation is being used
405 TGString fWidestLabel; ///< longest label that can be on the button
406 TGString fHeighestLabel; ///< highest label that can be on the button
407///@]
408
409 void DoRedraw() override;
410 void Init();
411 void BindKeys(Bool_t on = kTRUE);
412 void BindMenuKeys(Bool_t on = kTRUE);
413
414public:
415 TGSplitButton(const TGWindow *p, TGHotString *menulabel,
416 TGPopupMenu *popmenu, Bool_t split = kTRUE,
417 Int_t id = -1, GContext_t norm = GetDefaultGC()(),
418 FontStruct_t fontstruct = GetDefaultFontStruct(),
420
421 ~TGSplitButton() override;
422
423 TGDimension GetDefaultSize() const override;
424
425 void SetText(TGHotString *new_label) override;
426 void SetText(const TString &new_label) override;
427 void SetFont(FontStruct_t font, Bool_t global = kFALSE) override;
428 void SetFont(const char *fontName, Bool_t global = kFALSE) override;
429 virtual void SetMBState(EButtonState state);
430 virtual void SetSplit(Bool_t split);
431 Bool_t IsSplit() { return fSplit; }
432 Bool_t HandleButton(Event_t *event) override;
433 Bool_t HandleCrossing(Event_t *event) override;
434 Bool_t HandleKey(Event_t *event) override;
435 Bool_t HandleMotion(Event_t *event) override;
436 void Layout() override;
437
438 virtual void MBPressed() { Emit("MBPressed()"); } // *SIGNAL*
439 virtual void MBReleased() { Emit("MBReleased()"); } // *SIGNAL*
440 virtual void MBClicked() { Emit("MBClicked()"); } // *SIGNAL*
441 virtual void ItemClicked(Int_t id) { Emit("ItemClicked(Int_t)", id); } // *SIGNAL*
442
443 // Slots
444 void HandleMenu(Int_t id);
445
446 ClassDefOverride(TGSplitButton,0) //a split button widget
447};
448
449#endif
Handle_t Window_t
Window handle.
Definition GuiTypes.h:29
Handle_t GContext_t
Graphics context handle.
Definition GuiTypes.h:38
@ kRaisedFrame
Definition GuiTypes.h:384
@ kDoubleBorder
Definition GuiTypes.h:385
Handle_t Cursor_t
Cursor handle.
Definition GuiTypes.h:34
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
Handle_t FontStruct_t
Pointer to font structure.
Definition GuiTypes.h:39
#define a(i)
Definition RSha256.hxx:99
#define e(i)
Definition RSha256.hxx:103
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
long Long_t
Definition RtypesCore.h:54
unsigned int UInt_t
Definition RtypesCore.h:46
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
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
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
Option_t Option_t style
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void gc
Option_t Option_t TPoint TPoint const char text
Organizes TGButton widgets in a group.
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
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a button widget as a C++ statement(s) on output stream out.
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
Bool_t HandleButton(Event_t *event) override
Handle mouse button event.
Definition TGButton.cxx:330
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 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
~TGButton() override
Delete button.
Definition TGButton.cxx:221
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
Bool_t HandleCrossing(Event_t *event) override
Handle mouse crossing event.
Definition TGButton.cxx:404
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
Selects different options.
Definition TGButton.h:264
const TGPicture * fOff
button OFF picture
Definition TGButton.h:274
static const TGFont * fgDefaultFont
Definition TGButton.h:283
static const TGGC * fgDefaultGC
Definition TGButton.h:284
Bool_t HandleKey(Event_t *event) override
Handle key event. This function will be called when the hotkey is hit.
const TGPicture * fOn
button ON picture
Definition TGButton.h:273
void Init()
Common check button initialization.
Bool_t HandleButton(Event_t *event) override
Handle mouse button event.
static const TGGC & GetDefaultGC()
Return default graphics context.
static FontStruct_t GetDefaultFontStruct()
Return default font structure.
virtual void SetDisabledAndSelected(Bool_t)
Set the state of a check button to disabled and either on or off.
Bool_t IsDown() const override
Definition TGButton.h:311
virtual Bool_t IsDisabledAndSelected() const
Definition TGButton.h:312
TGCheckButton & operator=(const TGCheckButton &)=delete
Bool_t HandleCrossing(Event_t *event) override
Handle mouse crossing event.
Bool_t IsOn() const override
Definition TGButton.h:310
~TGCheckButton() override
Delete a check button.
Bool_t IsToggleButton() const override
Definition TGButton.h:309
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a check button widget as a C++ statement(s) on output stream out.
TGCheckButton(const TGCheckButton &)=delete
void EmitSignals(Bool_t wasUp=kTRUE) override
Emit signals.
void SetState(EButtonState state, Bool_t emit=kFALSE) override
Set check button state.
EButtonState fPrevState
previous check button state
Definition TGButton.h:272
void DoRedraw() override
Draw the check button widget.
const TGPicture * fDisOff
button disabled and was OFF picture
Definition TGButton.h:276
const TGPicture * fDisOn
button disabled and was ON picture
Definition TGButton.h:275
TGDimension GetDefaultSize() const override
default size
void PSetState(EButtonState state, Bool_t emit)
Set check button state.
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.
virtual void CreateDisabledPicture()
Creates disabled picture.
const TGPicture * GetDisabledPicture() const
Definition TGButton.h:257
virtual void SetDisabledPicture(const TGPicture *pic)
Changes disabled picture.
const TGPicture * GetPicture() const
Definition TGButton.h:256
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a picture button widget as a C++ statement(s) on output stream out.
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
~TGPictureButton() override
Destructor.
TGPictureButton(const TGPictureButton &)=delete
void DoRedraw() override
Redraw picture button.
Bool_t fOwnDisabledPic
kTRUE if disabled picture was autogenerated
Definition TGButton.h:233
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:321
const TGPicture * fOn
button ON picture
Definition TGButton.h:329
static FontStruct_t GetDefaultFontStruct()
Return default font structure.
static const TGGC * fgDefaultGC
Definition TGButton.h:340
void SetState(EButtonState state, Bool_t emit=kFALSE) override
Set radio button state.
Bool_t IsExclusiveToggle() const override
Definition TGButton.h:368
void DoRedraw() override
Draw a radio button.
const TGPicture * fDisOn
button disabled and was ON picture
Definition TGButton.h:331
Bool_t HandleButton(Event_t *event) override
Handle mouse button event.
EButtonState fPrevState
previous radio button state
Definition TGButton.h:328
void EmitSignals(Bool_t wasUp=kTRUE) override
Emit signals.
static const TGGC & GetDefaultGC()
Return default graphics context.
const TGPicture * fDisOff
button disabled and was OFF picture
Definition TGButton.h:332
Bool_t IsOn() const override
Definition TGButton.h:369
static const TGFont * fgDefaultFont
Definition TGButton.h:339
Bool_t HandleCrossing(Event_t *event) override
Handle mouse crossing event.
virtual Bool_t IsDisabledAndSelected() const
Definition TGButton.h:371
Bool_t IsDown() const override
Definition TGButton.h:370
virtual void SetDisabledAndSelected(Bool_t)
Set the state of a radio button to disabled and either on or off.
TGRadioButton & operator=(const TGRadioButton &)=delete
const TGPicture * fOff
button OFF picture
Definition TGButton.h:330
~TGRadioButton() override
Delete a radio button.
void PSetState(EButtonState state, Bool_t emit)
Set radio button state.
void Init()
Common radio button initialization.
Bool_t IsToggleButton() const override
Definition TGButton.h:367
Bool_t HandleKey(Event_t *event) override
Handle key event. This function will be called when the hotkey is hit.
TGDimension GetDefaultSize() const override
default size
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a radio button widget as a C++ statement(s) on output stream out.
TGRadioButton(const TGRadioButton &)=delete
Implements a button with added menu functionality.
Definition TGButton.h:378
void CalcSize()
Calculate the size of the button.
virtual void ItemClicked(Int_t id)
Definition TGButton.h:441
Bool_t HandleSKey(Event_t *event)
Handle key event. This function will be called when the hotkey is hit.
Bool_t HandleMotion(Event_t *event) override
Handle a motion event in a TGSplitButton.
~TGSplitButton() override
Delete a split button widget.
TGPopupMenu * fPopMenu
pointer to popup menu
Definition TGButton.h:400
void DrawTriangle(const GContext_t gc, Int_t x, Int_t y)
Draw triangle (arrow) on which user can click to open Popup.
void Layout() override
layout text button
Int_t fEntryId
Id of the currently active menu entry.
Definition TGButton.h:401
Bool_t HandleButton(Event_t *event) override
Handle button events.
Bool_t fSplit
kTRUE if menu is in split mode
Definition TGButton.h:396
virtual void MBClicked()
Definition TGButton.h:440
EButtonState fMBState
state for menu button in split mode
Definition TGButton.h:397
TGSplitButton(const TGSplitButton &)=delete
void Init()
Common initialization used by the different ctors.
Bool_t IsSplit()
Definition TGButton.h:431
Bool_t HandleSButton(Event_t *event)
Handle mouse button event in case the button is split.
void BindKeys(Bool_t on=kTRUE)
If on kTRUE bind arrow, popup menu hot keys, otherwise remove key bindings.
Cursor_t fDefaultCursor
Default Cursor.
Definition TGButton.h:403
void SetMenuState(Bool_t state)
Popup the attached menu.
UInt_t fMBWidth
width of menu button
Definition TGButton.h:399
TGDimension GetDefaultSize() const override
returns default size
Bool_t HandleCrossing(Event_t *event) override
Handle mouse crossing event.
Bool_t HandleSCrossing(Event_t *event)
Handle mouse crossing event in case of split menu.
void BindMenuKeys(Bool_t on=kTRUE)
If on kTRUE bind Menu hot keys, otherwise remove key bindings.
void SetFont(FontStruct_t font, Bool_t global=kFALSE) override
Changes text font.
Bool_t HandleKey(Event_t *event) override
Handle key event. This function will be called when the hotkey is hit.
virtual void MBReleased()
Definition TGButton.h:439
TGHotString * fMenuLabel
Label of the menu;.
Definition TGButton.h:402
void HandleMenu(Int_t id)
Handle a menu item activation.
void DoRedraw() override
@]
TGSplitButton & operator=(const TGSplitButton &)=delete
TGString fHeighestLabel
highest label that can be on the button
Definition TGButton.h:406
UInt_t fTBWidth
width of text button
Definition TGButton.h:398
virtual void MBPressed()
Definition TGButton.h:438
virtual void SetMBState(EButtonState state)
Set the state of the Menu Button part.
Bool_t fKeyNavigate
kTRUE if key navigation is being used
Definition TGButton.h:404
virtual void SetSplit(Bool_t split)
Set the split status of a button.
TGString fWidestLabel
longest label that can be on the button
Definition TGButton.h:405
void SetText(TGHotString *new_label) override
Set new button text.
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
static FontStruct_t GetDefaultFontStruct()
Return default font structure.
Definition TGButton.cxx:869
void Layout() override
layout text button
Definition TGButton.cxx:624
virtual void SetTopMargin(Int_t val)
Definition TGButton.h:209
Bool_t HandleKey(Event_t *event) override
Handle key event. This function will be called when the hotkey is hit.
Definition TGButton.cxx:815
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
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 SetBottomMargin(Int_t val)
Definition TGButton.h:210
Bool_t fHasOwnFont
Definition TGButton.h:155
Bool_t fStateOn
Definition TGButton.h:156
const char * GetTitle() const override
Returns title of object.
Definition TGButton.h:190
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
TGDimension GetDefaultSize() const override
returns default size
Definition TGButton.cxx:859
void SetForegroundColor(Pixel_t fore) override
Definition TGButton.h:200
void ChangeText(const char *title)
Definition TGButton.h:217
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a text button widget as a C++ statement(s) on output stream out.
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
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
Int_t fTMode
Definition TGButton.h:150
~TGTextButton() override
Delete a text button widget.
Definition TGButton.cxx:595
void DoRedraw() override
Draw the text button.
Definition TGButton.cxx:747
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
A tooltip can be a one or multiple lines help text that is displayed in a window when the mouse curso...
Definition TGToolTip.h:24
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:139
const char * Data() const
Definition TString.h:376
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
TGraphErrors * gr
Definition legend1.C:25
Event structure.
Definition GuiTypes.h:174