library: libGui
#include "TGMenu.h"

TGPopupMenu


class description - source file - inheritance tree (.pdf)

class TGPopupMenu : public TGFrame

Inheritance Chart:
TObject
<-
TGObject
<-
TGWindow
TQObject
<-
TGFrame
<-
TGPopupMenu
<-
TRootContextMenu

    protected:
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) static FontStruct_t GetDefaultFontStruct() static const TGGC& GetDefaultGC() const static const TGGC& GetDefaultSelectedBackgroundGC() const static const TGGC& GetDefaultSelectedGC() const static FontStruct_t GetHilightFontStruct() virtual void Reposition() public:
TGPopupMenu(const TGWindow* p = 0, UInt_t w = 10, UInt_t h = 10, UInt_t options = 0) TGPopupMenu(const TGPopupMenu&) virtual ~TGPopupMenu() virtual void Activate(Bool_t) virtual void Activate(TGMenuEntry* entry) virtual void Activated(Int_t id) virtual void AddEntry(TGHotString* s, Int_t id, void* ud = 0, const TGPicture* p = 0, TGMenuEntry* before = 0) virtual void AddEntry(const char* s, Int_t id, void* ud = 0, const TGPicture* p = 0, TGMenuEntry* before = 0) virtual void AddLabel(TGHotString* s, const TGPicture* p = 0, TGMenuEntry* before = 0) virtual void AddLabel(const char* s, const TGPicture* p = 0, TGMenuEntry* before = 0) virtual void AddPopup(TGHotString* s, TGPopupMenu* popup, TGMenuEntry* before = 0) virtual void AddPopup(const char* s, TGPopupMenu* popup, TGMenuEntry* before = 0) virtual void AddSeparator(TGMenuEntry* before = 0) virtual void Associate(const TGWindow* w) virtual void CheckEntry(Int_t id) static TClass* Class() virtual void DefaultEntry(Int_t id) virtual void DeleteEntry(Int_t id) virtual void DeleteEntry(TGMenuEntry* entry) virtual void DisableEntry(Int_t id) virtual void DrawBorder() virtual void EnableEntry(Int_t id) virtual Int_t EndMenu(void*& userData) virtual TGMenuEntry* GetCurrent() const virtual TGMenuEntry* GetEntry(Int_t id) virtual TGMenuEntry* GetEntry(const char* s) const TList* GetListOfEntries() const TGMenuBar* GetMenuBar() 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) virtual void HideEntry(Int_t id) virtual void Highlighted(Int_t id) virtual TClass* IsA() const virtual Bool_t IsEntryChecked(Int_t id) virtual Bool_t IsEntryEnabled(Int_t id) virtual Bool_t IsEntryHidden(Int_t id) virtual Bool_t IsEntryRChecked(Int_t id) virtual void PlaceMenu(Int_t x, Int_t y, Bool_t stick_mode, Bool_t grab_pointer) virtual void PoppedDown() virtual void PoppedUp() virtual void RCheckEntry(Int_t id, Int_t IDfirst, Int_t IDlast) virtual void SavePrimitive(ofstream& out, Option_t* option) virtual void SetMenuBar(TGMenuBar* bar) virtual void ShowMembers(TMemberInspector& insp, char* parent) virtual void Streamer(TBuffer& b) void StreamerNVirtual(TBuffer& b) virtual void UnCheckEntry(Int_t id)

Data Members


    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 Bool_t fPoppedUp true if menu is currently popped up UInt_t fXl Max width of all menu entries UInt_t fMenuWidth width of popup menu UInt_t fMenuHeight 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 Cursor_t fDefaultCursor right pointing cursor const TGWindow* fMsgWindow window which handles menu events TGMenuBar* fMenuBar menu bar (if any) static const TGFont* fgDefaultFont static const TGFont* fgHilightFont static const TGGC* fgDefaultGC static const TGGC* fgDefaultSelectedGC static const TGGC* fgDefaultSelectedBackgroundGC

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, 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, independent 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.

const TGGC& GetDefaultGC()

const TGGC& GetDefaultSelectedGC()

const TGGC& GetDefaultSelectedBackgroundGC()

FontStruct_t GetDefaultFontStruct()

FontStruct_t GetHilightFontStruct()

void SavePrimitive(ofstream &out, Option_t *option)
 Save a popup menu widget as a C++ statement(s) on output stream out.



Inline Functions


        TGMenuEntry* GetCurrent() const
        const TList* GetListOfEntries() const
                void Associate(const TGWindow* w)
                void SetMenuBar(TGMenuBar* bar)
          TGMenuBar* GetMenuBar() const
                void PoppedUp()
                void PoppedDown()
                void Highlighted(Int_t id)
                void Activated(Int_t id)
                void Activate(TGMenuEntry* entry)
             TClass* Class()
             TClass* IsA() const
                void ShowMembers(TMemberInspector& insp, char* parent)
                void Streamer(TBuffer& b)
                void StreamerNVirtual(TBuffer& b)
         TGPopupMenu TGPopupMenu(const TGPopupMenu&)


Author: Fons Rademakers 09/01/98
Last update: root/gui:$Name: $:$Id: TGMenu.cxx,v 1.57 2005/09/05 13:33:08 rdm Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *


ROOT page - Class index - Class Hierarchy - 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.