LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
evdb::ListWindow Class Reference

An event display window. More...

#include "ListWindow.h"

Public Member Functions

 ListWindow (int window=0)
 
virtual ~ListWindow ()
 
virtual void Draw (const char *opt="")
 
virtual void CloseWindow ()
 
void Raise ()
 

Static Public Member Functions

static void Register (const char *name, const char *description, unsigned int h, unsigned int w, ObjListCanvasCreator_t creator)
 
static const std::vector< std::string > & Names ()
 
static int OpenWindow (int type=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...
 
ObjListCanvasfDisplay
 Display of detector event information. More...
 

Detailed Description

An event display window.

Definition at line 28 of file ListWindow.h.

Constructor & Destructor Documentation

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

Definition at line 92 of file ListWindow.cxx.

References evdb::ObjListCanvas::Connect(), fButtonBar, fDisplay, fMain, fMenuBar, fStatusBar, evdb::gsWindows(), and w.

Referenced by OpenWindow().

93  {
94  if (gROOT->IsBatch()) assert(0);
95  assert(gClient);
96  const TGWindow* tgw = gClient->GetRoot();
97  assert(tgw);
98 
99  // Create the main application window. I need a resize to get the
100  // window to draw the first time, so create the window slightly
101  // smaller than the intended size. Bogus, but so it goes...
102  unsigned int w = gsWidth[id];
103  unsigned int h = gsHeight[id];
104  fMain = new TGMainFrame(tgw, w-1, h-1);
105 
106  // Add items to the main window
107  fMenuBar = new MenuBar(fMain);
108  fButtonBar = new ButtonBar(fMain);
109 
111  fStatusBar = new StatusBar(fMain);
112 
113  fMain->SetWindowName(gsName[id].c_str());
114 
115  // Now that all the subwindows are attached, do the final layout
116  fMain->MapSubwindows();
117  fMain->MapWindow();
118 
119  // Don't understand this, but I need a resize to get things to draw
120  // the first time...
121  fMain->Resize(w,h);
122 
123  // Plug the display into its signal/slots
124  fDisplay->Connect();
125 
126  // fMain->Connect("CloseWindow()","evdb::ListWindow",this,"CloseWindow()");
127 
128  // Add to list of windows open
129  gsWindows[id] = this;
130 
131  }
MenuBar * fMenuBar
Top menu bar.
Definition: ListWindow.h:49
ButtonBar * fButtonBar
Top button bar.
Definition: ListWindow.h:50
static std::vector< DisplayWindow * > gsWindows(64)
static std::vector< unsigned int > gsWidth
void Connect()
Make signal/slot connections.
static std::vector< std::string > gsName
static std::vector< ObjListCanvasCreator_t > gsObjListCanvasCreator
Definition: ListWindow.cxx:42
TGMainFrame * fMain
Main window.
Definition: ListWindow.h:48
StatusBar * fStatusBar
Status bar running along the bottom.
Definition: ListWindow.h:51
Float_t w
Definition: plot.C:20
static std::vector< unsigned int > gsHeight
ObjListCanvas * fDisplay
Display of detector event information.
Definition: ListWindow.h:52
evdb::ListWindow::~ListWindow ( )
virtual

Definition at line 143 of file ListWindow.cxx.

References fButtonBar, fDisplay, fMain, fMenuBar, fStatusBar, and evdb::gsWindows().

144  {
145  if (fDisplay) { delete fDisplay; fDisplay = 0; }
146  if (fStatusBar) { delete fStatusBar; fStatusBar = 0; }
147  if (fButtonBar) { delete fButtonBar; fButtonBar = 0; }
148  if (fMenuBar) { delete fMenuBar; fMenuBar = 0; }
149  if (fMain) { delete fMain; fMain = 0; }
150  for (unsigned int i=0; i<gsWindows.size(); ++i) {
151  if (gsWindows[i] == this) gsWindows[i] = 0;
152  }
153  }
MenuBar * fMenuBar
Top menu bar.
Definition: ListWindow.h:49
ButtonBar * fButtonBar
Top button bar.
Definition: ListWindow.h:50
static std::vector< DisplayWindow * > gsWindows(64)
TGMainFrame * fMain
Main window.
Definition: ListWindow.h:48
StatusBar * fStatusBar
Status bar running along the bottom.
Definition: ListWindow.h:51
ObjListCanvas * fDisplay
Display of detector event information.
Definition: ListWindow.h:52

Member Function Documentation

void evdb::ListWindow::CloseWindow ( )
virtual

Definition at line 139 of file ListWindow.cxx.

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

Definition at line 135 of file ListWindow.cxx.

References evdb::ObjListCanvas::Draw(), and fDisplay.

Referenced by OpenWindow().

135 { fDisplay->Draw(opt); }
virtual void Draw(const char *opt=0)=0
ObjListCanvas * fDisplay
Display of detector event information.
Definition: ListWindow.h:52
const std::vector< std::string > & evdb::ListWindow::Names ( )
static

Definition at line 46 of file ListWindow.cxx.

References evdb::gsName.

Referenced by evdb::WindowMenu::WindowMenu().

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

Create a window given a system-assigned ID number

Definition at line 73 of file ListWindow.cxx.

References Draw(), evdb::gsWindows(), ListWindow(), Raise(), and w.

74  {
75  unsigned id = 0;
76  if (type>0) id = type;
77  if (id>=gsName.size()) return 0;
78 
79  ListWindow* w = gsWindows[id];
80  if (w==0) {
81  w = gsWindows[id] = new ListWindow(id);
82  }
83  if (w==0) return 0;
84  w->Raise();
85  w->Draw();
86 
87  return 1;
88  }
static std::vector< DisplayWindow * > gsWindows(64)
ListWindow(int window=0)
Definition: ListWindow.cxx:92
static std::vector< std::string > gsName
Float_t w
Definition: plot.C:20
void evdb::ListWindow::Raise ( )

Definition at line 157 of file ListWindow.cxx.

References fMain.

Referenced by OpenWindow().

157 { fMain->RaiseWindow(); }
TGMainFrame * fMain
Main window.
Definition: ListWindow.h:48
void evdb::ListWindow::Register ( const char *  name,
const char *  description,
unsigned int  h,
unsigned int  w,
ObjListCanvasCreator_t  creator 
)
static

Register a display canvas for use in creating windows

Definition at line 53 of file ListWindow.cxx.

References evdb::gsWindows().

58  {
59  gsName.push_back(std::string(name));
60  gsDescription.push_back(std::string(description));
61  gsHeight.push_back(h);
62  gsWidth.push_back(w);
63  gsObjListCanvasCreator.push_back(creator);
64 
65  if (gsName.size()>gsWindows.size()) gsWindows.resize(gsName.size());
66  }
static std::vector< DisplayWindow * > gsWindows(64)
static std::vector< unsigned int > gsWidth
static std::vector< std::string > gsName
static std::vector< ObjListCanvasCreator_t > gsObjListCanvasCreator
Definition: ListWindow.cxx:42
static std::vector< std::string > gsDescription
Float_t w
Definition: plot.C:20
static std::vector< unsigned int > gsHeight

Member Data Documentation

ButtonBar* evdb::ListWindow::fButtonBar
private

Top button bar.

Definition at line 50 of file ListWindow.h.

Referenced by ListWindow(), and ~ListWindow().

ObjListCanvas* evdb::ListWindow::fDisplay
private

Display of detector event information.

Definition at line 52 of file ListWindow.h.

Referenced by Draw(), ListWindow(), and ~ListWindow().

TGMainFrame* evdb::ListWindow::fMain
private

Main window.

Definition at line 48 of file ListWindow.h.

Referenced by ListWindow(), Raise(), and ~ListWindow().

MenuBar* evdb::ListWindow::fMenuBar
private

Top menu bar.

Definition at line 49 of file ListWindow.h.

Referenced by ListWindow(), and ~ListWindow().

StatusBar* evdb::ListWindow::fStatusBar
private

Status bar running along the bottom.

Definition at line 51 of file ListWindow.h.

Referenced by ListWindow(), and ~ListWindow().


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