Logo ROOT   6.18/05
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-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_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&); // not implemented
95 TGButton& operator=(const TGButton&); // not implemented
96
97public:
98 static const TGGC &GetDefaultGC();
99 static const TGGC &GetHibckgndGC();
100
101 TGButton(const TGWindow *p = 0, Int_t id = -1, GContext_t norm = GetDefaultGC()(),
103 virtual ~TGButton();
104
105 virtual Bool_t HandleButton(Event_t *event);
106 virtual Bool_t HandleCrossing(Event_t *event);
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&); // not implemented
166 TGTextButton& operator=(const TGTextButton&); // not implemented
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:
239 TGPictureButton(const TGPictureButton&); // not implemented
240 TGPictureButton& operator=(const TGPictureButton&); // not implemented
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 = 0, 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&); // Not implemented
269 TGCheckButton& operator=(const TGCheckButton&); // Not implemented
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
307 virtual Bool_t HandleButton(Event_t *event);
308 virtual Bool_t HandleKey(Event_t *event);
309 virtual Bool_t HandleCrossing(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:
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
363 virtual Bool_t HandleButton(Event_t *event);
364 virtual Bool_t HandleKey(Event_t *event);
365 virtual Bool_t HandleCrossing(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&); // Not implemented
385 TGSplitButton& operator=(const TGSplitButton&); // Not implemented
386
387 void CalcSize();
388 void DrawTriangle(const GContext_t gc, Int_t x, Int_t y);
391 Bool_t HandleSKey(Event_t *event);
392 void SetMenuState(Bool_t state) ;
393
394protected:
395 // 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 is keynavigation is being used
405 TGString fWidestLabel; // Longest label that can be on the button
406 TGString fHeighestLabel; // Heighest label that can be on the button
407
408 virtual void DoRedraw();
409 void Init();
410 void BindKeys(Bool_t on = kTRUE);
411 void BindMenuKeys(Bool_t on = kTRUE);
412
413public:
414 TGSplitButton(const TGWindow *p, TGHotString *menulabel,
415 TGPopupMenu *popmenu, Bool_t split = kTRUE,
416 Int_t id = -1, GContext_t norm = GetDefaultGC()(),
417 FontStruct_t fontstruct = GetDefaultFontStruct(),
419
420 virtual ~TGSplitButton();
421
422 virtual TGDimension GetDefaultSize() const ;
423
424 virtual void SetText(TGHotString *new_label);
425 virtual void SetText(const TString &new_label);
426 virtual void SetFont(FontStruct_t font, Bool_t global = kFALSE);
427 virtual void SetFont(const char *fontName, Bool_t global = kFALSE);
428 virtual void SetMBState(EButtonState state);
429 virtual void SetSplit(Bool_t split);
430 Bool_t IsSplit() { return fSplit; }
431 virtual Bool_t HandleButton(Event_t *event);
432 virtual Bool_t HandleCrossing(Event_t *event);
433 virtual Bool_t HandleKey(Event_t *event);
434 virtual Bool_t HandleMotion(Event_t *event);
435 virtual void Layout();
436
437 virtual void MBPressed() { Emit("MBPressed()"); } // *SIGNAL*
438 virtual void MBReleased() { Emit("MBReleased()"); } // *SIGNAL*
439 virtual void MBClicked() { Emit("MBClicked()"); } // *SIGNAL*
440 virtual void ItemClicked(Int_t id) { Emit("ItemClicked(Int_t)", id); } // *SIGNAL*
441
442 // Slots
443 void HandleMenu(Int_t id) ;
444
445 ClassDef(TGSplitButton, 0) //a split button widget
446};
447
448#endif
Handle_t Cursor_t
Definition: GuiTypes.h:33
Handle_t GContext_t
Definition: GuiTypes.h:37
Handle_t FontStruct_t
Definition: GuiTypes.h:38
ULong_t Pixel_t
Definition: GuiTypes.h:39
Handle_t Window_t
Definition: GuiTypes.h:28
#define e(i)
Definition: RSha256.hxx:103
int Int_t
Definition: RtypesCore.h:41
unsigned int UInt_t
Definition: RtypesCore.h:42
const Bool_t kFALSE
Definition: RtypesCore.h:88
long Long_t
Definition: RtypesCore.h:50
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
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
@ kRaisedFrame
Definition: TGFrame.h:62
@ kDoubleBorder
Definition: TGFrame.h:63
virtual void SetGroup(TGButtonGroup *gr)
Sets new button-group for this button.
Definition: TGButton.cxx:272
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:420
virtual void SetToolTipText(const char *text, Long_t delayms=400)
Set tool tip text associated with this button.
Definition: TGButton.cxx:395
virtual void SetUserData(void *userData)
Definition: TGButton.h:107
virtual EButtonState GetState() const
Definition: TGButton.h:112
UInt_t fStyle
Definition: TGButton.h:83
TGButtonGroup * fGroup
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
Definition: TGButton.h:81
static const TGGC & GetHibckgndGC()
Return graphics context for highlighted frame background.
Definition: TGButton.cxx:430
virtual void SetDown(Bool_t on=kTRUE, Bool_t emit=kFALSE)
Definition: TGButton.cxx:260
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
Definition: TGButton.h:82
virtual void Released()
Definition: TGButton.h:134
TGButton & operator=(const TGButton &)
virtual void AllowStayDown(Bool_t a)
Definition: TGButton.h:113
virtual void EmitSignals(Bool_t wasUp)
Emit button signals.
Definition: TGButton.cxx:335
UInt_t fTWidth
Definition: TGButton.h:73
virtual void Toggle(Bool_t emit=kFALSE)
Definition: TGButton.h:123
UInt_t fTHeight
Definition: TGButton.h:74
virtual void SetStyle(UInt_t newstyle)
Set the button style (modern or classic).
Definition: TGButton.cxx:221
void * fUserData
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:171
virtual Bool_t HandleCrossing(Event_t *event)
Handle mouse crossing event.
Definition: TGButton.cxx:354
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
EButtonState fState
Definition: TGButton.h:75
virtual void SetEnabled(Bool_t e=kTRUE)
Set enabled or disabled state of button.
Definition: TGButton.cxx:409
static const TGGC * fgDefaultGC
Definition: TGButton.h:88
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set button state.
Definition: TGButton.cxx:185
TGToolTip * fTip
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:251
TGButton(const TGButton &)
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event.
Definition: TGButton.cxx:280
Bool_t fStayDown
Definition: TGButton.h:76
GContext_t fNormGC
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:1829
const TGPicture * fOff
Definition: TGButton.h:274
virtual ~TGCheckButton()
Delete a check button.
Definition: TGButton.cxx:1175
TGCheckButton(const TGCheckButton &)
virtual void EmitSignals(Bool_t wasUp=kTRUE)
Emit signals.
Definition: TGButton.cxx:1212
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:1280
const TGPicture * fOn
Definition: TGButton.h:273
void Init()
Common check button initialization.
Definition: TGButton.cxx:1129
virtual void DoRedraw()
Draw the check button widget.
Definition: TGButton.cxx:1387
static const TGGC & GetDefaultGC()
Return default graphics context.
Definition: TGButton.cxx:1453
static FontStruct_t GetDefaultFontStruct()
Return default font structure.
Definition: TGButton.cxx:1443
virtual void SetDisabledAndSelected(Bool_t)
Set the state of a check button to disabled and either on or off.
Definition: TGButton.cxx:1260
virtual Bool_t IsDisabledAndSelected() const
Definition: TGButton.h:313
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set check button state.
Definition: TGButton.cxx:1200
TGCheckButton & operator=(const TGCheckButton &)
virtual Bool_t HandleKey(Event_t *event)
Handle key event. This function will be called when the hotkey is hit.
Definition: TGButton.cxx:1353
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:1983
virtual Bool_t IsToggleButton() const
Definition: TGButton.h:310
EButtonState fPrevState
Definition: TGButton.h:272
const TGPicture * fDisOff
Definition: TGButton.h:276
virtual TGDimension GetDefaultSize() const
default size
Definition: TGButton.cxx:1186
const TGPicture * fDisOn
Definition: TGButton.h:275
virtual Bool_t HandleCrossing(Event_t *event)
Handle mouse crossing event.
Definition: TGButton.cxx:1324
void PSetState(EButtonState state, Bool_t emit)
Set check button state.
Definition: TGButton.cxx:1223
virtual Bool_t IsDown() const
Definition: TGButton.h:312
Definition: TGFont.h:149
Definition: TGGC.h:31
virtual void SetPicture(const TGPicture *new_pic)
Change a picture in a picture button.
Definition: TGButton.cxx:990
virtual void CreateDisabledPicture()
Creates disabled picture.
Definition: TGButton.cxx:1058
const TGPicture * GetDisabledPicture() const
Definition: TGButton.h:257
virtual void SetDisabledPicture(const TGPicture *pic)
Changes disabled picture.
Definition: TGButton.cxx:1085
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:1933
const TGPicture * GetPicture() const
Definition: TGButton.h:256
const TGPicture * fPicD
Definition: TGButton.h:232
const TGPicture * fPic
Definition: TGButton.h:231
virtual ~TGPictureButton()
Destructor.
Definition: TGButton.cxx:980
TGPictureButton & operator=(const TGPictureButton &)
TGPictureButton(const TGPictureButton &)
Bool_t fOwnDisabledPic
Definition: TGButton.h:233
virtual void DoRedraw()
Redraw picture button.
Definition: TGButton.cxx:1014
const TGPicture * fOn
Definition: TGButton.h:330
static FontStruct_t GetDefaultFontStruct()
Return default font structure.
Definition: TGButton.cxx:1809
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
Definition: TGButton.h:332
virtual void DoRedraw()
Draw a radio button.
Definition: TGButton.cxx:1752
virtual Bool_t HandleKey(Event_t *event)
Handle key event. This function will be called when the hotkey is hit.
Definition: TGButton.cxx:1722
virtual ~TGRadioButton()
Delete a radio button.
Definition: TGButton.cxx:1539
virtual Bool_t HandleCrossing(Event_t *event)
Handle mouse crossing event.
Definition: TGButton.cxx:1693
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event.
Definition: TGButton.cxx:1644
EButtonState fPrevState
Definition: TGButton.h:329
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set radio button state.
Definition: TGButton.cxx:1563
static const TGGC & GetDefaultGC()
Return default graphics context.
Definition: TGButton.cxx:1819
const TGPicture * fDisOff
Definition: TGButton.h:333
virtual TGDimension GetDefaultSize() const
default size
Definition: TGButton.cxx:1550
virtual Bool_t IsDown() const
Definition: TGButton.h:371
TGRadioButton(const TGRadioButton &)
TGRadioButton & operator=(const TGRadioButton &)
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:1576
const TGPicture * fOff
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:2051
void PSetState(EButtonState state, Bool_t emit)
Set radio button state.
Definition: TGButton.cxx:1607
void Init()
Common radio button initialization.
Definition: TGButton.cxx:1495
virtual void EmitSignals(Bool_t wasUp=kTRUE)
Emit signals.
Definition: TGButton.cxx:1596
void CalcSize()
Calculate the size of the button.
Definition: TGButton.cxx:2286
virtual Bool_t HandleKey(Event_t *event)
Handle key event. This function will be called when the hotkey is hit.
Definition: TGButton.cxx:2973
virtual void ItemClicked(Int_t id)
Definition: TGButton.h:440
TGSplitButton & operator=(const TGSplitButton &)
Bool_t HandleSKey(Event_t *event)
Handle key event. This function will be called when the hotkey is hit.
Definition: TGButton.cxx:2474
TGPopupMenu * fPopMenu
Definition: TGButton.h:400
virtual void Layout()
layout text button
Definition: TGButton.cxx:3131
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:2269
Int_t fEntryId
Definition: TGButton.h:401
Bool_t fSplit
Definition: TGButton.h:396
virtual void MBClicked()
Definition: TGButton.h:439
EButtonState fMBState
Definition: TGButton.h:397
void Init()
Common initialization used by the different ctors.
Definition: TGButton.cxx:2216
virtual Bool_t HandleButton(Event_t *event)
Handle button events.
Definition: TGButton.cxx:2881
virtual Bool_t HandleCrossing(Event_t *event)
Handle mouse crossing event.
Definition: TGButton.cxx:2961
virtual Bool_t HandleMotion(Event_t *event)
Handle a motion event in a TGSplitButton.
Definition: TGButton.cxx:3107
Bool_t IsSplit()
Definition: TGButton.h:430
Bool_t HandleSButton(Event_t *event)
Handle mouse button event in case the button is split.
Definition: TGButton.cxx:2301
void BindKeys(Bool_t on=kTRUE)
If on kTRUE bind arrow, popup menu hot keys, otherwise remove key bindings.
Definition: TGButton.cxx:2669
Cursor_t fDefaultCursor
Definition: TGButton.h:403
virtual void SetText(TGHotString *new_label)
Set new button text.
Definition: TGButton.cxx:2716
void SetMenuState(Bool_t state)
Popup the attached menu.
Definition: TGButton.cxx:2522
UInt_t fMBWidth
Definition: TGButton.h:399
Bool_t HandleSCrossing(Event_t *event)
Handle mouse crossing event in case of split menu.
Definition: TGButton.cxx:2432
void BindMenuKeys(Bool_t on=kTRUE)
If on kTRUE bind Menu hot keys, otherwise remove key bindings.
Definition: TGButton.cxx:2681
virtual ~TGSplitButton()
Delete a split button widget.
Definition: TGButton.cxx:2260
virtual void MBReleased()
Definition: TGButton.h:438
TGSplitButton(const TGSplitButton &)
TGHotString * fMenuLabel
Definition: TGButton.h:402
void HandleMenu(Int_t id)
Handle a menu item activation.
Definition: TGButton.cxx:3163
virtual void SetFont(FontStruct_t font, Bool_t global=kFALSE)
Changes text font.
Definition: TGButton.cxx:2795
virtual TGDimension GetDefaultSize() const
returns default size
Definition: TGButton.cxx:2706
TGString fHeighestLabel
Definition: TGButton.h:406
UInt_t fTBWidth
Definition: TGButton.h:398
virtual void MBPressed()
Definition: TGButton.h:437
virtual void SetMBState(EButtonState state)
Set the state of the Menu Button part.
Definition: TGButton.cxx:2832
Bool_t fKeyNavigate
Definition: TGButton.h:404
virtual void SetSplit(Bool_t split)
Set the split status of a button.
Definition: TGButton.cxx:2843
TGString fWidestLabel
Definition: TGButton.h:405
virtual void DoRedraw()
Draw the text button.
Definition: TGButton.cxx:2563
const char * GetString() const
Definition: TGString.h:40
void Init()
Common initialization used by the different ctors.
Definition: TGButton.cxx:491
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:574
virtual Bool_t HandleKey(Event_t *event)
Handle key event. This function will be called when the hotkey is hit.
Definition: TGButton.cxx:765
TGTextButton(const TGTextButton &)
static FontStruct_t GetDefaultFontStruct()
Return default font structure.
Definition: TGButton.cxx:819
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:1866
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:645
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:594
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:545
TGHotString * fLabel
Definition: TGButton.h:145
Bool_t HasOwnFont() const
Returns kTRUE if text attributes are unique, returns kFALSE if text attributes are shared (global).
Definition: TGButton.cxx:888
virtual void DoRedraw()
Draw the text button.
Definition: TGButton.cxx:697
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:830
virtual TGDimension GetDefaultSize() const
returns default size
Definition: TGButton.cxx:809
Int_t fTMode
Definition: TGButton.h:150
Int_t fWrapLength
Definition: TGButton.h:151
TGTextLayout * fTLayout
Definition: TGButton.h:153
TGTextButton & operator=(const TGTextButton &)
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:868
Int_t fMLeft
Definition: TGButton.h:146
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition: TQObject.h:164
Basic string class.
Definition: TString.h:131
const char * Data() const
Definition: TString.h:364
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
TCanvas * style()
Definition: style.C:1
auto * a
Definition: textangle.C:12