test
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 31 of file FWLongParameterSetter.h.

Constructor & Destructor Documentation

FWLongParameterSetter::FWLongParameterSetter ( )

Definition at line 35 of file FWLongParameterSetter.cc.

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

Definition at line 46 of file FWLongParameterSetter.cc.

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

Member Function Documentation

void FWLongParameterSetter::attach ( FWParameterBase iParam)
virtual

Implements FWParameterSetterBase.

Definition at line 67 of file FWLongParameterSetter.cc.

References assert(), and m_param.

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

Implements FWParameterSetterBase.

Definition at line 74 of file FWLongParameterSetter.cc.

References FWParameterSetterBase::frame(), diffTwoXMLs::label, m_param, m_widget, FWGenericParameterWithRange< T >::max(), bookConverter::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
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 assert(), 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(0!=m_param);
134  assert(0!=m_widget);
135  //std::cout <<m_widget->GetNumberEntry()->GetNumber()<<std::endl;
136  m_param->set(m_widget->GetNumberEntry()->GetIntNumber());
137  update();
138 }
assert(m_qm.get())
const FWLongParameterSetter& FWLongParameterSetter::operator= ( const FWLongParameterSetter )
private

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().