Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
evd::SliceButtonBar Class Reference

Controls for navigating between slices. More...

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-12-02/EventDisplay/SliceButtonBar.h"

Inheritance diagram for evd::SliceButtonBar:

Public Member Functions

 SliceButtonBar (const TGWindow *p)
 
virtual ~SliceButtonBar ()
 
void Enable ()
 
void Previous ()
 
void Next ()
 
Bool_t HandleTimer (TTimer *t)
 
void AutoAdvance ()
 
void GoTo ()
 
void Update ()
 

Protected Member Functions

 ClassDef (SliceButtonBar, 0)
 

Protected Attributes

TTimer * fTimer
 Timer to handle slice-level auto-advancing. More...
 
TGTextButton * fPrevButton
 
TGTextButton * fNextButton
 
TGTextButton * fAutoAdvanceButton
 Start to auto advance. More...
 
TGCheckButton * fEnableButton
 
TGTextEntry * fSliceTextEntry
 
TGLabel * fNSlicesLabel
 

Detailed Description

Controls for navigating between slices.

Definition at line 22 of file SliceButtonBar.h.

Constructor & Destructor Documentation

evd::SliceButtonBar::SliceButtonBar ( const TGWindow *  p)

Definition at line 22 of file SliceButtonBar.cxx.

References evd::SliceNavigator::CurrentSlice(), Enable(), fAutoAdvanceButton, fEnableButton, fNextButton, fNSlicesLabel, genie::utils::style::Format(), fPrevButton, fSliceTextEntry, evd::SliceNavigator::FullEventMode(), and label.

23  : TGCompositeFrame(p, 60, 20, kSunkenFrame | kHorizontalFrame),
24  fTimer(0)
25  {
27 
28  TGLabel* label = new TGLabel(this, "Slices: ");
29  AddFrame(label, new TGLayoutHints(kLHintsCenterY | kLHintsLeft,
30  0, 0, 5, 1));
31 
32  // Previous slice button
33  fPrevButton = new TGTextButton(this, "<< Previous", 50);
34  fPrevButton->SetToolTipText("Go to previous slice");
35  fPrevButton->Connect("Clicked()",
36  "evd::SliceButtonBar", this, "Previous()");
37  AddFrame(fPrevButton, new TGLayoutHints(kLHintsTop | kLHintsLeft,
38  2, 0, 2, 2));
39 
40  // Next slice button
41  fNextButton = new TGTextButton(this, "Next >>", 50);
42  fNextButton->SetToolTipText("Go to next slice");
43  fNextButton->Connect("Clicked()", "evd::SliceButtonBar", this, "Next()");
44  AddFrame(fNextButton, new TGLayoutHints(kLHintsTop | kLHintsLeft,
45  2, 0, 2, 2));
46 
47  // Auto-advance button
48  fAutoAdvanceButton = new TGTextButton(this, ">", 50);
49  fAutoAdvanceButton->SetToolTipText("Start slice auto advance");
50  fAutoAdvanceButton->Connect("Clicked()", "evd::SliceButtonBar", this, "AutoAdvance()");
51  AddFrame(fAutoAdvanceButton, new TGLayoutHints(kLHintsTop | kLHintsLeft,
52  2, 0, 2, 2));
53 
54  // Slice-by-slice enable button
55  fEnableButton = new TGCheckButton(this, "Slice-by-slice", 0);
56  AddFrame(fEnableButton, new TGLayoutHints(kLHintsCenterY | kLHintsLeft,
57  2, 0, 2, 2));
58  fEnableButton->Connect("Clicked()",
59  "evd::SliceButtonBar", this, "Enable()");
60  fEnableButton->SetState(nav->FullEventMode() ? kButtonUp : kButtonDown);
61 
62  fNSlicesLabel = new TGLabel(this, " / 1 ");
63  AddFrame(fNSlicesLabel, new TGLayoutHints(kLHintsCenterY | kLHintsRight,
64  0, 0, 5, 1));
65 
66  fSliceTextEntry = new TGTextEntry(this, new TGTextBuffer(128));
67  fSliceTextEntry->Connect("ReturnPressed()", "evd::SliceButtonBar",
68  this, "GoTo()");
69  fSliceTextEntry->Resize(50, 20);
70  fSliceTextEntry->SetText(TString::Format("%d", nav->CurrentSlice()));
71  AddFrame(fSliceTextEntry,
72  new TGLayoutHints(kLHintsTop | kLHintsRight, 2, 0, 2, 2));
73 
74  TGLabel* sliceLabel = new TGLabel(this, "[Slice]=");
75  AddFrame(sliceLabel,
76  new TGLayoutHints(kLHintsCenterY | kLHintsRight, 2, 0, 2, 2));
77 
78  // Set everything to the appropriate enabled state
79  Enable();
80  }
const char * p
Definition: xmltok.h:285
TTimer * fTimer
Timer to handle slice-level auto-advancing.
TGTextButton * fPrevButton
TGTextButton * fNextButton
const char * label
TGTextEntry * fSliceTextEntry
TGCheckButton * fEnableButton
TGTextButton * fAutoAdvanceButton
Start to auto advance.
void Format(TGraph *gr, int lcol, int lsty, int lwid, int mcol, int msty, double msiz)
Definition: Style.cxx:154
evd::SliceButtonBar::~SliceButtonBar ( )
virtual

Definition at line 83 of file SliceButtonBar.cxx.

References fEnableButton, fNextButton, fNSlicesLabel, fPrevButton, and fSliceTextEntry.

84  {
85  delete fPrevButton;
86  delete fNextButton;
87  delete fEnableButton;
88  delete fSliceTextEntry;
89  delete fNSlicesLabel;
90  }
TGTextButton * fPrevButton
TGTextButton * fNextButton
TGTextEntry * fSliceTextEntry
TGCheckButton * fEnableButton

