GuiSlider Class Reference

#include <GuiSlider.h>

Inheritance diagram for GuiSlider:

GuiBox GuiCompositeFrameBase GuiBase List of all members.

Public Member Functions

 GuiSlider (TGWindow &parent, unsigned int option)
virtual ~GuiSlider ()
RangeControl< double > & GetRangeCtrl ()
RangeControl< double > & GetExtremaCtrl ()
void UseRange (Range< double > &r)
void UseExtrema (Range< double > &e)
void UseRangeControl (RangeControl< double > &rc)
void UseExtremaControl (RangeControl< double > &ec)
GuiSliderSignalsGetSignals ()
void StartCompound ()
void StopCompound ()

Private Member Functions

void UpdateRange ()
void ApplyRange ()

Private Attributes

RangeControl< double > fRangeCtrl
RangeControl< double > fExtremaCtrl
SigC::Connection fSliderCon
SigC::Connection fRangeCon
SigC::Connection fExtremaCon
TGDoubleSlider * fSlider
GuiSliderSignalsfSignals

Detailed Description

Definition at line 71 of file GuiSlider.h.


Constructor & Destructor Documentation

GuiSlider::GuiSlider ( TGWindow &  parent,
unsigned int  option 
)

Definition at line 103 of file GuiSlider.cxx.

References GuiCompositeFrameBase::Add(), fSignals, fSlider, fSliderCon, GuiSliderSignals::position_changed, Munits::s, GuiBase::SetLayoutHints(), UpdateRange(), UseExtremaControl(), and UseRangeControl().

00104     : GuiBox(parent,option)
00105 {
00106     using SigC::slot;
00107 
00108     if (option & kVerticalFrame) {
00109         this->SetLayoutHints(kLHintsExpandY);
00110         GuiVSlider* s = manage(new GuiVSlider(*this));
00111         s->SetLayoutHints(kLHintsExpandY);
00112         this->Add(*s);
00113         fSlider = s;
00114         fSignals = s;
00115     }
00116     else {
00117         this->SetLayoutHints(kLHintsExpandX);
00118         GuiHSlider* s = manage(new GuiHSlider(*this));
00119         s->SetLayoutHints(kLHintsExpandX);
00120         this->Add(*s);
00121         fSlider = s;
00122         fSignals = s;
00123     }
00124     // hook up default controls
00125     RangeControl<double> rc, ec;
00126     this->UseRangeControl(rc);
00127     this->UseExtremaControl(ec);
00128 
00129     fSliderCon = fSignals->position_changed.connect
00130         (slot(*this,&GuiSlider::UpdateRange));
00131 }

GuiSlider::~GuiSlider (  )  [virtual]

Definition at line 132 of file GuiSlider.cxx.

References fExtremaCon, fRangeCon, and fSliderCon.

00133 {
00134     fSliderCon.disconnect();
00135     fRangeCon.disconnect();
00136     fExtremaCon.disconnect();
00137 }


Member Function Documentation

void GuiSlider::ApplyRange (  )  [private]

Definition at line 179 of file GuiSlider.cxx.

References fExtremaCtrl, fRangeCtrl, fSlider, fSliderCon, and RangeControl< TYPE >::GetRange().

Referenced by UseExtrema(), UseExtremaControl(), UseRange(), and UseRangeControl().

00180 {
00181     if (!fSlider) return;
00182 
00183     // Apply current ranges to the slider.  
00184     fSliderCon.block(true);
00185     fSlider->SetPosition(fRangeCtrl.GetRange().Min(),fRangeCtrl.GetRange().Max());
00186     double vmin = fExtremaCtrl.GetRange().Min();
00187     double vmax = fExtremaCtrl.GetRange().Max();
00188     const double eps = 1.0e-10;
00189     if (vmin == vmax) { vmin -= eps; vmax += eps; }
00190     fSlider->SetRange(vmin,vmax);
00191     fClient->ForceRedraw();
00192     fSliderCon.block(false);
00193 }

RangeControl<double>& GuiSlider::GetExtremaCtrl (  )  [inline]

Definition at line 78 of file GuiSlider.h.

References fExtremaCtrl.

Referenced by main().

00078 { return fExtremaCtrl; }

RangeControl<double>& GuiSlider::GetRangeCtrl (  )  [inline]

Definition at line 77 of file GuiSlider.h.

References fRangeCtrl.

Referenced by GfxTrackList::Configure(), GfxStripList::Configure(), GfxShowerList::Configure(), and GfxDigitList::Configure().

00077 { return fRangeCtrl; }

GuiSliderSignals& GuiSlider::GetSignals (  )  [inline]

Definition at line 84 of file GuiSlider.h.

References fSignals.

Referenced by MultiPage::Init(), and EVD::Init().

00084 { return *fSignals; }

void GuiSlider::StartCompound (  ) 

Definition at line 194 of file GuiSlider.cxx.

References fRangeCtrl, and RangeControl< TYPE >::StartCompound().

Referenced by GuiVSlider::Pressed(), and GuiHSlider::Pressed().

00195 {
00196     fRangeCtrl.StartCompound();
00197 }

void GuiSlider::StopCompound (  ) 

Definition at line 198 of file GuiSlider.cxx.

References fRangeCtrl, and RangeControl< TYPE >::StopCompound().

Referenced by GuiVSlider::Released(), and GuiHSlider::Released().

00199 {
00200     fRangeCtrl.StopCompound();
00201 }

void GuiSlider::UpdateRange (  )  [private]

Definition at line 173 of file GuiSlider.cxx.

References fRangeCon, fRangeCtrl, fSlider, and RangeControl< TYPE >::Set().

Referenced by GuiSlider().

00174 {
00175     fRangeCon.block(true);
00176     fRangeCtrl.Set(fSlider->GetMinPosition(),fSlider->GetMaxPosition());
00177     fRangeCon.block(false);
00178 }

void GuiSlider::UseExtrema ( Range< double > &  e  ) 

Definition at line 146 of file GuiSlider.cxx.

References ApplyRange(), MuELoss::e, fExtremaCon, fExtremaCtrl, and RangeControl< TYPE >::UseRange().

Referenced by main(), and PageDisplay::SetupSliders().

00147 {
00148     fExtremaCon.disconnect();
00149     fExtremaCtrl.UseRange(&e);
00150     fExtremaCon = e.modified.connect(SigC::slot(*this,&GuiSlider::ApplyRange));
00151     this->ApplyRange();
00152 }

void GuiSlider::UseExtremaControl ( RangeControl< double > &  ec  ) 

Definition at line 163 of file GuiSlider.cxx.

References ApplyRange(), fExtremaCon, fExtremaCtrl, and RangeControl< TYPE >::GetRange().

Referenced by GuiSlider(), and main().

00164 {
00165     if (&fExtremaCtrl == &ec) return;
00166     fExtremaCon.disconnect();
00167     fExtremaCtrl = ec;
00168     fExtremaCon =
00169         fExtremaCtrl.GetRange().modified.connect(SigC::slot(*this,&GuiSlider::ApplyRange));
00170     this->ApplyRange();
00171 }

void GuiSlider::UseRange ( Range< double > &  r  ) 

Definition at line 139 of file GuiSlider.cxx.

References ApplyRange(), fRangeCon, fRangeCtrl, Range< TYPE >::modified, and RangeControl< TYPE >::UseRange().

Referenced by main(), and PageDisplay::SetupSliders().

00140 {
00141     fRangeCon.disconnect();
00142     fRangeCtrl.UseRange(&r);
00143     fRangeCon = r.modified.connect(SigC::slot(*this,&GuiSlider::ApplyRange));
00144     this->ApplyRange();
00145 }

void GuiSlider::UseRangeControl ( RangeControl< double > &  rc  ) 

Definition at line 154 of file GuiSlider.cxx.

References ApplyRange(), fRangeCon, fRangeCtrl, and RangeControl< TYPE >::GetRange().

Referenced by GuiSlider(), and main().

00155 {
00156     if (&fRangeCtrl == &rc) return;
00157     fRangeCon.disconnect();
00158     fRangeCtrl = rc;
00159     fRangeCon =
00160         fRangeCtrl.GetRange().modified.connect(SigC::slot(*this,&GuiSlider::ApplyRange));
00161     this->ApplyRange();
00162 }


Member Data Documentation

SigC::Connection GuiSlider::fExtremaCon [private]

Definition at line 95 of file GuiSlider.h.

Referenced by UseExtrema(), UseExtremaControl(), and ~GuiSlider().

RangeControl<double> GuiSlider::fExtremaCtrl [private]

Definition at line 94 of file GuiSlider.h.

Referenced by ApplyRange(), GetExtremaCtrl(), UseExtrema(), and UseExtremaControl().

SigC::Connection GuiSlider::fRangeCon [private]

Definition at line 95 of file GuiSlider.h.

Referenced by UpdateRange(), UseRange(), UseRangeControl(), and ~GuiSlider().

RangeControl<double> GuiSlider::fRangeCtrl [private]

Definition at line 94 of file GuiSlider.h.

Referenced by ApplyRange(), GetRangeCtrl(), StartCompound(), StopCompound(), UpdateRange(), UseRange(), and UseRangeControl().

GuiSliderSignals* GuiSlider::fSignals [private]

Definition at line 97 of file GuiSlider.h.

Referenced by GetSignals(), and GuiSlider().

TGDoubleSlider* GuiSlider::fSlider [private]

Definition at line 96 of file GuiSlider.h.

Referenced by ApplyRange(), GuiSlider(), and UpdateRange().

SigC::Connection GuiSlider::fSliderCon [private]

Definition at line 95 of file GuiSlider.h.

Referenced by ApplyRange(), GuiSlider(), and ~GuiSlider().


The documentation for this class was generated from the following files:
Generated on Mon Sep 1 00:51:40 2014 for loon by  doxygen 1.4.7