CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

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

Private Member Functions

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

Private Attributes

FWLongParameterm_param
 
TGNumberEntry * m_widget
 

Additional Inherited Members

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

Detailed Description

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

Usage: <usage>

Definition at line 32 of file FWLongParameterSetter.h.

Constructor & Destructor Documentation

FWLongParameterSetter::FWLongParameterSetter ( )

Definition at line 36 of file FWLongParameterSetter.cc.

36  :
37  m_param(0),
38  m_widget(0)
39 {
40 }
FWLongParameterSetter::~FWLongParameterSetter ( )
virtual

Definition at line 47 of file FWLongParameterSetter.cc.

48 {
49 }
FWLongParameterSetter::FWLongParameterSetter ( const FWLongParameterSetter )
private

Member Function Documentation

void FWLongParameterSetter::attach ( FWParameterBase iParam)
virtual

Implements FWParameterSetterBase.

Definition at line 68 of file FWLongParameterSetter.cc.

References m_param.

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

Implements FWParameterSetterBase.

Definition at line 75 of file FWLongParameterSetter.cc.

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

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

Definition at line 119 of file FWLongParameterSetter.cc.

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

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

Member Data Documentation

FWLongParameter* FWLongParameterSetter::m_param
private

Definition at line 55 of file FWLongParameterSetter.h.

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

TGNumberEntry* FWLongParameterSetter::m_widget
private

Definition at line 56 of file FWLongParameterSetter.h.

Referenced by build(), and doUpdate().