Member Function Documentation

void evd::SliceButtonBar::AutoAdvance ( )

Definition at line 127 of file SliceButtonBar.cxx.

References fAutoAdvanceButton, evd::SliceNavigator::fAutoAdvanceInterval, and fTimer.

128  {
129  if (fTimer == 0) {
130  //
131  // Start the slice-level auto-advance feature
132  //
133  fAutoAdvanceButton->SetText("X");
134  fTimer = new TTimer;
135  fTimer->SetObject(this);
136 
138  fTimer->Start(nav->fAutoAdvanceInterval);
139  }
140  else {
141  //
142  // Stop the slice-level auto-advance feature
143  //
144  fAutoAdvanceButton->SetText(">");
145  fTimer->Stop();
146  delete fTimer;
147  fTimer = 0;
148  }
149  }
TTimer * fTimer
Timer to handle slice-level auto-advancing.
int fAutoAdvanceInterval
Wait time in milliseconds.
TGTextButton * fAutoAdvanceButton
Start to auto advance.
evd::SliceButtonBar::ClassDef ( SliceButtonBar  ,
 
)
protected
void evd::SliceButtonBar::Enable ( )

Definition at line 93 of file SliceButtonBar.cxx.

References fEnableButton, evd::SliceNavigator::SetFullEventMode(), and Update().

Referenced by SliceButtonBar().

94  {
96  nav->SetFullEventMode(fEnableButton->GetState() == kButtonUp);
97 
98  Update();
99  }
TGCheckButton * fEnableButton
void SetFullEventMode(bool mode)
void evd::SliceButtonBar::GoTo ( )

Definition at line 152 of file SliceButtonBar.cxx.

References fSliceTextEntry, and evd::SliceNavigator::SetCurrentSlice().

153  {
155  nav->SetCurrentSlice(atoi(fSliceTextEntry->GetText()));
156  }
TGTextEntry * fSliceTextEntry
Bool_t evd::SliceButtonBar::HandleTimer ( TTimer *  t)

Definition at line 116 of file SliceButtonBar.cxx.

References evd::SliceNavigator::fAutoAdvanceInterval, and Next().

117  {
118  this->Next();
119 
121  t->SetTime(nav->fAutoAdvanceInterval);
122 
123  return kTRUE;
124  }
int fAutoAdvanceInterval
Wait time in milliseconds.
void evd::SliceButtonBar::Next ( )

Definition at line 109 of file SliceButtonBar.cxx.

References evd::SliceNavigator::Next().

Referenced by HandleTimer().

void evd::SliceButtonBar::Previous ( )
void evd::SliceButtonBar::Update ( )

Definition at line 159 of file SliceButtonBar.cxx.

References evd::SliceNavigator::CurrentSlice(), fAutoAdvanceButton, fEnableButton, fNextButton, fNSlicesLabel, genie::utils::style::Format(), fPrevButton, fSliceTextEntry, and evd::SliceNavigator::MaxSlice().

Referenced by evd::XZYZProjectionsView::Draw(), Enable(), progbar.ProgressBar::Finish(), and progbar.ProgressBar::Start().

160  {
162 
163  fSliceTextEntry->SetText(TString::Format("%d", nav->CurrentSlice()));
164  fNSlicesLabel->SetText(TString::Format(" / %d ", nav->MaxSlice()));
165 
166  const bool enable = fEnableButton->GetState() != kButtonUp;
167  fSliceTextEntry->SetEnabled(enable);
168  fPrevButton->SetEnabled(enable);
169  fNextButton->SetEnabled(enable);
170  fAutoAdvanceButton->SetEnabled(enable);
171 
172  if(!enable) fSliceTextEntry->SetText("N/A");
173  }
TGTextButton * fPrevButton
TGTextButton * fNextButton
TGTextEntry * fSliceTextEntry
TGCheckButton * fEnableButton
TGTextButton * fAutoAdvanceButton
Start to auto advance.
void Format(TGraph *gr, int lcol, int lsty, int lwid, int mcol, int msty, double msiz)
Definition: Style.cxx:154

Member Data Documentation

TGTextButton* evd::SliceButtonBar::fAutoAdvanceButton
protected

Start to auto advance.

Definition at line 42 of file SliceButtonBar.h.

Referenced by AutoAdvance(), SliceButtonBar(), and Update().

TGCheckButton* evd::SliceButtonBar::fEnableButton
protected

Definition at line 43 of file SliceButtonBar.h.

Referenced by Enable(), SliceButtonBar(), Update(), and ~SliceButtonBar().

TGTextButton* evd::SliceButtonBar::fNextButton
protected

Definition at line 41 of file SliceButtonBar.h.

Referenced by SliceButtonBar(), Update(), and ~SliceButtonBar().

TGLabel* evd::SliceButtonBar::fNSlicesLabel
protected

Definition at line 45 of file SliceButtonBar.h.

Referenced by SliceButtonBar(), Update(), and ~SliceButtonBar().

TGTextButton* evd::SliceButtonBar::fPrevButton
protected

Definition at line 40 of file SliceButtonBar.h.

Referenced by SliceButtonBar(), Update(), and ~SliceButtonBar().

TGTextEntry* evd::SliceButtonBar::fSliceTextEntry
protected

Definition at line 44 of file SliceButtonBar.h.

Referenced by GoTo(), SliceButtonBar(), Update(), and ~SliceButtonBar().

TTimer* evd::SliceButtonBar::fTimer
protected

Timer to handle slice-level auto-advancing.

Definition at line 39 of file SliceButtonBar.h.

Referenced by AutoAdvance().


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