#include <BesGMenuBar.h>
Public Member Functions | |
BesGMenuBar (const TGWindow *p=0, UInt_t w=60, UInt_t h=20, UInt_t options=kHorizontalFrame|kRaisedFrame) | |
virtual void | AddPopup (TGHotString *s, TGPopupMenu *menu, TGLayoutHints *l, TGPopupMenu *before=0) |
virtual void | AddPopup (const char *s, TGPopupMenu *menu, TGLayoutHints *l, TGPopupMenu *before=0) |
BesGMenuTitle * | GetMenuTitle (Int_t i) |
Protected Member Functions | |
virtual void | AddFrameBefore (TGFrame *f, TGLayoutHints *l=0, TGPopupMenu *before=0) |
Definition at line 8 of file BesGMenuBar.h.
BesGMenuBar::BesGMenuBar | ( | const TGWindow * | p = 0 , |
|
UInt_t | w = 60 , |
|||
UInt_t | h = 20 , |
|||
UInt_t | options = kHorizontalFrame|kRaisedFrame | |||
) |
void BesGMenuBar::AddFrameBefore | ( | TGFrame * | f, | |
TGLayoutHints * | l = 0 , |
|||
TGPopupMenu * | before = 0 | |||
) | [protected, virtual] |
Definition at line 43 of file BesGMenuBar.cxx.
References if(), next, and t().
Referenced by AddPopup().
00045 { 00046 // Private version of AddFrame for menubar, to make sure that we 00047 // indeed only add BesGMenuTitle objects to it. If before is not 0 00048 // the menu will be added before it. 00049 00050 if (f->IsA() != BesGMenuTitle::Class()) { 00051 Error("AddFrameBefore", "may only add BesGMenuTitle objects to a menu bar"); 00052 return; 00053 } 00054 00055 if (!before) { 00056 AddFrame(f, l); 00057 return; 00058 } 00059 00060 TGFrameElement *nw; 00061 00062 nw = new TGFrameElement; 00063 nw->fFrame = f; 00064 nw->fLayout = l ? l : fgDefaultHints; 00065 nw->fState = 1; 00066 00067 TGFrameElement *el; 00068 TIter next(fList); 00069 while ((el = (TGFrameElement *) next())) { 00070 BesGMenuTitle *t = (BesGMenuTitle *) el->fFrame; 00071 if (t->GetMenu() == before) { 00072 fList->AddBefore(el, nw); 00073 return; 00074 } 00075 } 00076 fList->Add(nw); 00077 }
void BesGMenuBar::AddPopup | ( | const char * | s, | |
TGPopupMenu * | menu, | |||
TGLayoutHints * | l, | |||
TGPopupMenu * | before = 0 | |||
) | [virtual] |
Definition at line 33 of file BesGMenuBar.cxx.
References AddPopup().
00035 { 00036 // Add popup menu to menu bar. If before is not 0 the menu will be 00037 // added before it. 00038 00039 AddPopup(new TGHotString(s), menu, l, before); 00040 }
void BesGMenuBar::AddPopup | ( | TGHotString * | s, | |
TGPopupMenu * | menu, | |||
TGLayoutHints * | l, | |||
TGPopupMenu * | before = 0 | |||
) | [virtual] |
Definition at line 14 of file BesGMenuBar.cxx.
References AddFrameBefore(), and t().
Referenced by AddPopup(), and BesClient::CreateMenuBar().
00016 { 00017 // Add popup menu to menu bar. The hot string will be adopted by the 00018 // menubar (actually the menu title) and deleted when possible. 00019 // If before is not 0 the menu will be added before it. 00020 00021 BesGMenuTitle *t; 00022 Int_t keycode; 00023 00024 AddFrameBefore(t = new BesGMenuTitle(this, s, menu), l, before); 00025 fTitles->Add(t); // keep track of menu titles for later cleanup in dtor 00026 00027 if ((keycode = t->GetHotKeyCode()) != 0) { 00028 BindHotKey(keycode, kTRUE); 00029 } 00030 }
BesGMenuTitle * BesGMenuBar::GetMenuTitle | ( | Int_t | i | ) |
Definition at line 80 of file BesGMenuBar.cxx.
Referenced by BesClient::CreateMenuBar().
00081 { 00082 if (i >= 0 && i < fTitles->GetSize()) return (BesGMenuTitle*)fTitles->At(i); 00083 else return 0; 00084 }