TGPopupMenu


class description - source file - inheritance tree

class TGPopupMenu : public TGFrame

    private:
protected:
virtual void Activate(TGMenuEntry* entry) virtual void DoRedraw() void DrawCheckMark(GContext_t gc, Int_t l, Int_t t, Int_t r, Int_t b) virtual void DrawEntry(TGMenuEntry* entry) void DrawRCheckMark(GContext_t gc, Int_t l, Int_t t, Int_t r, Int_t b) void DrawTrianglePattern(GContext_t gc, Int_t l, Int_t t, Int_t r, Int_t b) virtual void Reposition() public:
TGPopupMenu TGPopupMenu(const TGWindow* p = 0, UInt_t w = 10, UInt_t h = 10, UInt_t options = 0) TGPopupMenu TGPopupMenu(TGPopupMenu&) virtual void ~TGPopupMenu() virtual void Activated(Int_t id) void AddEntry(TGHotString* s, Int_t id, void* ud = 0, const TGPicture* p = 0, TGMenuEntry* before = 0) void AddEntry(const char* s, Int_t id, void* ud = 0, const TGPicture* p = 0, TGMenuEntry* before = 0) void AddLabel(TGHotString* s, const TGPicture* p = 0, TGMenuEntry* before = 0) void AddLabel(const char* s, const TGPicture* p = 0, TGMenuEntry* before = 0) void AddPopup(TGHotString* s, TGPopupMenu* popup, TGMenuEntry* before = 0) void AddPopup(const char* s, TGPopupMenu* popup, TGMenuEntry* before = 0) void AddSeparator(TGMenuEntry* before = 0) virtual void Associate(const TGWindow* w) void CheckEntry(Int_t id) static TClass* Class() void DefaultEntry(Int_t id) void DeleteEntry(Int_t id) void DeleteEntry(TGMenuEntry* entry) void DisableEntry(Int_t id) virtual void DrawBorder() void EnableEntry(Int_t id) Int_t EndMenu(void*& userData) TGMenuEntry* GetEntry(Int_t id) TGMenuEntry* GetEntry(const char* s) const TList* GetListOfEntries() const virtual Bool_t HandleButton(Event_t* event) virtual Bool_t HandleCrossing(Event_t* event) virtual Bool_t HandleMotion(Event_t* event) virtual Bool_t HandleTimer(TTimer* t) void HideEntry(Int_t id) virtual void Highlighted(Int_t id) virtual TClass* IsA() const Bool_t IsEntryChecked(Int_t id) Bool_t IsEntryEnabled(Int_t id) Bool_t IsEntryHidden(Int_t id) Bool_t IsEntryRChecked(Int_t id) void PlaceMenu(Int_t x, Int_t y, Bool_t stick_mode, Bool_t grab_pointer) void RCheckEntry(Int_t id, Int_t IDfirst, Int_t IDlast) virtual void ShowMembers(TMemberInspector& insp, char* parent) virtual void Streamer(TBuffer& b) void StreamerNVirtual(TBuffer& b) void UnCheckEntry(Int_t id)

Data Members

    private:
protected:
TList* fEntryList list of menu entries TGMenuEntry* fCurrent currently selected menu entry Bool_t fStick stick mode (popup menu stays sticked on screen) Bool_t fHasGrab true if menu has grabbed pointer UInt_t fXl Max width of all menu entries UInt_t fWidth width of popup menu UInt_t fHeight height of popup menu TTimer* fDelay delay before poping up cascading menu GContext_t fNormGC normal drawing graphics context GContext_t fSelGC graphics context for drawing selections GContext_t fSelbackGC graphics context for drawing selection background FontStruct_t fFontStruct font to draw menu entries FontStruct_t fHifontStruct font to draw highlighted entries const TGWindow* fMsgWindow window which handles menu events static TGGC fgDefaultGC static TGGC fgDefaultSelectedGC static TGGC fgDefaultSelectedBackgroundGC static FontStruct_t fgDefaultFontStruct static FontStruct_t fgHilightFontStruct static Cursor_t fgDefaultCursor static Pixmap_t fgCheckmark static Pixmap_t fgRadiomark public:


See also

TRootContextMenu

Class Description

                                                                      
 TGMenuBar, TGPopupMenu, TGMenuTitle and TGMenuEntry                  
                                                                      
 This header contains all different menu classes.                     
                                                                      
 Selecting a menu item will generate the event:                       
 kC_COMMAND, kCM_MENU, menu id, user data.                            
                                                                      


TGPopupMenu(const TGWindow *p, UInt_t w, UInt_t h, UInt_t options) : TGFrame(p ? p : gClient->GetRoot(), w, h, options | kOwnBackground)
 Create a popup menu.

~TGPopupMenu()
 Delete a popup menu.

void AddEntry(TGHotString *s, Int_t id, void *ud, const TGPicture *p, TGMenuEntry *before)
 Add a menu entry. The hotstring is adopted by the menu (actually by
 the TGMenuEntry) and deleted when possible. A possible picture is
 borrowed from the picture pool and therefore not adopted.
 If before is not 0, the entry will be added before it.

void AddEntry(const char *s, Int_t id, void *ud, const TGPicture *p, TGMenuEntry *before)
 Add a menu entry. The string s in not adopted.
 If before is not 0, the entry will be added before it.

