BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
BesGMenuBar.cxx
Go to the documentation of this file.
1
2#include "BesVisLib/BesGMenuBar.h"
3
5
6 //______________________________________________________________________________
7 BesGMenuBar::BesGMenuBar( const TGWindow* p, UInt_t w, UInt_t h, UInt_t options )
8 : TGMenuBar( p, w, h, options ) {}
9
10//______________________________________________________________________________
11void BesGMenuBar::AddPopup( TGHotString* s, TGPopupMenu* menu, TGLayoutHints* l,
12 TGPopupMenu* before ) {
13 // Add popup menu to menu bar. The hot string will be adopted by the
14 // menubar (actually the menu title) and deleted when possible.
15 // If before is not 0 the menu will be added before it.
16
18 Int_t keycode;
19
20 AddFrameBefore( t = new BesGMenuTitle( this, s, menu ), l, before );
21 fTitles->Add( t ); // keep track of menu titles for later cleanup in dtor
22
23 if ( ( keycode = t->GetHotKeyCode() ) != 0 ) { BindHotKey( keycode, kTRUE ); }
24}
25
26//______________________________________________________________________________
27void BesGMenuBar::AddPopup( const char* s, TGPopupMenu* menu, TGLayoutHints* l,
28 TGPopupMenu* before ) {
29 // Add popup menu to menu bar. If before is not 0 the menu will be
30 // added before it.
31
32 AddPopup( new TGHotString( s ), menu, l, before );
33}
34
35//______________________________________________________________________________
36void BesGMenuBar::AddFrameBefore( TGFrame* f, TGLayoutHints* l, TGPopupMenu* before ) {
37 // Private version of AddFrame for menubar, to make sure that we
38 // indeed only add BesGMenuTitle objects to it. If before is not 0
39 // the menu will be added before it.
40
41 if ( f->IsA() != BesGMenuTitle::Class() )
42 {
43 Error( "AddFrameBefore", "may only add BesGMenuTitle objects to a menu bar" );
44 return;
45 }
46
47 if ( !before )
48 {
49 AddFrame( f, l );
50 return;
51 }
52
53 TGFrameElement* nw;
54
55 nw = new TGFrameElement;
56 nw->fFrame = f;
57 nw->fLayout = l ? l : fgDefaultHints;
58 nw->fState = 1;
59
60 TGFrameElement* el;
61 TIter next( fList );
62 while ( ( el = (TGFrameElement*)next() ) )
63 {
64 BesGMenuTitle* t = (BesGMenuTitle*)el->fFrame;
65 if ( t->GetMenu() == before )
66 {
67 fList->AddBefore( el, nw );
68 return;
69 }
70 }
71 fList->Add( nw );
72}
73
74//______________________________________________________________________________
76 if ( i >= 0 && i < fTitles->GetSize() ) return (BesGMenuTitle*)fTitles->At( i );
77 else return 0;
78}
ClassImp(BesGMenuBar) BesGMenuBar
TFile f("ana_bhabha660a_dqa_mcPat_zy_old.root")
double w
XmlRpcServer s
BesGMenuBar(const TGWindow *p=0, UInt_t w=60, UInt_t h=20, UInt_t options=kHorizontalFrame|kRaisedFrame)
BesGMenuTitle * GetMenuTitle(Int_t i)
virtual void AddPopup(TGHotString *s, TGPopupMenu *menu, TGLayoutHints *l, TGPopupMenu *before=0)
virtual void AddFrameBefore(TGFrame *f, TGLayoutHints *l=0, TGPopupMenu *before=0)
int t()
Definition t.c:1