Logo ROOT  
Reference Guide
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 
43 class TGPopupMenu;
44 class TGMenuBar;
45 class TGMenuTitle;
46 class TTimer;
47 class TGSplitButton;
48 
49 /** \class TGMenuEntry
50 
51 This class contains all information about a menu entry.
52 It is a fully protected class used internally by TGPopupMenu.
53 
54 */
55 
56 
57 class TGMenuEntry : public TObject {
58 
59 friend class TGPopupMenu;
60 friend class TGMenuBar;
61 
62 protected:
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 
74 private:
75  TGMenuEntry(const TGMenuEntry&) = delete;
76  TGMenuEntry& operator=(const TGMenuEntry&) = delete;
77 
78 public:
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 { 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  ClassDef(TGMenuEntry,0); // Menu entry class
99 };
100 
101 
102 /** \class TGPopupMenu
103 
104 This class creates a popup menu object. Popup menu's are attached
105 to TGMenuBar objects.
106 
107 */
108 
109 
110 class TGPopupMenu : public TGFrame {
111 
112 friend class TGMenuTitle;
113 friend class TGMenuBar;
114 friend class TGSplitButton;
115 
116 protected:
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;
140  static const TGGC *fgDefaultSelectedGC;
142 
144  void DrawCheckMark(GContext_t gc, Int_t l, Int_t t, Int_t r, Int_t b);
146  virtual void DoRedraw();
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 
156 private:
157  TGPopupMenu(const TGPopupMenu&) = delete;
158  TGPopupMenu& operator=(const TGPopupMenu&) = delete;
159 
160 public:
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  virtual void DrawBorder();
202  virtual Bool_t HandleButton(Event_t *event);
203  virtual Bool_t HandleMotion(Event_t *event);
205  virtual Bool_t HandleTimer(TTimer *t);
206  virtual void Associate(const TGWindow *w) { fMsgWindow = w; }
207  virtual void SetMenuBar(TGMenuBar *bar) { fMenuBar = bar; }
208  TGMenuBar *GetMenuBar() const { return fMenuBar; }
209  virtual void Activate(Bool_t) { }
210  virtual void Activate(TGMenuEntry *entry);
211  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
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 
221  ClassDef(TGPopupMenu,0) // Popup menu
222 };
223 
224 
225 /** \class TGMenuTitle
226 
227 This class creates a menu title. A menu title is a frame
228 to which a popup menu can be attached. Menu titles are automatically
229 created when adding a popup menu to a menubar.
230 
231 */
232 
233 
234 class TGMenuTitle : public TGFrame {
235 
236 protected:
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  virtual void DoRedraw();
248 
249  static const TGFont *fgDefaultFont;
250  static const TGGC *fgDefaultSelectedGC;
251  static const TGGC *fgDefaultGC;
252 
253 private:
254  TGMenuTitle(const TGMenuTitle&) = delete;
255  TGMenuTitle& operator=(const TGMenuTitle&) = delete;
256 
257 public:
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 { return fLabel ? fLabel->GetString() : nullptr; }
275  virtual void DoSendMessage();
276  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
277 
278  ClassDef(TGMenuTitle,0) // Menu title class
279 };
280 
281 
282 class TGMenuBar : public TGHorizontalFrame {
283 
284 friend class TGPopupMenu;
285 
286 protected:
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 
306 private:
307  TGMenuBar(const TGMenuBar&) = delete;
308  TGMenuBar& operator=(const TGMenuBar&) = delete;
309 
310 public:
311  TGMenuBar(const TGWindow *p = 0, UInt_t w = 60, UInt_t h = 20,
312  UInt_t options = kHorizontalFrame | kRaisedFrame);
313  virtual ~TGMenuBar();
314 
315  virtual void AddPopup(TGHotString *s, TGPopupMenu *menu, TGLayoutHints *l,
316  TGPopupMenu *before = 0);
317  virtual void AddPopup(const char *s, TGPopupMenu *menu, TGLayoutHints *l,
318  TGPopupMenu *before = 0);
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 = 0);
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  virtual Bool_t HandleButton(Event_t *event);
329  virtual Bool_t HandleMotion(Event_t *event);
330  virtual Bool_t HandleKey(Event_t *event);
331  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
332  virtual void Layout();
333  void PopupConnection();
335 
336  ClassDef(TGMenuBar,0) // Menu bar class
337 };
338 
339 #endif
l
auto * l
Definition: textangle.C:4
TGPopupMenu::PlaceMenu
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
TGMenuBar::~TGMenuBar
virtual ~TGMenuBar()
Delete menu bar object.
Definition: TGMenu.cxx:155
TGPopupMenu::fEntrySep
UInt_t fEntrySep
separation distance between entries
Definition: TGMenu.h:135
TGPopupMenu::IsEntryChecked
virtual Bool_t IsEntryChecked(Int_t id)
Return true if menu item is checked.
Definition: TGMenu.cxx:1845
TGMenuBar::HandleMotion
virtual Bool_t HandleMotion(Event_t *event)
Handle a mouse motion event in a menu bar.
Definition: TGMenu.cxx:590
TGMenuBar::fTitles
TList * fTitles
list of menu titles
Definition: TGMenu.h:288
TGMenuBar::BindKeys
virtual void BindKeys(Bool_t on=kTRUE)
If on kTRUE bind arrow, popup menu hot keys, otherwise remove key bindings.
Definition: TGMenu.cxx:337
kMenuHideMask
@ kMenuHideMask
Definition: TGMenu.h:29
kMenuPopup
@ kMenuPopup
Definition: TGMenu.h:39
TGWindow
ROOT GUI Window base class.
Definition: TGWindow.h:23
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:100
TGPopupMenu::HandleCrossing
virtual Bool_t HandleCrossing(Event_t *event)
Handle pointer crossing event in popup menu.
Definition: TGMenu.cxx:1367
TGMenuTitle::DoRedraw
virtual void DoRedraw()
Draw a menu title.
Definition: TGMenu.cxx:2088
TGPopupMenu::GetDefaultSelectedGC
static const TGGC & GetDefaultSelectedGC()
Return the selection graphics context in use.
Definition: TGMenu.cxx:1974
TGPopupMenu::UnCheckEntries
virtual void UnCheckEntries()
Uncheck all entries.
Definition: TGMenu.cxx:1819
TGMenuEntry::GetShortcutText
const char * GetShortcutText() const
Definition: TGMenu.h:85
TGMenuEntry::fType
EMenuEntryType fType
type of entry
Definition: TGMenu.h:65
TGPicture
The TGPicture class implements pictures and icons used in the different GUI elements and widgets.
Definition: TGPicture.h:25
f
#define f(i)
Definition: RSha256.hxx:104
TGPopupMenu::fMenuWidth
UInt_t fMenuWidth
width of popup menu
Definition: TGMenu.h:123
Option_t
const char Option_t
Definition: RtypesCore.h:66
TGMenuEntry::fEw
UInt_t fEw
Definition: TGMenu.h:68
TGMenuBar::RemovePopup
virtual TGPopupMenu * RemovePopup(const char *s)
Remove popup menu from menu bar.
Definition: TGMenu.cxx:561
TGPopupMenu::SavePrimitive
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a popup menu widget as a C++ statement(s) on output stream out.
Definition: TGMenu.cxx:2174
TGMenuEntry::fEx
Int_t fEx
Definition: TGMenu.h:67
TGMenuTitle::fFontStruct
FontStruct_t fFontStruct
font
Definition: TGMenu.h:243
TGPopupMenu::~TGPopupMenu
virtual ~TGPopupMenu()
Delete a popup menu.
Definition: TGMenu.cxx:975
TGMenuBar::TGMenuBar
TGMenuBar(const TGMenuBar &)=delete
Pixel_t
ULong_t Pixel_t
Pixel value.
Definition: GuiTypes.h:40
TGPopupMenu::Reposition
virtual void Reposition()
Reposition entries in popup menu.
Definition: TGMenu.cxx:1209
TGMenuTitle::fgDefaultSelectedGC
static const TGGC * fgDefaultSelectedGC
Definition: TGMenu.h:250
TGMenuBar::GetCurrent
virtual TGMenuTitle * GetCurrent() const
Definition: TGMenu.h:326
TGPicture.h
TGMenuEntry::TGMenuEntry
TGMenuEntry()
Definition: TGMenu.h:79
FontStruct_t
Handle_t FontStruct_t
Pointer to font structure.
Definition: GuiTypes.h:39
r
ROOT::R::TRInterface & r
Definition: Object.C:4
TGPopupMenu::DrawBorder
virtual void DrawBorder()
Draw border round popup menu.
Definition: TGMenu.cxx:1604
TGMenuBar::BindMenu
void BindMenu(TGPopupMenu *subMenu, Bool_t on)
If on kTRUE bind subMenu hot keys, otherwise remove key bindings.
Definition: TGMenu.cxx:355
TGHotString
TGHotString is a string with a "hot" character underlined.
Definition: TGString.h:42
TGMenuTitle::operator=
TGMenuTitle & operator=(const TGMenuTitle &)=delete
TGPopupMenu::AddLabel
virtual void AddLabel(TGHotString *s, const TGPicture *p=nullptr, TGMenuEntry *before=nullptr)
Add a menu label to the menu.
Definition: TGMenu.cxx:1095
TGPopupMenu::AddSeparator
virtual void AddSeparator(TGMenuEntry *before=nullptr)
Add a menu separator to the menu.
Definition: TGMenu.cxx:1060
TGMenuEntry::GetEx
Int_t GetEx() const
Definition: TGMenu.h:91
TGMenuEntry::fEy
Int_t fEy
position of entry
Definition: TGMenu.h:67
TGMenuTitle::fLabel
TGHotString * fLabel
menu title
Definition: TGMenu.h:238
kMenuSeparator
@ kMenuSeparator
Definition: TGMenu.h:36
TGMenuEntry::operator=
TGMenuEntry & operator=(const TGMenuEntry &)=delete
TGeant4Unit::s
static constexpr double s
Definition: TGeant4SystemOfUnits.h:162
TGPopupMenu::UnCheckEntryByData
virtual void UnCheckEntryByData(void *user_data)
Uncheck a menu entry (i.e.
Definition: TGMenu.cxx:1833
TGPopupMenu::fEntryList
TList * fEntryList
list of menu entries
Definition: TGMenu.h:117
TGMenuTitle::SetState
virtual void SetState(Bool_t state)
Set state of menu title.
Definition: TGMenu.cxx:2059
TGMenuBar::HandleKey
virtual Bool_t HandleKey(Event_t *event)
Handle keyboard events in a menu bar.
Definition: TGMenu.cxx:686
TGPopupMenu::HandleButton
virtual Bool_t HandleButton(Event_t *event)
Handle button event in the popup menu.
Definition: TGMenu.cxx:1338
TGMenuBar::fWithExt
Bool_t fWithExt
indicates whether the >> menu is shown or not
Definition: TGMenu.h:295
TGMenuEntry
This class contains all information about a menu entry.
Definition: TGMenu.h:57
TGMenuBar::GetLastOnLeft
TGFrameElement * GetLastOnLeft()
Returns the last visible menu title on the left of the '>>' in the menu bar.
Definition: TGMenu.cxx:268
TGMenuBar::AddTitle
virtual void AddTitle(TGMenuTitle *title, TGLayoutHints *l, TGPopupMenu *before=0)
Add popup via created before menu title.
Definition: TGMenu.cxx:435
event
Definition: triangle.c:552
TGPopupMenu::SetMenuBar
virtual void SetMenuBar(TGMenuBar *bar)
Definition: TGMenu.h:207
x
Double_t x[n]
Definition: legend1.C:17
TGMenuEntry::fStatus
Int_t fStatus
entry status (OR of EMenuEntryState)
Definition: TGMenu.h:66
TGPopupMenu::IsEntryRChecked
virtual Bool_t IsEntryRChecked(Int_t id)
Return true if menu item has radio check mark.
Definition: TGMenu.cxx:1878
TGMenuBar::fNeededSpace
TList * fNeededSpace
keeps trace of space needed for hidden menus
Definition: TGMenu.h:297
TGMenuEntry::TGMenuEntry
TGMenuEntry(const TGMenuEntry &)=delete
TGMenuEntry::GetEw
UInt_t GetEw() const
Definition: TGMenu.h:93
TGMenuTitle::GetMenu
TGPopupMenu * GetMenu() const
Definition: TGMenu.h:273
TGPopupMenu::fgDefaultFont
static const TGFont * fgDefaultFont
Definition: TGMenu.h:137
TGHorizontalFrame
A composite frame that layout their children in horizontal way.
Definition: TGFrame.h:386
TGPopupMenu::DrawEntry
virtual void DrawEntry(TGMenuEntry *entry)
Draw popup menu entry.
Definition: TGMenu.cxx:1506
TGMenuTitle::~TGMenuTitle
virtual ~TGMenuTitle()
Definition: TGMenu.h:266
TGPopupMenu::DisableEntry
virtual void DisableEntry(Int_t id)
Disable entry (disabled entries appear in a sunken relieve).
Definition: TGMenu.cxx:1724
kMenuActiveMask
@ kMenuActiveMask
Definition: TGMenu.h:24
TGMenuEntry::GetType
EMenuEntryType GetType() const
Definition: TGMenu.h:87
TGMenuBar::fMenuBarMoreLayout
TGLayoutHints * fMenuBarMoreLayout
layout of the extra menu
Definition: TGMenu.h:294
TString
Basic string class.
Definition: TString.h:136
TGMenuEntry::fEh
UInt_t fEh
width and height of entry
Definition: TGMenu.h:68
TGFrame
A subclasses of TGWindow, and is used as base class for some simple widgets (buttons,...
Definition: TGFrame.h:80
TGMenuEntry::fPopup
TGPopupMenu * fPopup
pointer to popup menu (in case of cascading menus)
Definition: TGMenu.h:72
TGeant4Unit::bar
static constexpr double bar
Definition: TGeant4SystemOfUnits.h:221
TGMenuTitle::GetName
const char * GetName() const
Return unique name, used in SavePrimitive methods.
Definition: TGMenu.h:274
TGMenuEntry::GetUserData
void * GetUserData() const
Definition: TGMenu.h:96
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TGPopupMenu::GetDefaultSelectedBackgroundGC
static const TGGC & GetDefaultSelectedBackgroundGC()
Return the selection background graphics context in use.
Definition: TGMenu.cxx:1984
TGPopupMenu::UnCheckEntry
virtual void UnCheckEntry(Int_t id)
Uncheck menu entry (i.e. remove check mark).
Definition: TGMenu.cxx:1807
b
#define b(i)
Definition: RSha256.hxx:100
TGMenuEntry::fUserData
void * fUserData
pointer to user data structure
Definition: TGMenu.h:64
bool
TGPopupMenu::EndMenu
virtual Int_t EndMenu(void *&userData)
Close menu and return ID of selected menu item.
Definition: TGMenu.cxx:1289
Cursor_t
Handle_t Cursor_t
Cursor handle.
Definition: GuiTypes.h:34
TGMenuTitle::fHkeycode
Int_t fHkeycode
hot key code
Definition: TGMenu.h:242
TGMenuEntry::fPic
const TGPicture * fPic
menu entry icon
Definition: TGMenu.h:71
TGPopupMenu::fStick
Bool_t fStick
stick mode (popup menu stays sticked on screen)
Definition: TGMenu.h:119
TGPopupMenu::fMenuHeight
UInt_t fMenuHeight
height of popup menu
Definition: TGMenu.h:124
TGMenuBar::HandleButton
virtual Bool_t HandleButton(Event_t *event)
Handle a mouse button event in a menubar.
Definition: TGMenu.cxx:623
TGPopupMenu::fMenuBar
TGMenuBar * fMenuBar
menu bar (if any)
Definition: TGMenu.h:133
TGPopupMenu::Highlighted
virtual void Highlighted(Int_t id)
Definition: TGMenu.h:218
TGMenuTitle::SavePrimitive
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a title menu widget as a C++ statement(s) on output stream out.
Definition: TGMenu.cxx:2313
GContext_t
Handle_t GContext_t
Graphics context handle.
Definition: GuiTypes.h:38
TGPopupMenu::Activated
virtual void Activated(Int_t id)
Definition: TGMenu.h:219
TGMenuBar::AddPopup
virtual void AddPopup(TGHotString *s, TGPopupMenu *menu, TGLayoutHints *l, TGPopupMenu *before=0)
Add popup menu to menu bar.
Definition: TGMenu.cxx:418
TGPopupMenu::fgHilightFont
static const TGFont * fgHilightFont
Definition: TGMenu.h:138
TGMenuBar::fMenuMore
TGPopupMenu * fMenuMore
extra >> menu
Definition: TGMenu.h:293
TGMenuEntry::GetPic
const TGPicture * GetPic() const
Definition: TGMenu.h:95
TGMenuEntry::GetShortcut
TGString * GetShortcut() const
Definition: TGMenu.h:90
TGPopupMenu::GetEntrySep
UInt_t GetEntrySep() const
Definition: TGMenu.h:213
TGPopupMenu::fXl
UInt_t fXl
Max width of all menu entries.
Definition: TGMenu.h:122
TGPopupMenu::EnableEntry
virtual void EnableEntry(Int_t id)
Enable entry. By default entries are enabled.
Definition: TGMenu.cxx:1705
TGPopupMenu::fMsgWindow
const TGWindow * fMsgWindow
window which handles menu events
Definition: TGMenu.h:132
TGPopupMenu::HandleTimer
virtual Bool_t HandleTimer(TTimer *t)
If TPopupDelayTimer times out popup cascading popup menu (if it is still the current entry).
Definition: TGMenu.cxx:1467
TTimer
Handles synchronous and a-synchronous timer events.
Definition: TTimer.h:51
TGPopupMenu::GetDefaultFontStruct
static FontStruct_t GetDefaultFontStruct()
Return the default font structure in use.
Definition: TGMenu.cxx:1994
TGMenuTitle::fgDefaultFont
static const TGFont * fgDefaultFont
Definition: TGMenu.h:249
TGMenuTitle::fTitleData
void * fTitleData
user data associated with selected item
Definition: TGMenu.h:240
TGMenuTitle
This class creates a menu title.
Definition: TGMenu.h:234
TGMenuBar::fOutLayouts
TList * fOutLayouts
keeps trace of layouts of hidden menus
Definition: TGMenu.h:296
TGMenuEntry::GetEh
UInt_t GetEh() const
Definition: TGMenu.h:94
TGPopupMenu::HideEntry
virtual void HideEntry(Int_t id)
Hide entry (hidden entries are not shown in the menu).
Definition: TGMenu.cxx:1751
EMenuEntryType
EMenuEntryType
Definition: TGMenu.h:35
kMenuLabel
@ kMenuLabel
Definition: TGMenu.h:37
TGMenuTitle::GetTextColor
Pixel_t GetTextColor() const
Definition: TGMenu.h:268
TGPopupMenu::fDelay
TTimer * fDelay
delay before popping up cascading menu
Definition: TGMenu.h:125
h
#define h(i)
Definition: RSha256.hxx:106
TGPopupMenu::fDefaultCursor
Cursor_t fDefaultCursor
right pointing cursor
Definition: TGMenu.h:131
kMenuEntry
@ kMenuEntry
Definition: TGMenu.h:38
TGGC
Encapsulate a graphics context used in the low level graphics.
Definition: TGGC.h:22
TGMenuBar::fCurrent
TGMenuTitle * fCurrent
current menu title
Definition: TGMenu.h:287
kMenuEnableMask
@ kMenuEnableMask
Definition: TGMenu.h:25
TGPopupMenu::fNormGC
GContext_t fNormGC
normal drawing graphics context
Definition: TGMenu.h:126
TGMenuTitle::GetDefaultSelectedGC
static const TGGC & GetDefaultSelectedGC()
Return default selection graphics context in use.
Definition: TGMenu.cxx:2164
TGMenuTitle::fTextColor
Pixel_t fTextColor
text color
Definition: TGMenu.h:244
TGPopupMenu::DrawTrianglePattern
void DrawTrianglePattern(GContext_t gc, Int_t l, Int_t t, Int_t r, Int_t b)
Draw triangle pattern.
Definition: TGMenu.cxx:1631
TGMenuBar::PopupConnection
void PopupConnection()
Connects the corresponding cascaded menu to the proper slots, according to the highlighted menu entry...
Definition: TGMenu.cxx:289
TGPopupMenu::SetEntrySep
virtual void SetEntrySep(UInt_t sep)
Definition: TGMenu.h:214
TGPopupMenu::DrawCheckMark
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
TGFrame.h
TGMenuBar::GetTitles
virtual TList * GetTitles() const
Definition: TGMenu.h:327
TGPopupMenu::HandleMotion
virtual Bool_t HandleMotion(Event_t *event)
Handle pointer motion event in popup menu.
Definition: TGMenu.cxx:1394
TGPopupMenu::fFontStruct
FontStruct_t fFontStruct
font to draw menu entries
Definition: TGMenu.h:129
TGLayoutHints
This class describes layout hints used by the layout classes.
Definition: TGLayout.h:50
TGMenuEntry::GetStatus
virtual Int_t GetStatus() const
Definition: TGMenu.h:86
TGMenuEntry::fEntryId
Int_t fEntryId
the entry id (used for event processing)
Definition: TGMenu.h:63
TGPopupMenu::fgDefaultSelectedGC
static const TGGC * fgDefaultSelectedGC
Definition: TGMenu.h:140
BIT
#define BIT(n)
Definition: Rtypes.h:85
TGPopupMenu::fgDefaultGC
static const TGGC * fgDefaultGC
Definition: TGMenu.h:139
TGPopupMenu::PoppedDown
virtual void PoppedDown()
Definition: TGMenu.h:217
y
Double_t y[n]
Definition: legend1.C:17
TGPopupMenu::Associate
virtual void Associate(const TGWindow *w)
Definition: TGMenu.h:206
TGMenuBar::BindHotKey
virtual void BindHotKey(Int_t keycode, Bool_t on=kTRUE)
If on kTRUE bind hot keys, otherwise remove key binding.
Definition: TGMenu.cxx:383
kMenuDefaultMask
@ kMenuDefaultMask
Definition: TGMenu.h:26
TGMenuTitle::GetDefaultGC
static const TGGC & GetDefaultGC()
Return default graphics context in use.
Definition: TGMenu.cxx:2154
TGPopupMenu::fSelbackGC
GContext_t fSelbackGC
graphics context for drawing selection background
Definition: TGMenu.h:128
TGMenuTitle::SetTextColor
void SetTextColor(Pixel_t col)
Definition: TGMenu.h:269
TGMenuTitle::TGMenuTitle
TGMenuTitle(const TGMenuTitle &)=delete
TGPopupMenu::GetCurrent
virtual TGMenuEntry * GetCurrent() const
Definition: TGMenu.h:198
TGMenuBar::operator=
TGMenuBar & operator=(const TGMenuBar &)=delete
TGWidget.h
kRaisedFrame
@ kRaisedFrame
Definition: GuiTypes.h:384
TGMenuBar::fTrash
TList * fTrash
garbage
Definition: TGMenu.h:291
TGPopupMenu::DoRedraw
virtual void DoRedraw()
Draw popup menu.
Definition: TGMenu.cxx:1492
TGMenuBar::fDefaultCursor
Cursor_t fDefaultCursor
right pointing cursor
Definition: TGMenu.h:289
TGPopupMenu::CheckEntry
virtual void CheckEntry(Int_t id)
Check a menu entry (i.e. add a check mark in front of it).
Definition: TGMenu.cxx:1782
TGMenuEntry::GetEntryId
Int_t GetEntryId() const
Definition: TGMenu.h:83
TGString.h
TGMenuBar::SavePrimitive
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a menu bar widget as a C++ statement(s) on output stream out.
Definition: TGMenu.cxx:2345
unsigned int
TGMenuTitle::fMenu
TGPopupMenu * fMenu
attached popup menu
Definition: TGMenu.h:237
TGPopupMenu::IsEntryEnabled
virtual Bool_t IsEntryEnabled(Int_t id)
Return true if menu entry is enabled.
Definition: TGMenu.cxx:1736
kHorizontalFrame
@ kHorizontalFrame
Definition: GuiTypes.h:382
kMenuRadioEntryMask
@ kMenuRadioEntryMask
Definition: TGMenu.h:30
TGPopupMenu::RCheckEntry
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
TGPopupMenu::fHifontStruct
FontStruct_t fHifontStruct
font to draw highlighted entries
Definition: TGMenu.h:130
TGMenuBar::fKeyNavigate
Bool_t fKeyNavigate
kTRUE if arrow key navigation is on
Definition: TGMenu.h:292
TGMenuEntry::GetEy
Int_t GetEy() const
Definition: TGMenu.h:92
TGPopupMenu::AddPopup
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
TGPopupMenu::fHasGrab
Bool_t fHasGrab
true if menu has grabbed pointer
Definition: TGMenu.h:120
TGMenuBar::fStick
Bool_t fStick
stick mode (popup menu stays sticked on screen)
Definition: TGMenu.h:290
TGMenuTitle::fTitleId
Int_t fTitleId
id of selected menu item
Definition: TGMenu.h:239
TGPopupMenu::DeleteEntry
virtual void DeleteEntry(Int_t id)
Delete entry with specified id from menu.
Definition: TGMenu.cxx:1926
TGPopupMenu::TGPopupMenu
TGPopupMenu(const TGPopupMenu &)=delete
TGPopupMenu::DrawRCheckMark
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
kMenuRadioMask
@ kMenuRadioMask
Definition: TGMenu.h:28
TGPopupMenu::fSelGC
GContext_t fSelGC
graphics context for drawing selections
Definition: TGMenu.h:127
TGPopupMenu::DefaultEntry
virtual void DefaultEntry(Int_t id)
Set default entry (default entries are drawn with bold text).
Definition: TGMenu.cxx:1689
TGMenuEntry::~TGMenuEntry
virtual ~TGMenuEntry()
Definition: TGMenu.h:81
TGMenuEntry::GetPopup
TGPopupMenu * GetPopup() const
Definition: TGMenu.h:88
TGPopupMenu::fCurrent
TGMenuEntry * fCurrent
currently selected menu entry
Definition: TGMenu.h:118
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TGPopupMenu::fgDefaultSelectedBackgroundGC
static const TGGC * fgDefaultSelectedBackgroundGC
Definition: TGMenu.h:141
TGPopupMenu
This class creates a popup menu object.
Definition: TGMenu.h:110
Event_t
Event structure.
Definition: GuiTypes.h:174
TGPopupMenu::operator=
TGPopupMenu & operator=(const TGPopupMenu &)=delete
TGPopupMenu::GetDefaultGC
static const TGGC & GetDefaultGC()
Return default graphics context.
Definition: TGMenu.cxx:1964
TGMenuTitle::fNormGC
GContext_t fNormGC
Definition: TGMenu.h:245
TGMenuEntry::fLabel
TGHotString * fLabel
menu entry label
Definition: TGMenu.h:69
TGFrameElement
Definition: TGLayout.h:105
TGPopupMenu::Activate
virtual void Activate(Bool_t)
Definition: TGMenu.h:209
TGMenuTitle::DoSendMessage
virtual void DoSendMessage()
Send final selected menu item to be processed.
Definition: TGMenu.cxx:2131
TGPopupMenu::GetMenuBar
TGMenuBar * GetMenuBar() const
Definition: TGMenu.h:208
TGPopupMenu::GetHilightFontStruct
static FontStruct_t GetHilightFontStruct()
Return the font structure in use for highlighted menu entries.
Definition: TGMenu.cxx:2004
TGString::GetString
const char * GetString() const
Definition: TGString.h:30
TGPopupMenu::CheckEntryByData
virtual void CheckEntryByData(void *user_data)
Check a menu entry (i.e.
Definition: TGMenu.cxx:1795
TGMenuBar::Layout
virtual void Layout()
Calculates whether the >> menu must be shown or not and which menu titles are hidden.
Definition: TGMenu.cxx:193
TGMenuTitle::GetState
Bool_t GetState() const
Definition: TGMenu.h:271
TGPopupMenu::PoppedUp
virtual void PoppedUp()
Definition: TGMenu.h:216
EMenuEntryState
EMenuEntryState
Definition: TGMenu.h:23
TGMenuEntry::GetName
const char * GetName() const
Returns name of object.
Definition: TGMenu.h:84
TGPopupMenu::GetListOfEntries
const TList * GetListOfEntries() const
Definition: TGMenu.h:200
TGMenuBar
The TGMenu.h header contains all different menu classes.
Definition: TGMenu.h:282
TGSplitButton
Implements a button with added menu functionality.
Definition: TGButton.h:379
TGFont
Encapsulate fonts used in the GUI system.
Definition: TGFont.h:140
kMenuCheckedMask
@ kMenuCheckedMask
Definition: TGMenu.h:27
ROOT::Math::detail::sep
@ sep
Definition: GenVectorIO.h:35
TGPopupMenu::IsEntryHidden
virtual Bool_t IsEntryHidden(Int_t id)
Return true if menu entry is hidden.
Definition: TGMenu.cxx:1768
TGPopupMenu::GetEntry
virtual TGMenuEntry * GetEntry(Int_t id)
Find entry with specified id.
Definition: TGMenu.cxx:1897
TGMenuBar::GetPopup
virtual TGPopupMenu * GetPopup(const char *s)
Return popup menu with the specified name.
Definition: TGMenu.cxx:540
TGString
TGString wraps a TString and adds some graphics routines like drawing, size of string on screen depen...
Definition: TGString.h:20
TGMenuTitle::fgDefaultGC
static const TGGC * fgDefaultGC
Definition: TGMenu.h:251
TGMenuTitle::GetDefaultFontStruct
static FontStruct_t GetDefaultFontStruct()
Return default font structure in use.
Definition: TGMenu.cxx:2144
TGMenuEntry::fShortcut
TGString * fShortcut
menu entry shortcut
Definition: TGMenu.h:70
TGMenuTitle::GetHotKeyCode
Int_t GetHotKeyCode() const
Definition: TGMenu.h:272
TGPopupMenu::AddEntry
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
TList
A doubly linked list.
Definition: TList.h:44
TQObject::Emit
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition: TQObject.h:164
TGPopupMenu::fSplitButton
TGSplitButton * fSplitButton
split button (if any)
Definition: TGMenu.h:134
TGPopupMenu::fPoppedUp
Bool_t fPoppedUp
true if menu is currently popped up
Definition: TGMenu.h:121
int
TGMenuTitle::fSelGC
GContext_t fSelGC
normal and selection graphics contexts
Definition: TGMenu.h:245
TGMenuTitle::fState
Bool_t fState
menu title state (active/not active)
Definition: TGMenu.h:241
TGMenuBar::AddFrameBefore
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
TGMenuEntry::GetLabel
TGHotString * GetLabel() const
Definition: TGMenu.h:89