Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGMenu.h
Go to the documentation of this file.
1// @(#)root/gui:$Id$
2// Author: Fons Rademakers 09/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_TGMenu
13#define ROOT_TGMenu
14
15
16#include "TGFrame.h"
17#include "TGString.h"
18#include "TGPicture.h"
19#include "TGWidget.h"
20
21//--- Menu entry status mask
22
31};
32
33//--- Menu entry types
34
40};
41
42
43class TGPopupMenu;
44class TGMenuBar;
45class TGMenuTitle;
46class TTimer;
47class TGSplitButton;
48
49/** \class TGMenuEntry
50
51This class contains all information about a menu entry.
52It is a fully protected class used internally by TGPopupMenu.
53
54*/
55
56
57class TGMenuEntry : public TObject {
58
59friend class TGPopupMenu;
60friend class TGMenuBar;
61
62protected:
63 Int_t fEntryId; ///< the entry id (used for event processing)
64 void *fUserData; ///< pointer to user data structure
65 EMenuEntryType fType; ///< type of entry
66 Int_t fStatus; ///< entry status (OR of EMenuEntryState)
67 Int_t fEx, fEy; ///< position of entry
68 UInt_t fEw, fEh; ///< width and height of entry
69 TGHotString *fLabel; ///< menu entry label
70 TGString *fShortcut; ///< menu entry shortcut
71 const TGPicture *fPic; ///< menu entry icon
72 TGPopupMenu *fPopup; ///< pointer to popup menu (in case of cascading menus)
73
74private:
75 TGMenuEntry(const TGMenuEntry&) = delete;
77
78public:
79 TGMenuEntry(): fEntryId(0), fUserData(nullptr), fType(), fStatus(0),
80 fEx(0), fEy(0), fEw(0), fEh(0), fLabel(nullptr), fShortcut(nullptr), fPic(nullptr), fPopup(nullptr) { }
81 virtual ~TGMenuEntry() { if (fLabel) delete fLabel; if (fShortcut) delete fShortcut; }
82
83 Int_t GetEntryId() const { return fEntryId; }
84 const char *GetName() const override { return fLabel ? fLabel->GetString() : nullptr; }
85 const char *GetShortcutText() const { return fShortcut ? fShortcut->GetString() : nullptr; }
86 virtual Int_t GetStatus() const { return fStatus; }
87 EMenuEntryType GetType() const { return fType; }
88 TGPopupMenu *GetPopup() const { return fPopup; }
89 TGHotString *GetLabel() const { return fLabel; }
90 TGString *GetShortcut() const { return fShortcut; }
91 Int_t GetEx() const { return fEx; }
92 Int_t GetEy() const { return fEy; }
93 UInt_t GetEw() const { return fEw; }
94 UInt_t GetEh() const { return fEh; }
95 const TGPicture *GetPic() const { return fPic; }
96 void *GetUserData() const { return fUserData; }
97
98 ClassDefOverride(TGMenuEntry,0); // Menu entry class
99};
100
101
102/** \class TGPopupMenu
103
104This class creates a popup menu object. Popup menu's are attached
105to TGMenuBar objects.
106
107*/
108
109
110class TGPopupMenu : public TGFrame {
111
112friend class TGMenuTitle;
113friend class TGMenuBar;
114friend class TGSplitButton;
115
116protected:
117 TList *fEntryList; ///< list of menu entries
118 TGMenuEntry *fCurrent; ///< currently selected menu entry
119 Bool_t fStick; ///< stick mode (popup menu stays sticked on screen)
120 Bool_t fHasGrab; ///< true if menu has grabbed pointer
121 Bool_t fPoppedUp; ///< true if menu is currently popped up
122 UInt_t fXl; ///< Max width of all menu entries
123 UInt_t fMenuWidth; ///< width of popup menu
124 UInt_t fMenuHeight; ///< height of popup menu
125 TTimer *fDelay; ///< delay before popping up cascading menu
126 GContext_t fNormGC; ///< normal drawing graphics context
127 GContext_t fSelGC; ///< graphics context for drawing selections
128 GContext_t fSelbackGC; ///< graphics context for drawing selection background
129 FontStruct_t fFontStruct; ///< font to draw menu entries
130 FontStruct_t fHifontStruct; ///< font to draw highlighted entries
131 Cursor_t fDefaultCursor; ///< right pointing cursor
132 const TGWindow *fMsgWindow; ///< window which handles menu events
133 TGMenuBar *fMenuBar; ///< menu bar (if any)
134 TGSplitButton *fSplitButton; ///< split button (if any)
135 UInt_t fEntrySep; ///< separation distance between entries
136
137 static const TGFont *fgDefaultFont;
138 static const TGFont *fgHilightFont;
139 static const TGGC *fgDefaultGC;
142
146 void DoRedraw() override;
147 virtual void DrawEntry(TGMenuEntry *entry);
148 virtual void Reposition();
149
152 static const TGGC &GetDefaultGC();
153 static const TGGC &GetDefaultSelectedGC();
154 static const TGGC &GetDefaultSelectedBackgroundGC();
155
156private:
157 TGPopupMenu(const TGPopupMenu&) = delete;
159
160public:
161 TGPopupMenu(const TGWindow *p = nullptr, UInt_t w = 10, UInt_t h = 10,
162 UInt_t options = 0);
163 virtual ~TGPopupMenu();
164
165 virtual void AddEntry(TGHotString *s, Int_t id, void *ud = nullptr,
166 const TGPicture *p = nullptr, TGMenuEntry *before = nullptr);
167 virtual void AddEntry(const char *s, Int_t id, void *ud = nullptr,
168 const TGPicture *p = nullptr, TGMenuEntry *before = nullptr);
169 virtual void AddSeparator(TGMenuEntry *before = nullptr);
170 virtual void AddLabel(TGHotString *s, const TGPicture *p = nullptr,
171 TGMenuEntry *before = nullptr);
172 virtual void AddLabel(const char *s, const TGPicture *p = nullptr,
173 TGMenuEntry *before = nullptr);
174 virtual void AddPopup(TGHotString *s, TGPopupMenu *popup,
175 TGMenuEntry *before = nullptr, const TGPicture *p = nullptr);
176 virtual void AddPopup(const char *s, TGPopupMenu *popup,
177 TGMenuEntry *before = nullptr, const TGPicture *p = nullptr);
178 virtual void EnableEntry(Int_t id);
179 virtual void DisableEntry(Int_t id);
180 virtual Bool_t IsEntryEnabled(Int_t id);
181 virtual void HideEntry(Int_t id);
182 virtual Bool_t IsEntryHidden(Int_t id);
183 virtual void DefaultEntry(Int_t id);
184 virtual void CheckEntry(Int_t id);
185 virtual void CheckEntryByData(void *user_data);
186 virtual void UnCheckEntry(Int_t id);
187 virtual void UnCheckEntryByData(void *user_data);
188 virtual void UnCheckEntries();
189 virtual Bool_t IsEntryChecked(Int_t id);
190 virtual void RCheckEntry(Int_t id, Int_t IDfirst, Int_t IDlast);
191 virtual Bool_t IsEntryRChecked(Int_t id);
192 virtual void PlaceMenu(Int_t x, Int_t y, Bool_t stick_mode,
193 Bool_t grab_pointer);
194 virtual Int_t EndMenu(void *&userData);
195 virtual void DeleteEntry(Int_t id);
196 virtual void DeleteEntry(TGMenuEntry *entry);
197 virtual TGMenuEntry *GetEntry(Int_t id);
198 virtual TGMenuEntry *GetCurrent() const { return fCurrent; }
199 virtual TGMenuEntry *GetEntry(const char *s);
200 const TList *GetListOfEntries() const { return fEntryList; }
201 void DrawBorder() override;
202 Bool_t HandleButton(Event_t *event) override;
203 Bool_t HandleMotion(Event_t *event) override;
205 Bool_t HandleTimer(TTimer *t) override;
206 virtual void Associate(const TGWindow *w) { fMsgWindow = w; }
207 virtual void SetMenuBar(TGMenuBar *bar) { fMenuBar = bar; }
208 TGMenuBar *GetMenuBar() const { return fMenuBar; }
209 void Activate(Bool_t) override {}
210 virtual void Activate(TGMenuEntry *entry);
211 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
212
213 UInt_t GetEntrySep() const { return fEntrySep; }
214 virtual void SetEntrySep(UInt_t sep) { fEntrySep = sep; }
215
216 virtual void PoppedUp() { Emit("PoppedUp()"); } // *SIGNAL*
217 virtual void PoppedDown() { Emit("PoppedDown()"); } // *SIGNAL*
218 virtual void Highlighted(Int_t id) { Emit("Highlighted(Int_t)", id); } // *SIGNAL*
219 virtual void Activated(Int_t id) { Emit("Activated(Int_t)", id); } // *SIGNAL*
220
222};
223
224
225/** \class TGMenuTitle
226
227This class creates a menu title. A menu title is a frame
228to which a popup menu can be attached. Menu titles are automatically
229created when adding a popup menu to a menubar.
230
231*/
232
233
234class TGMenuTitle : public TGFrame {
235
236protected:
237 TGPopupMenu *fMenu; ///< attached popup menu
238 TGHotString *fLabel; ///< menu title
239 Int_t fTitleId; ///< id of selected menu item
240 void *fTitleData; ///< user data associated with selected item
241 Bool_t fState; ///< menu title state (active/not active)
242 Int_t fHkeycode; ///< hot key code
244 Pixel_t fTextColor; ///< text color
245 GContext_t fNormGC, fSelGC; ///< normal and selection graphics contexts
246
247 void DoRedraw() override;
248
249 static const TGFont *fgDefaultFont;
251 static const TGGC *fgDefaultGC;
252
253private:
254 TGMenuTitle(const TGMenuTitle&) = delete;
256
257public:
259 static const TGGC &GetDefaultSelectedGC();
260 static const TGGC &GetDefaultGC();
261
262 TGMenuTitle(const TGWindow *p = nullptr, TGHotString *s = nullptr, TGPopupMenu *menu = nullptr,
263 GContext_t norm = GetDefaultGC()(),
265 UInt_t options = 0);
266 virtual ~TGMenuTitle() { if (fLabel) delete fLabel; }
267
268 Pixel_t GetTextColor() const { return fTextColor; }
269 void SetTextColor(Pixel_t col) { fTextColor = col; }
270 virtual void SetState(Bool_t state);
271 Bool_t GetState() const { return fState; }
272 Int_t GetHotKeyCode() const { return fHkeycode; }
273 TGPopupMenu *GetMenu() const { return fMenu; }
274 const char *GetName() const override { return fLabel ? fLabel->GetString() : nullptr; }
275 virtual void DoSendMessage();
276 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
277
278 ClassDefOverride(TGMenuTitle,0) // Menu title class
279};
280
281
283
284friend class TGPopupMenu;
285
286protected:
287 TGMenuTitle *fCurrent; ///< current menu title
288 TList *fTitles; ///< list of menu titles
289 Cursor_t fDefaultCursor; ///< right pointing cursor
290 Bool_t fStick; ///< stick mode (popup menu stays sticked on screen)
291 TList *fTrash; ///< garbage
292 Bool_t fKeyNavigate; ///< kTRUE if arrow key navigation is on
293 TGPopupMenu *fMenuMore; ///< extra >> menu
294 TGLayoutHints *fMenuBarMoreLayout; ///< layout of the extra menu
295 Bool_t fWithExt; ///< indicates whether the >> menu is shown or not
296 TList *fOutLayouts; ///< keeps trace of layouts of hidden menus
297 TList *fNeededSpace; ///< keeps trace of space needed for hidden menus
298
299 virtual void AddFrameBefore(TGFrame *f, TGLayoutHints *l = nullptr,
300 TGPopupMenu *before = nullptr);
301
302 virtual void BindHotKey(Int_t keycode, Bool_t on = kTRUE);
303 virtual void BindKeys(Bool_t on = kTRUE);
304 void BindMenu(TGPopupMenu* subMenu, Bool_t on);
305
306private:
307 TGMenuBar(const TGMenuBar&) = delete;
308 TGMenuBar& operator=(const TGMenuBar&) = delete;
309
310public:
311 TGMenuBar(const TGWindow *p = nullptr, UInt_t w = 60, UInt_t h = 20,
313 virtual ~TGMenuBar();
314
315 virtual void AddPopup(TGHotString *s, TGPopupMenu *menu, TGLayoutHints *l,
316 TGPopupMenu *before = nullptr);
317 virtual void AddPopup(const char *s, TGPopupMenu *menu, TGLayoutHints *l,
318 TGPopupMenu *before = nullptr);
319 virtual TGPopupMenu *AddPopup(const TString &s, Int_t padleft = 4, Int_t padright = 0,
320 Int_t padtop = 0, Int_t padbottom = 0);
321 virtual void AddTitle(TGMenuTitle *title, TGLayoutHints *l, TGPopupMenu *before = nullptr);
322
323 virtual TGPopupMenu *GetPopup(const char *s);
324 virtual TGPopupMenu *RemovePopup(const char *s);
325
326 virtual TGMenuTitle *GetCurrent() const { return fCurrent; }
327 virtual TList *GetTitles() const { return fTitles; }
328 Bool_t HandleButton(Event_t *event) override;
329 Bool_t HandleMotion(Event_t *event) override;
330 Bool_t HandleKey(Event_t *event) override;
331 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
332 void Layout() override;
333 void PopupConnection();
335
336 ClassDefOverride(TGMenuBar,0) // Menu bar class
337};
338
339#endif
Handle_t GContext_t
Graphics context handle.
Definition GuiTypes.h:38
@ kRaisedFrame
Definition GuiTypes.h:384
@ kHorizontalFrame
Definition GuiTypes.h:382
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 b(i)
Definition RSha256.hxx:100
#define f(i)
Definition RSha256.hxx:104
#define h(i)
Definition RSha256.hxx:106
bool Bool_t
Definition RtypesCore.h:63
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define BIT(n)
Definition Rtypes.h:85
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
EMenuEntryState
Definition TGMenu.h:23
@ kMenuRadioMask
Definition TGMenu.h:28
@ kMenuRadioEntryMask
Definition TGMenu.h:30
@ kMenuHideMask
Definition TGMenu.h:29
@ kMenuCheckedMask
Definition TGMenu.h:27
@ kMenuActiveMask
Definition TGMenu.h:24
@ kMenuDefaultMask
Definition TGMenu.h:26
@ kMenuEnableMask
Definition TGMenu.h:25
EMenuEntryType
Definition TGMenu.h:35
@ kMenuEntry
Definition TGMenu.h:38
@ kMenuSeparator
Definition TGMenu.h:36
@ kMenuPopup
Definition TGMenu.h:39
@ kMenuLabel
Definition TGMenu.h:37
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 char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void gc
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
A composite frame that layout their children in horizontal way.
Definition TGFrame.h:385
TGHotString is a string with a "hot" character underlined.
Definition TGString.h:42
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
The TGMenu.h header contains all different menu classes.
Definition TGMenu.h:282
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a menu bar widget as a C++ statement(s) on output stream out.
Definition TGMenu.cxx:2345
TGPopupMenu * fMenuMore
extra >> menu
Definition TGMenu.h:293
virtual TGPopupMenu * RemovePopup(const char *s)
Remove popup menu from menu bar.
Definition TGMenu.cxx:561
Bool_t fStick
stick mode (popup menu stays sticked on screen)
Definition TGMenu.h:290
virtual ~TGMenuBar()
Delete menu bar object.
Definition TGMenu.cxx:155
Bool_t HandleMotion(Event_t *event) override
Handle a mouse motion event in a menu bar.
Definition TGMenu.cxx:590
TGMenuBar & operator=(const TGMenuBar &)=delete
virtual void AddFrameBefore(TGFrame *f, TGLayoutHints *l=nullptr, TGPopupMenu *before=nullptr)
Private version of AddFrame for menubar, to make sure that we indeed only add TGMenuTitle objects to ...
Definition TGMenu.cxx:503
virtual void BindHotKey(Int_t keycode, Bool_t on=kTRUE)
If on kTRUE bind hot keys, otherwise remove key binding.
Definition TGMenu.cxx:383
Bool_t fWithExt
indicates whether the >> menu is shown or not
Definition TGMenu.h:295
TGMenuTitle * fCurrent
current menu title
Definition TGMenu.h:287
virtual TGPopupMenu * GetPopup(const char *s)
Return popup menu with the specified name.
Definition TGMenu.cxx:540
Bool_t HandleButton(Event_t *event) override
Handle a mouse button event in a menubar.
Definition TGMenu.cxx:623
void Layout() override
Calculates whether the >> menu must be shown or not and which menu titles are hidden.
Definition TGMenu.cxx:193
TList * fTrash
garbage
Definition TGMenu.h:291
virtual void BindKeys(Bool_t on=kTRUE)
If on kTRUE bind arrow, popup menu hot keys, otherwise remove key bindings.
Definition TGMenu.cxx:337
virtual TGMenuTitle * GetCurrent() const
Definition TGMenu.h:326
virtual TList * GetTitles() const
Definition TGMenu.h:327
void BindMenu(TGPopupMenu *subMenu, Bool_t on)
If on kTRUE bind subMenu hot keys, otherwise remove key bindings.
Definition TGMenu.cxx:355
TList * fOutLayouts
keeps trace of layouts of hidden menus
Definition TGMenu.h:296
TGFrameElement * GetLastOnLeft()
Returns the last visible menu title on the left of the '>>' in the menu bar.
Definition TGMenu.cxx:268
void PopupConnection()
Connects the corresponding cascaded menu to the proper slots, according to the highlighted menu entry...
Definition TGMenu.cxx:289
TList * fNeededSpace
keeps trace of space needed for hidden menus
Definition TGMenu.h:297
Cursor_t fDefaultCursor
right pointing cursor
Definition TGMenu.h:289
TGMenuBar(const TGMenuBar &)=delete
Bool_t fKeyNavigate
kTRUE if arrow key navigation is on
Definition TGMenu.h:292
TGLayoutHints * fMenuBarMoreLayout
layout of the extra menu
Definition TGMenu.h:294
TList * fTitles
list of menu titles
Definition TGMenu.h:288
Bool_t HandleKey(Event_t *event) override
Handle keyboard events in a menu bar.
Definition TGMenu.cxx:686
virtual void AddTitle(TGMenuTitle *title, TGLayoutHints *l, TGPopupMenu *before=nullptr)
Add popup via created before menu title.
Definition TGMenu.cxx:435
virtual void AddPopup(TGHotString *s, TGPopupMenu *menu, TGLayoutHints *l, TGPopupMenu *before=nullptr)
Add popup menu to menu bar.
Definition TGMenu.cxx:418
This class contains all information about a menu entry.
Definition TGMenu.h:57
TGPopupMenu * GetPopup() const
Definition TGMenu.h:88
Int_t fEx
Definition TGMenu.h:67
const char * GetShortcutText() const
Definition TGMenu.h:85
const TGPicture * GetPic() const
Definition TGMenu.h:95
TGMenuEntry()
Definition TGMenu.h:79
TGString * GetShortcut() const
Definition TGMenu.h:90
TGMenuEntry & operator=(const TGMenuEntry &)=delete
Int_t fStatus
entry status (OR of EMenuEntryState)
Definition TGMenu.h:66
Int_t fEntryId
the entry id (used for event processing)
Definition TGMenu.h:63
void * GetUserData() const
Definition TGMenu.h:96
TGHotString * fLabel
menu entry label
Definition TGMenu.h:69
TGHotString * GetLabel() const
Definition TGMenu.h:89
UInt_t GetEw() const
Definition TGMenu.h:93
const char * GetName() const override
Returns name of object.
Definition TGMenu.h:84
Int_t GetEx() const
Definition TGMenu.h:91
virtual ~TGMenuEntry()
Definition TGMenu.h:81
Int_t GetEy() const
Definition TGMenu.h:92
UInt_t fEw
Definition TGMenu.h:68
virtual Int_t GetStatus() const
Definition TGMenu.h:86
const TGPicture * fPic
menu entry icon
Definition TGMenu.h:71
TGString * fShortcut
menu entry shortcut
Definition TGMenu.h:70
void * fUserData
pointer to user data structure
Definition TGMenu.h:64
Int_t fEy
position of entry
Definition TGMenu.h:67
EMenuEntryType GetType() const
Definition TGMenu.h:87
UInt_t GetEh() const
Definition TGMenu.h:94
EMenuEntryType fType
type of entry
Definition TGMenu.h:65
UInt_t fEh
width and height of entry
Definition TGMenu.h:68
TGPopupMenu * fPopup
pointer to popup menu (in case of cascading menus)
Definition TGMenu.h:72
TGMenuEntry(const TGMenuEntry &)=delete
Int_t GetEntryId() const
Definition TGMenu.h:83
This class creates a menu title.
Definition TGMenu.h:234
const char * GetName() const override
Returns name of object.
Definition TGMenu.h:274
TGHotString * fLabel
menu title
Definition TGMenu.h:238
virtual ~TGMenuTitle()
Definition TGMenu.h:266
static const TGGC * fgDefaultGC
Definition TGMenu.h:251
void * fTitleData
user data associated with selected item
Definition TGMenu.h:240
Pixel_t GetTextColor() const
Definition TGMenu.h:268
static FontStruct_t GetDefaultFontStruct()
Return default font structure in use.
Definition TGMenu.cxx:2144
TGPopupMenu * fMenu
attached popup menu
Definition TGMenu.h:237
void DoRedraw() override
Draw a menu title.
Definition TGMenu.cxx:2088
Int_t fHkeycode
hot key code
Definition TGMenu.h:242
virtual void SetState(Bool_t state)
Set state of menu title.
Definition TGMenu.cxx:2059
GContext_t fNormGC
Definition TGMenu.h:245
static const TGFont * fgDefaultFont
Definition TGMenu.h:249
static const TGGC & GetDefaultGC()
Return default graphics context in use.
Definition TGMenu.cxx:2154
Int_t GetHotKeyCode() const
Definition TGMenu.h:272
static const TGGC * fgDefaultSelectedGC
Definition TGMenu.h:250
TGPopupMenu * GetMenu() const
Definition TGMenu.h:273
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a title menu widget as a C++ statement(s) on output stream out.
Definition TGMenu.cxx:2313
static const TGGC & GetDefaultSelectedGC()
Return default selection graphics context in use.
Definition TGMenu.cxx:2164
void SetTextColor(Pixel_t col)
Definition TGMenu.h:269
TGMenuTitle(const TGMenuTitle &)=delete
Bool_t GetState() const
Definition TGMenu.h:271
TGMenuTitle & operator=(const TGMenuTitle &)=delete
virtual void DoSendMessage()
Send final selected menu item to be processed.
Definition TGMenu.cxx:2131
Pixel_t fTextColor
text color
Definition TGMenu.h:244
GContext_t fSelGC
normal and selection graphics contexts
Definition TGMenu.h:245
Bool_t fState
menu title state (active/not active)
Definition TGMenu.h:241
FontStruct_t fFontStruct
font
Definition TGMenu.h:243
Int_t fTitleId
id of selected menu item
Definition TGMenu.h:239
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
virtual void PoppedUp()
Definition TGMenu.h:216
Bool_t HandleCrossing(Event_t *event) override
Handle pointer crossing event in popup menu.
Definition TGMenu.cxx:1367
TList * fEntryList
list of menu entries
Definition TGMenu.h:117
UInt_t GetEntrySep() const
Definition TGMenu.h:213
virtual void HideEntry(Int_t id)
Hide entry (hidden entries are not shown in the menu).
Definition TGMenu.cxx:1751
virtual void DefaultEntry(Int_t id)
Set default entry (default entries are drawn with bold text).
Definition TGMenu.cxx:1689
TGPopupMenu(const TGPopupMenu &)=delete
Bool_t fPoppedUp
true if menu is currently popped up
Definition TGMenu.h:121
virtual void AddLabel(TGHotString *s, const TGPicture *p=nullptr, TGMenuEntry *before=nullptr)
Add a menu label to the menu.
Definition TGMenu.cxx:1095
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a popup menu widget as a C++ statement(s) on output stream out.
Definition TGMenu.cxx:2174
static const TGGC * fgDefaultGC
Definition TGMenu.h:139
TGMenuEntry * fCurrent
currently selected menu entry
Definition TGMenu.h:118
void Activate(Bool_t) override
Definition TGMenu.h:209
virtual TGMenuEntry * GetEntry(Int_t id)
Find entry with specified id.
Definition TGMenu.cxx:1897
static const TGGC & GetDefaultSelectedGC()
Return the selection graphics context in use.
Definition TGMenu.cxx:1974
Cursor_t fDefaultCursor
right pointing cursor
Definition TGMenu.h:131
static const TGGC * fgDefaultSelectedBackgroundGC
Definition TGMenu.h:141
virtual Bool_t IsEntryChecked(Int_t id)
Return true if menu item is checked.
Definition TGMenu.cxx:1845
UInt_t fMenuHeight
height of popup menu
Definition TGMenu.h:124
virtual Bool_t IsEntryRChecked(Int_t id)
Return true if menu item has radio check mark.
Definition TGMenu.cxx:1878
virtual void CheckEntryByData(void *user_data)
Check a menu entry (i.e.
Definition TGMenu.cxx:1795
TGSplitButton * fSplitButton
split button (if any)
Definition TGMenu.h:134
virtual void SetMenuBar(TGMenuBar *bar)
Definition TGMenu.h:207
GContext_t fNormGC
normal drawing graphics context
Definition TGMenu.h:126
virtual ~TGPopupMenu()
Delete a popup menu.
Definition TGMenu.cxx:975
void DoRedraw() override
Draw popup menu.
Definition TGMenu.cxx:1492
GContext_t fSelGC
graphics context for drawing selections
Definition TGMenu.h:127
virtual void Highlighted(Int_t id)
Definition TGMenu.h:218
static const TGGC & GetDefaultGC()
Return default graphics context.
Definition TGMenu.cxx:1964
void DrawBorder() override
Draw border round popup menu.
Definition TGMenu.cxx:1604
virtual void UnCheckEntries()
Uncheck all entries.
Definition TGMenu.cxx:1819
virtual void AddPopup(TGHotString *s, TGPopupMenu *popup, TGMenuEntry *before=nullptr, const TGPicture *p=nullptr)
Add a (cascading) popup menu to a popup menu.
Definition TGMenu.cxx:1152
static FontStruct_t GetDefaultFontStruct()
Return the default font structure in use.
Definition TGMenu.cxx:1994
static const TGGC * fgDefaultSelectedGC
Definition TGMenu.h:140
static const TGFont * fgDefaultFont
Definition TGMenu.h:137
virtual void CheckEntry(Int_t id)
Check a menu entry (i.e. add a check mark in front of it).
Definition TGMenu.cxx:1782
UInt_t fEntrySep
separation distance between entries
Definition TGMenu.h:135
TGMenuBar * fMenuBar
menu bar (if any)
Definition TGMenu.h:133
virtual void Reposition()
Reposition entries in popup menu.
Definition TGMenu.cxx:1209
virtual void SetEntrySep(UInt_t sep)
Definition TGMenu.h:214
Bool_t HandleTimer(TTimer *t) override
If TPopupDelayTimer times out popup cascading popup menu (if it is still the current entry).
Definition TGMenu.cxx:1467
virtual void DisableEntry(Int_t id)
Disable entry (disabled entries appear in a sunken relieve).
Definition TGMenu.cxx:1724
virtual void DrawEntry(TGMenuEntry *entry)
Draw popup menu entry.
Definition TGMenu.cxx:1506
virtual void EnableEntry(Int_t id)
Enable entry. By default entries are enabled.
Definition TGMenu.cxx:1705
virtual void UnCheckEntryByData(void *user_data)
Uncheck a menu entry (i.e.
Definition TGMenu.cxx:1833
virtual void PoppedDown()
Definition TGMenu.h:217
virtual Bool_t IsEntryHidden(Int_t id)
Return true if menu entry is hidden.
Definition TGMenu.cxx:1768
TTimer * fDelay
delay before popping up cascading menu
Definition TGMenu.h:125
UInt_t fXl
Max width of all menu entries.
Definition TGMenu.h:122
FontStruct_t fFontStruct
font to draw menu entries
Definition TGMenu.h:129
virtual void UnCheckEntry(Int_t id)
Uncheck menu entry (i.e. remove check mark).
Definition TGMenu.cxx:1807
virtual void Associate(const TGWindow *w)
Definition TGMenu.h:206
virtual Int_t EndMenu(void *&userData)
Close menu and return ID of selected menu item.
Definition TGMenu.cxx:1289
virtual TGMenuEntry * GetCurrent() const
Definition TGMenu.h:198
virtual void DeleteEntry(Int_t id)
Delete entry with specified id from menu.
Definition TGMenu.cxx:1926
TGPopupMenu & operator=(const TGPopupMenu &)=delete
static FontStruct_t GetHilightFontStruct()
Return the font structure in use for highlighted menu entries.
Definition TGMenu.cxx:2004
const TGWindow * fMsgWindow
window which handles menu events
Definition TGMenu.h:132
static const TGGC & GetDefaultSelectedBackgroundGC()
Return the selection background graphics context in use.
Definition TGMenu.cxx:1984
virtual void AddSeparator(TGMenuEntry *before=nullptr)
Add a menu separator to the menu.
Definition TGMenu.cxx:1060
Bool_t fStick
stick mode (popup menu stays sticked on screen)
Definition TGMenu.h:119
FontStruct_t fHifontStruct
font to draw highlighted entries
Definition TGMenu.h:130
void DrawRCheckMark(GContext_t gc, Int_t l, Int_t t, Int_t r, Int_t b)
Draw radio check mark. Used for radio button type menu entries.
Definition TGMenu.cxx:1670
void DrawCheckMark(GContext_t gc, Int_t l, Int_t t, Int_t r, Int_t b)
Draw check mark. Used for checked button type menu entries.
Definition TGMenu.cxx:1651
virtual void RCheckEntry(Int_t id, Int_t IDfirst, Int_t IDlast)
Radio-select entry (note that they cannot be unselected, the selection must be moved to another entry...
Definition TGMenu.cxx:1860
virtual void AddEntry(TGHotString *s, Int_t id, void *ud=nullptr, const TGPicture *p=nullptr, TGMenuEntry *before=nullptr)
Add a menu entry.
Definition TGMenu.cxx:990
TGMenuBar * GetMenuBar() const
Definition TGMenu.h:208
UInt_t fMenuWidth
width of popup menu
Definition TGMenu.h:123
virtual void PlaceMenu(Int_t x, Int_t y, Bool_t stick_mode, Bool_t grab_pointer)
Popup a popup menu.
Definition TGMenu.cxx:1241
const TList * GetListOfEntries() const
Definition TGMenu.h:200
virtual void Activated(Int_t id)
Definition TGMenu.h:219
GContext_t fSelbackGC
graphics context for drawing selection background
Definition TGMenu.h:128
Bool_t HandleMotion(Event_t *event) override
Handle pointer motion event in popup menu.
Definition TGMenu.cxx:1394
Bool_t HandleButton(Event_t *event) override
Handle button event in the popup menu.
Definition TGMenu.cxx:1338
static const TGFont * fgHilightFont
Definition TGMenu.h:138
Bool_t fHasGrab
true if menu has grabbed pointer
Definition TGMenu.h:120
void DrawTrianglePattern(GContext_t gc, Int_t l, Int_t t, Int_t r, Int_t b)
Draw triangle pattern.
Definition TGMenu.cxx:1631
virtual Bool_t IsEntryEnabled(Int_t id)
Return true if menu entry is enabled.
Definition TGMenu.cxx:1736
Implements a button with added menu functionality.
Definition TGButton.h:378
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
ROOT GUI Window base class.
Definition TGWindow.h:23
A doubly linked list.
Definition TList.h:38
Mother of all ROOT objects.
Definition TObject.h:41
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition TQObject.h:164
Basic string class.
Definition TString.h:139
Handles synchronous and a-synchronous timer events.
Definition TTimer.h:51
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
Event structure.
Definition GuiTypes.h:174
TLine l
Definition textangle.C:4