Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
evdb::DisplayWindow Class Reference

An event display window. More...

#include <DisplayWindow.h>

Public Member Functions

 DisplayWindow (int window=0)
 
virtual ~DisplayWindow ()
 
virtual void Draw (const char *opt="")
 
virtual void CloseWindow ()
 
void Raise ()
 
void SetRunEvent (int run, int event)
 
void SetServices ()
 

Static Public Member Functions

static void Register (const char *name, const char *description, unsigned int h, unsigned int w, CanvasCreator_t creator)
 
static const std::vector< std::string > & Names ()
 
static int OpenWindow (int type=0)
 
static void SetRunEventAll (int run, int event)
 
static void SetServicesAll ()
 
static void DrawAll (const char *opt=0)
 

Private Attributes

TGMainFrame * fMain
 Main window. More...
 
MenuBarfMenuBar
 Top menu bar. More...
 
ButtonBarfButtonBar
 Top button bar. More...
 
StatusBarfStatusBar
 Status bar running along the bottom. More...
 
CanvasfDisplay
 Display of detector event information. More...
 

Detailed Description

An event display window.

Definition at line 33 of file DisplayWindow.h.

Constructor & Destructor Documentation

evdb::DisplayWindow::DisplayWindow ( int  window = 0)

Definition at line 142 of file DisplayWindow.cxx.

143  {
144  if(gROOT->IsBatch())
145  throw cet::exception("DisplayWindow") << "ROOT is in batch mode"
146  << " cannot open DisplayWindow";
147  if(!gClient)
148  throw cet::exception("DisplayWindow") << "No ROOT global TClient";
149 
150  const TGWindow* tgw = gClient->GetRoot();
151  if(!tgw)
152  throw cet::exception("DisplayWindow") << "No TGWindow pointer";
153 
154  // Create the main application window. I need a resize to get the
155  // window to draw the first time, so create the window slightly
156  // smaller than the intended size. Bogus, but so it goes...
157  unsigned int w = gsWidth[id];
158  unsigned int h = gsHeight[id];
159  fMain = new TGMainFrame(tgw, w-1, h-1);
160 
161  // Add items to the main window
162  fMenuBar = new MenuBar(fMain);
163  fButtonBar = new ButtonBar(fMain);
164  fDisplay = (*gsCanvasCreator[id])(fMain);
165  fStatusBar = new StatusBar(fMain);
166 
167  fMain->SetWindowName(gsName[id].c_str());
168 
169  // Now that all the subwindows are attached, do the final layout
170  fMain->MapSubwindows();
171  fMain->MapWindow();
172 
173  // Don't understand this, but I need a resize to get things to draw
174  // the first time...
175  fMain->Resize(w,h);
176 
177  // Plug the display into its signal/slots
178  fDisplay->Connect();
179 
180  fMain->Connect("CloseWindow()","evdb::DisplayWindow",this,"CloseWindow()");
181 
182  // Add to list of windows open
183  gsWindows[id] = this;
184  }
MenuBar * fMenuBar
Top menu bar.
Definition: DisplayWindow.h:60
void Connect()
Make signal/slot connections.
Definition: Canvas.cxx:68
static std::vector< DisplayWindow * > gsWindows(64)
ButtonBar * fButtonBar
Top button bar.
Definition: DisplayWindow.h:61
static std::vector< unsigned int > gsWidth
static std::vector< CanvasCreator_t > gsCanvasCreator
StatusBar * fStatusBar
Status bar running along the bottom.
Definition: DisplayWindow.h:62
Canvas * fDisplay
Display of detector event information.
Definition: DisplayWindow.h:63
static std::vector< std::string > gsName
TGMainFrame * fMain
Main window.
Definition: DisplayWindow.h:59
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
static std::vector< unsigned int > gsHeight
h
training ###############################
Definition: train_cnn.py:186
evdb::DisplayWindow::~DisplayWindow ( )
virtual

Definition at line 196 of file DisplayWindow.cxx.

197  {
198  if (fDisplay) { delete fDisplay; fDisplay = 0; }
199  if (fStatusBar) { delete fStatusBar; fStatusBar = 0; }
200  if (fButtonBar) { delete fButtonBar; fButtonBar = 0; }
201  if (fMenuBar) { delete fMenuBar; fMenuBar = 0; }
202  if (fMain) { delete fMain; fMain = 0; }
203  for (unsigned int i=0; i<gsWindows.size(); ++i) {
204  if (gsWindows[i] == this) gsWindows[i] = 0;
205  }
206  }
MenuBar * fMenuBar
Top menu bar.
Definition: DisplayWindow.h:60
static std::vector< DisplayWindow * > gsWindows(64)
ButtonBar * fButtonBar
Top button bar.
Definition: DisplayWindow.h:61
StatusBar * fStatusBar
Status bar running along the bottom.
Definition: DisplayWindow.h:62
Canvas * fDisplay
Display of detector event information.
Definition: DisplayWindow.h:63
TGMainFrame * fMain
Main window.
Definition: DisplayWindow.h:59

Member Function Documentation

void evdb::DisplayWindow::CloseWindow ( )
virtual

Definition at line 192 of file DisplayWindow.cxx.

192 { delete this; }
void evdb::DisplayWindow::Draw ( const char *  opt = "")
virtual

Definition at line 188 of file DisplayWindow.cxx.

188 { fDisplay->Draw(opt); }
opt
Definition: train.py:196
Canvas * fDisplay
Display of detector event information.
Definition: DisplayWindow.h:63
virtual void Draw(const char *opt=0)=0
void evdb::DisplayWindow::DrawAll ( const char *  opt = 0)
static

