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