Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

evdb::ButtonBar Class Reference

#include <ButtonBar.h>

List of all members.

Public Member Functions

 ButtonBar (TGMainFrame *frame)
virtual ~ButtonBar ()
void PrevEvt ()
void NextEvt ()
void ReloadEvt ()
void FileList ()
void GoTo ()
void Print ()
int NoImpl (const char *c)
void NewEvent ()

Private Attributes

TGCompositeFrame * fButtonBar
TGLayoutHints * fLayout
TGTextButton * fPrevEvt
TGTextButton * fNextEvt
TGTextButton * fReload
TGTextEntry * fCurrentFile
TGPictureButton * fFileList
TGLabel * fRunEvtLabel
TGTextEntry * fRunTextEntry
TGTextEntry * fEventTextEntry
TGTextButton * fGoTo
TGTextButton * fPrint


Constructor & Destructor Documentation

ButtonBar::ButtonBar TGMainFrame *  frame  ) 
 

Definition at line 43 of file ButtonBar.cxx.

References fButtonBar, fCurrentFile, fEventTextEntry, fFileList, fGoTo, fLayout, fNextEvt, fPrevEvt, fPrint, fReload, fRunEvtLabel, fRunTextEntry, evdb::IoModule::Instance(), and NewEvent().

00044 {
00045   fButtonBar = new TGCompositeFrame(frame, 60, 20, 
00046                                     kSunkenFrame|kHorizontalFrame);
00047   fLayout    = new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0, 0, 1, 0);
00048 
00049   // Previous event button
00050   fPrevEvt = new TGTextButton(fButtonBar, "<-Previous", 150);
00051   fPrevEvt->SetToolTipText("Go to previous event");
00052   fPrevEvt->Connect("Clicked()", "evdb::ButtonBar", this, "PrevEvt()");
00053   fButtonBar->AddFrame(fPrevEvt, new TGLayoutHints(kLHintsTop |
00054                                                    kLHintsLeft, 2, 0, 2, 2));
00055 
00056   // Next event button
00057   fNextEvt = new TGTextButton(fButtonBar, "Next->", 150);
00058   fNextEvt->SetToolTipText("Go to next event");
00059   fNextEvt->Connect("Clicked()", "evdb::ButtonBar", this, "NextEvt()");
00060   fButtonBar->AddFrame(fNextEvt, new TGLayoutHints(kLHintsTop |
00061                                                    kLHintsLeft, 2, 0, 2, 2));
00062   
00063   // Reload button
00064   fReload = new TGTextButton(fButtonBar, "Reload", 150);
00065   fReload->SetToolTipText("Reload current event");
00066   fReload->Connect("Clicked()", "evdb::ButtonBar", this, "ReloadEvt()");
00067   fButtonBar->AddFrame(fReload, new TGLayoutHints(kLHintsTop |
00068                                                   kLHintsLeft, 2, 0, 2, 2));
00069     
00070   fCurrentFile = new TGTextEntry(fButtonBar, new TGTextBuffer(256));
00071   fCurrentFile->SetToolTipText("Name of current file");
00072   fCurrentFile->Resize(400, fCurrentFile->GetDefaultHeight());
00073   fButtonBar->AddFrame(fCurrentFile, 
00074                        new TGLayoutHints(kLHintsTop | kLHintsLeft,
00075                                          8, 2, 2, 2));
00076 
00077   // Button to list attached files
00078   const TGPicture* p = ::PicturePool()->GetPicture("arrow_down.xpm");
00079   GContext_t norm = TGPictureButton::GetDefaultGC()();
00080   fFileList = new TGPictureButton(fButtonBar, p, -1, norm, kRaisedFrame);
00081   fFileList->SetToolTipText("List files");
00082   fFileList->Connect("Clicked()", "evdb::ButtonBar", this, "FileList()");
00083   fButtonBar->AddFrame(fFileList, new TGLayoutHints(kLHintsCenterY,
00084                                                     2, 0, 2, 2));
00085 
00086   // Print button
00087   fPrint = new TGTextButton(fButtonBar, "Print", 150);
00088   fPrint->SetToolTipText("Print Display");
00089   fPrint->Connect("Clicked()", "evdb::ButtonBar", this, "Print()");
00090   fButtonBar->AddFrame(fPrint, new TGLayoutHints(kLHintsTop|kLHintsRight, 
00091                                                  2, 0, 2, 2));
00092   
00093   // Go To button
00094   fGoTo = new TGTextButton(fButtonBar, "Go");
00095   fGoTo->SetToolTipText("Go to event");
00096   fGoTo->Connect("Clicked()", "evdb::ButtonBar", this, "GoTo()");
00097   fButtonBar->AddFrame(fGoTo, new TGLayoutHints(kLHintsTop|kLHintsRight, 
00098                                                 2, 0, 2, 2));
00099 
00100   // Go to event text entry
00101   fEventTextEntry = new TGTextEntry(fButtonBar, new TGTextBuffer(128));
00102   fEventTextEntry->Connect("ReturnPressed()","evdb::ButtonBar",this,"GoTo()");
00103   fEventTextEntry->Resize(75,20);
00104   fButtonBar->AddFrame(fEventTextEntry, 
00105                        new TGLayoutHints(kLHintsTop|kLHintsRight,2,0,2,2));
00106 
00107   fRunTextEntry = new TGTextEntry(fButtonBar, new TGTextBuffer(128));
00108   fRunTextEntry->Connect("ReturnPressed()","evdb::ButtonBar",this,"GoTo()");
00109   fRunTextEntry->Resize(50,20);
00110   fButtonBar->AddFrame(fRunTextEntry, 
00111                        new TGLayoutHints(kLHintsCenterY|kLHintsRight,2,0,2,2));
00112 
00113   fRunEvtLabel = new TGLabel(fButtonBar, new TGHotString("[Run/Event]="));
00114   fButtonBar->AddFrame(fRunEvtLabel, 
00115                        new TGLayoutHints(kLHintsCenterY|kLHintsRight,2,0,2,2));
00116 
00117   // Add button bar to frame
00118   frame->AddFrame(fButtonBar, fLayout);
00119 
00120   // Connect the new event signal from the iomodule to the new event slot
00121   IoModule::Instance()->Connect("NewEvent()",
00122                                 "evdb::ButtonBar",this,"NewEvent()");
00123   
00124   this->NewEvent();
00125 }

