Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | 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 42 of file ButtonBar.cxx.

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

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

ButtonBar::~ButtonBar  )  [virtual]
 

Definition at line 128 of file ButtonBar.cxx.

References fButtonBar, fCurrentFile, fEventTextEntry, fFileList, fGoTo, fLayout, fNextEvt, fPrevEvt, fPrint, fReload, fRunEvtLabel, and fRunTextEntry.

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


Member Function Documentation

void ButtonBar::FileList  ) 
 

Definition at line 160 of file ButtonBar.cxx.

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

void ButtonBar::GoTo  ) 
 

Definition at line 175 of file ButtonBar.cxx.

References fEventTextEntry, and fRunTextEntry.

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

void ButtonBar::NewEvent  ) 
 

Definition at line 184 of file ButtonBar.cxx.

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

Referenced by ButtonBar().

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

void ButtonBar::NextEvt  ) 
 

Definition at line 152 of file ButtonBar.cxx.

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

int ButtonBar::NoImpl const char *  c  ) 
 

Definition at line 202 of file ButtonBar.cxx.

References fButtonBar.

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

void ButtonBar::PrevEvt  ) 
 

Definition at line 148 of file ButtonBar.cxx.

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

void ButtonBar::Print  ) 
 

Definition at line 171 of file ButtonBar.cxx.

00171 { new PrintDialog(); }

void ButtonBar::ReloadEvt  ) 
 

Definition at line 156 of file ButtonBar.cxx.

00156 { 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 Thu Jul 24 12:01:16 2008 for NOvA Offline by doxygen 1.3.5