void AddSeparator(TGMenuEntry *before)
 Add a menu separator to the menu.
 If before is not 0, the entry will be added before it.

void AddLabel(TGHotString *s, const TGPicture *p, TGMenuEntry *before)
 Add a menu label to the menu. The hotstring is adopted by the menu
 (actually by the TGMenuEntry) and deleted when possible. A possible
 picture is borrowed from the picture pool and therefore not adopted.
 If before is not 0, the entry will be added before it.

void AddLabel(const char *s, const TGPicture *p, TGMenuEntry *before)
 Add a menu label to the menu. The string s in not adopted.
 If before is not 0, the entry will be added before it.

void AddPopup(TGHotString *s, TGPopupMenu *popup, TGMenuEntry *before)
 Add a (cascading) popup menu to a popup menu. The hotstring is adopted
 by the menu (actually by the TGMenuEntry) and deleted when possible.
 If before is not 0, the entry will be added before it.

void AddPopup(const char *s, TGPopupMenu *popup, TGMenuEntry *before)
 Add a (cascading) popup menu to a popup menu. The string s is not
 adopted. If before is not 0, the entry will be added before it.

void Reposition()
 Reposition entries in popup menu. Called after menu item has been
 hidden or removed or inserted at a specified location.

void PlaceMenu(Int_t x, Int_t y, Bool_t stick_mode, Bool_t grab_pointer)
 Popup a popup menu. If stick mode is true keep the menu up. If
 grab_pointer is true the pointer will be grabbed, which means that
 all pointer events will go to the popup menu, idependent of in
 which window the pointer is.

Int_t EndMenu(void *&userData)
 Close menu and return ID of selected menu item.
 In case of cascading menus, recursively close all menus.

Bool_t HandleButton(Event_t *event)
 Handle button event in the popup menu.

Bool_t HandleCrossing(Event_t *event)
 Handle pointer crossing event in popup menu.

Bool_t HandleMotion(Event_t *event)
 Handle pointer motion event in popup menu.

void Activate(TGMenuEntry *entry)
 Activate a menu entry in a popup menu.

Bool_t HandleTimer(TTimer *)
 If TPopupDelayTimer times out popup cascading popup menu (if it is
 still the current entry).

void DoRedraw()
 Draw popup menu.

void DrawEntry(TGMenuEntry *entry)
 Draw popup menu entry.

void DrawBorder()
 Draw border round popup menu.

void DrawTrianglePattern(GContext_t gc, Int_t l, Int_t t, Int_t r, Int_t b)
 Draw triangle pattern. Used for menu entries that are of type
 kMenuPopup (i.e. cascading menus).

void DrawCheckMark(GContext_t gc, Int_t l, Int_t t, Int_t, Int_t b)
 Draw check mark. Used for checked button type menu entries.

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.

void DefaultEntry(Int_t id)
 Set default entry (default entries are drawn with bold text).

void EnableEntry(Int_t id)
 Enable entry. By default entries are enabled.

void DisableEntry(Int_t id)
 Disable entry (disabled entries appear in a sunken relieve).

Bool_t IsEntryEnabled(Int_t id)
 Return true if menu entry is enabled.

void HideEntry(Int_t id)
 Hide entry (hidden entries are not shown in the menu).
 To enable a hidden entry call EnableEntry().

Bool_t IsEntryHidden(Int_t id)
 Return true if menu entry is hidden.

void CheckEntry(Int_t id)
 Check a menu entry (i.e. add a check mark in front of it).

void UnCheckEntry(Int_t id)
 Uncheck menu entry (i.e. remove check mark).

Bool_t IsEntryChecked(Int_t id)
 Return true if menu item is checked.

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 instead).

Bool_t IsEntryRChecked(Int_t id)
 Return true if menu item has radio check mark.

TGMenuEntry* GetEntry(Int_t id)
 Find entry with specified id. Use the returned entry in DeleteEntry()
 or as the "before" item in the AddXXXX() methods. Returns 0 if entry
 is not found. To find entries that don't have an id like the separators,
 use the GetListOfEntries() method to get the complete entry
 list and iterate over it and check the type of each entry
 to find the separators.

TGMenuEntry* GetEntry(const char *s)
 Find entry with specified name. Name must match the original
 name without hot key symbol, like "Print" and not "&Print".
 Use the returned entry in DeleteEntry() or as the "before" item
 in the AddXXXX() methods. Returns 0 if entry is not found.
 To find entries that don't have a name like the separators,
 use the GetListOfEntries() method to get the complete entry
 list and iterate over it and check the type of each entry
 to find the separators.

void DeleteEntry(Int_t id)
 Delete entry with specified id from menu.

void DeleteEntry(TGMenuEntry *entry)
 Delete specified entry from menu.



Inline Functions


        const TList* GetListOfEntries() const
                void Associate(const TGWindow* w)
                void Highlighted(Int_t id)
                void Activated(Int_t id)
             TClass* Class()
             TClass* IsA() const
                void ShowMembers(TMemberInspector& insp, char* parent)
                void Streamer(TBuffer& b)
                void StreamerNVirtual(TBuffer& b)
         TGPopupMenu TGPopupMenu(TGPopupMenu&)


Author: Fons Rademakers 09/01/98
Last update: root/gui:$Name: $:$Id: TGMenu.cxx,v 1.5 2001/11/18 17:25:25 rdm Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *


ROOT page - Class index - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.