ButtonBar::~ButtonBar  )  [virtual]
 

Definition at line 129 of file ButtonBar.cxx.

References fButtonBar, fCurrentFile, fEventTextEntry, fFileList, fGoTo, fLayout, fNextEvt, fPrevEvt, fPrint, fReload, fRunEvtLabel, fRunTextEntry, and evdb::IoModule::Instance().

00130 {
00131   IoModule::Instance()->Disconnect(0,this,0);
00132 
00133   delete fEventTextEntry; fEventTextEntry=0;
00134   delete fRunTextEntry;   fRunTextEntry  =0;
00135   delete fRunEvtLabel;    fRunEvtLabel   =0;
00136   delete fPrint;          fPrint         =0;
00137   delete fGoTo;           fGoTo          =0;
00138   delete fFileList;       fFileList      =0;
00139   delete fCurrentFile;    fCurrentFile   =0;
00140   delete fReload;         fReload        =0;
00141   delete fNextEvt;        fNextEvt       =0;
00142   delete fPrevEvt;        fPrevEvt       =0;
00143   delete fLayout;         fLayout        =0;
00144   delete fButtonBar;      fButtonBar     =0;
00145 }


Member Function Documentation

void ButtonBar::FileList  ) 
 

Definition at line 161 of file ButtonBar.cxx.

References evdb::IoModule::FileName(), and evdb::IoModule::Instance().

00162 {
00163   int i;
00164   const char* f;
00165   for (i=0; (f=IoModule::Instance()->FileName(i)); ++i) {
00166     std::cerr << f << std::endl;
00167   }
00168 }

void ButtonBar::GoTo  ) 
 

Definition at line 176 of file ButtonBar.cxx.

References fEventTextEntry, fRunTextEntry, evdb::IoModule::GoTo(), and evdb::IoModule::Instance().

00177 {
00178   int run = atoi(fRunTextEntry  ->GetText());
00179   int evt = atoi(fEventTextEntry->GetText());
00180   IoModule::Instance()->GoTo(run,evt);
00181 }