Definition at line 57 of file DisplayWindow.cxx.

58  {
59  for (size_t i=0; i<gsWindows.size(); ++i) {
60  if (gsWindows[i]!=0) gsWindows[i]->Draw(opt);
61  }
62  }
static std::vector< DisplayWindow * > gsWindows(64)
opt
Definition: train.py:196
const std::vector< std::string > & evdb::DisplayWindow::Names ( )
static

Definition at line 89 of file DisplayWindow.cxx.

89 { return gsName; }
static std::vector< std::string > gsName
int evdb::DisplayWindow::OpenWindow ( int  type = 0)
static

Create a window given a system-assigned ID number

Definition at line 116 of file DisplayWindow.cxx.

117  {
118  unsigned id = 0;
119  if (type>0) id = type;
120  if (id>=gsName.size()) return 0;
121 
122  DisplayWindow* w = gsWindows[id];
123  if (w==0) {
124  w = gsWindows[id] = new DisplayWindow(id);
125  }
126  if (w==0) return 0;
127 
128  // Update run and event number in newly opened window.
130  if(evt)
131  w->SetRunEvent(evt->id().run(), evt->id().event());
132 
133  w->Raise();
134  w->Draw();
135 
136  return 1;
137  }
const art::Event * GetEvent() const
Definition: EventHolder.cxx:45
static std::vector< DisplayWindow * > gsWindows(64)
RunNumber_t run() const
Definition: EventID.h:98
static EventHolder * Instance()
Definition: EventHolder.cxx:15
static std::vector< std::string > gsName
static QCString type
Definition: declinfo.cpp:672
EventNumber_t event() const
Definition: EventID.h:116
DisplayWindow(int window=0)
TCEvent evt
Definition: DataStructs.cxx:7
EventID id() const
Definition: Event.cc:37
void evdb::DisplayWindow::Raise ( )

Definition at line 210 of file DisplayWindow.cxx.

210 { fMain->RaiseWindow(); }
TGMainFrame * fMain
Main window.
Definition: DisplayWindow.h:59
void evdb::DisplayWindow::Register ( const char *  name,
const char *  description,
unsigned int  h,
unsigned int  w,
CanvasCreator_t  creator 
)
static

Register a display canvas for use in creating windows

Definition at line 96 of file DisplayWindow.cxx.

101  {
102  gsName.push_back(std::string(name));
103  gsDescription.push_back(std::string(description));
104  gsHeight.push_back(h);
105  gsWidth.push_back(w);
106  gsCanvasCreator.push_back(creator);
107 
108  if (gsName.size()>gsWindows.size()) gsWindows.resize(gsName.size());
109  }
static QCString name
Definition: declinfo.cpp:673
static std::vector< DisplayWindow * > gsWindows(64)
std::string string
Definition: nybbler.cc:12
static std::vector< unsigned int > gsWidth
static std::vector< CanvasCreator_t > gsCanvasCreator
static std::vector< std::string > gsName
static std::vector< std::string > gsDescription
static std::vector< unsigned int > gsHeight
h
training ###############################
Definition: train_cnn.py:186
void evdb::DisplayWindow::SetRunEvent ( int  run,
int  event 
)

Definition at line 66 of file DisplayWindow.cxx.

67  {
69  }
ButtonBar * fButtonBar
Top button bar.
Definition: DisplayWindow.h:61
void SetRunEvent(int run, int event)
Definition: ButtonBar.cxx:229
Event finding and building.
unsigned int run
void evdb::DisplayWindow::SetRunEventAll ( int  run,
int  event 
)
static

Definition at line 48 of file DisplayWindow.cxx.

49  {
50  for (size_t i=0; i<gsWindows.size(); ++i) {
51  if (gsWindows[i]!=0) gsWindows[i]->SetRunEvent(run, event);
52  }
53  }
static std::vector< DisplayWindow * > gsWindows(64)
Event finding and building.
unsigned int run
void evdb::DisplayWindow::SetServices ( )

Definition at line 82 of file DisplayWindow.cxx.

83  {
85  }
MenuBar * fMenuBar
Top menu bar.
Definition: DisplayWindow.h:60
void SetServices()
Definition: EditMenu.cxx:51
EditMenu * fEditMenu
Edit menu.
Definition: MenuBar.h:36
void evdb::DisplayWindow::SetServicesAll ( )
static

Definition at line 73 of file DisplayWindow.cxx.

74  {
75  for (size_t i=0; i<gsWindows.size(); ++i) {
76  if (gsWindows[i]!=0) gsWindows[i]->SetServices();
77  }
78  }
static std::vector< DisplayWindow * > gsWindows(64)

Member Data Documentation

ButtonBar* evdb::DisplayWindow::fButtonBar
private

Top button bar.

Definition at line 61 of file DisplayWindow.h.

Canvas* evdb::DisplayWindow::fDisplay
private

Display of detector event information.

Definition at line 63 of file DisplayWindow.h.

TGMainFrame* evdb::DisplayWindow::fMain
private

Main window.

Definition at line 59 of file DisplayWindow.h.

MenuBar* evdb::DisplayWindow::fMenuBar
private

Top menu bar.

Definition at line 60 of file DisplayWindow.h.

StatusBar* evdb::DisplayWindow::fStatusBar
private

Status bar running along the bottom.

Definition at line 62 of file DisplayWindow.h.


The documentation for this class was generated from the following files: