CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
FWLongParameterSetter Class Reference

#include <Fireworks/Core/interface/FWLongParameterSetter.h>

Inheritance diagram for FWLongParameterSetter:
FWParameterSetterBase

Public Member Functions

void attach (FWParameterBase *) override
 
TGFrame * build (TGFrame *iParent, bool labelBack=true) override
 
void doUpdate (Long_t)
 
 FWLongParameterSetter ()
 
 ~FWLongParameterSetter () override
 
- Public Member Functions inherited from FWParameterSetterBase
void attach (FWParameterBase *, FWParameterSetterEditorBase *)
 
 FWParameterSetterBase ()
 
virtual void setEnabled (bool)
 
virtual ~FWParameterSetterBase ()
 

Private Member Functions

 FWLongParameterSetter (const FWLongParameterSetter &)=delete
 
const FWLongParameterSetteroperator= (const FWLongParameterSetter &)=delete
 

Private Attributes

FWLongParameterm_param
 
TGNumberEntry * m_widget
 

Additional Inherited Members

- Static Public Member Functions inherited from FWParameterSetterBase
static std::shared_ptr< FWParameterSetterBasemakeSetterFor (FWParameterBase *)
 
- Protected Member Functions inherited from FWParameterSetterBase
FWParameterSetterEditorBaseframe () const
 
void update () const
 

Detailed Description

Description: <one line="" class="" summary>="">

Usage: <usage>

Definition at line 31 of file FWLongParameterSetter.h.

Constructor & Destructor Documentation

FWLongParameterSetter::FWLongParameterSetter ( )

Definition at line 35 of file FWLongParameterSetter.cc.

35  :
36  m_param(nullptr),
37  m_widget(nullptr)
38 {
39 }
FWLongParameterSetter::~FWLongParameterSetter ( )
override

Definition at line 46 of file FWLongParameterSetter.cc.

47 {
48 }
FWLongParameterSetter::FWLongParameterSetter ( const FWLongParameterSetter )
privatedelete

Member Function Documentation

void FWLongParameterSetter::attach ( FWParameterBase iParam)
overridevirtual

Implements FWParameterSetterBase.

Definition at line 67 of file FWLongParameterSetter.cc.

References m_param.

68 {
69  m_param = dynamic_cast<FWLongParameter*>(iParam);
70  assert(nullptr!=m_param);
71 }
TGFrame * FWLongParameterSetter::build ( TGFrame *  iParent,
bool  labelBack = true 
)
overridevirtual

Implements FWParameterSetterBase.

Definition at line 74 of file FWLongParameterSetter.cc.

References FWParameterSetterBase::frame(), label, m_param, m_widget, FWGenericParameterWithRange< T >::max(), SiStripPI::max, min(), FWGenericParameterWithRange< T >::min(), FWParameterBase::name(), and FWGenericParameter< T >::value().

75 {
76  TGCompositeFrame* frame = new TGHorizontalFrame(iParent);
77 
78  // number entry widget
79  TGNumberFormat::ELimit limits = m_param->min()==m_param->max() ?
80  TGNumberFormat::kNELNoLimits :
81  ( m_param->min() > m_param->max() ? TGNumberFormat::kNELLimitMin : TGNumberFormat::kNELLimitMinMax);
82  double min = 0;
83  double max = 1;
84  if (m_param->min()!=m_param->max())
85  {
86  min=m_param->min();
87  max=m_param->max();
88  }
89  m_widget = new TGNumberEntry
90  (frame, m_param->value(),
91  5, // number of digits
92  0, // widget ID
93  TGNumberFormat::kNESInteger, // style
94  TGNumberFormat::kNEAAnyNumber, // input value filter
95  limits, // specify limits
96  min, // min value
97  max); // max value
98 
99  m_widget->Connect("ValueSet(Long_t)", "FWLongParameterSetter", this, "doUpdate(Long_t)");
100 
101  // label
102  TGLabel* label = new TGLabel(frame, m_param->name().c_str());
103  if (labelBack)
104  {
105  frame->AddFrame(m_widget, new TGLayoutHints(kLHintsLeft|kLHintsCenterY, 2,6,2,2));
106  frame->AddFrame(label, new TGLayoutHints(kLHintsLeft|kLHintsCenterY, 2,2,0,0));
107  }
108  else
109  {
110  frame->AddFrame(label, new TGLayoutHints(kLHintsLeft|kLHintsCenterY));
111  frame->AddFrame(m_widget, new TGLayoutHints(kLHintsLeft|kLHintsCenterY, 2,8,2,2));
112  }
113 
114  return frame;
115 }
FWParameterSetterEditorBase * frame() const
char const * label
T min(T a, T b)
Definition: MathUtil.h:58
const std::string & name() const
void FWLongParameterSetter::doUpdate ( Long_t  )

Definition at line 118 of file FWLongParameterSetter.cc.

References m_param, m_widget, FWGenericParameter< T >::set(), and FWParameterSetterBase::update().

119 {
120  //std::cout <<"doUpdate called"<<std::endl;
121 
122  // Idiotic TGNumberEntry arrow buttons can send several events and if
123  // individual event processing takes longer it can happen that the widget
124  // gets detroyed in the meantime. So, process all events from arrows as
125  // soon as possible.
126  static bool in_update = false;
127  if (in_update)
128  return;
129  in_update = true;
130  gClient->ProcessEventsFor((TGWindow*)gTQSender);
131  in_update = false;
132 
133  assert(nullptr!=m_param);
134  assert(nullptr!=m_widget);
135  //std::cout <<m_widget->GetNumberEntry()->GetNumber()<<std::endl;
136  m_param->set(m_widget->GetNumberEntry()->GetIntNumber());
137  update();
138 }
const FWLongParameterSetter& FWLongParameterSetter::operator= ( const FWLongParameterSetter )
privatedelete

Member Data Documentation

FWLongParameter* FWLongParameterSetter::m_param
private

Definition at line 54 of file FWLongParameterSetter.h.

Referenced by attach(), build(), and doUpdate().

TGNumberEntry* FWLongParameterSetter::m_widget
private

Definition at line 55 of file FWLongParameterSetter.h.

Referenced by build(), and doUpdate().