void ButtonBar::NewEvent  ) 
 

Definition at line 185 of file ButtonBar.cxx.

References fCurrentFile, fEventTextEntry, fRunTextEntry, and gsGetEventNumbers().

Referenced by ButtonBar().

00186 {
00187   int run;
00188   int evt;
00189   char runtxt[128];
00190   char evttxt[128];
00191 
00192   gsGetEventNumbers(run,evt);
00193   sprintf(runtxt,"%d",run);
00194   sprintf(evttxt,"%d",evt);
00195   fRunTextEntry  ->SetText(runtxt);
00196   fEventTextEntry->SetText(evttxt);
00197 
00198   fCurrentFile->SetText(IoModule::Instance()->CurrentFile());
00199 }

void ButtonBar::NextEvt  ) 
 

Definition at line 153 of file ButtonBar.cxx.

References evdb::IoModule::Advance(), and evdb::IoModule::Instance().

00153 { IoModule::Instance()->Advance(); }

int ButtonBar::NoImpl const char *  c  ) 
 

Definition at line 203 of file ButtonBar.cxx.

References fButtonBar.

00204 {
00205   std::string s;
00206   s = "Sorry action '"; s += method; s+= "' is not implemented.\n";
00207   new TGMsgBox(evdb::TopWindow(), fButtonBar,
00208                "No implementation",s.c_str(),kMBIconExclamation);
00209   return 0;
00210 }

void ButtonBar::PrevEvt  ) 
 

Definition at line 149 of file ButtonBar.cxx.

References evdb::IoModule::Instance(), and evdb::IoModule::Rewind().

00149 { IoModule::Instance()->Rewind(); }

void ButtonBar::Print  ) 
 

Definition at line 172 of file ButtonBar.cxx.

00172 { new PrintDialog(); }

void ButtonBar::ReloadEvt  ) 
 

Definition at line 157 of file ButtonBar.cxx.

References evdb::IoModule::Instance(), and evdb::IoModule::Reload().

00157 { IoModule::Instance()->Reload(); }


Member Data Documentation

TGCompositeFrame* evdb::ButtonBar::fButtonBar [private]
 

Definition at line 41 of file ButtonBar.h.

Referenced by ButtonBar(), NoImpl(), and ~ButtonBar().

TGTextEntry* evdb::ButtonBar::fCurrentFile [private]
 

Definition at line 46 of file ButtonBar.h.

Referenced by ButtonBar(), NewEvent(), and ~ButtonBar().

TGTextEntry* evdb::ButtonBar::fEventTextEntry [private]
 

Definition at line 51 of file ButtonBar.h.

Referenced by ButtonBar(), GoTo(), NewEvent(), and ~ButtonBar().

TGPictureButton* evdb::ButtonBar::fFileList [private]
 

Definition at line 47 of file ButtonBar.h.

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

TGTextButton* evdb::ButtonBar::fGoTo [private]
 

Definition at line 53 of file ButtonBar.h.

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

TGLayoutHints* evdb::ButtonBar::fLayout [private]
 

Definition at line 42 of file ButtonBar.h.

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

TGTextButton* evdb::ButtonBar::fNextEvt [private]
 

Definition at line 44 of file ButtonBar.h.

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

TGTextButton* evdb::ButtonBar::fPrevEvt [private]
 

Definition at line 43 of file ButtonBar.h.

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

TGTextButton* evdb::ButtonBar::fPrint [private]
 

Definition at line 54 of file ButtonBar.h.

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

TGTextButton* evdb::ButtonBar::fReload [private]
 

Definition at line 45 of file ButtonBar.h.

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

TGLabel* evdb::ButtonBar::fRunEvtLabel [private]
 

Definition at line 49 of file ButtonBar.h.

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

TGTextEntry* evdb::ButtonBar::fRunTextEntry [private]
 

Definition at line 50 of file ButtonBar.h.

Referenced by ButtonBar(), GoTo(), NewEvent(), and ~ButtonBar().


The documentation for this class was generated from the following files:
Generated on Sat Nov 21 04:45:37 2009 for NOvA Offline by  doxygen 1.3.9.1