CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public 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 (const FWLongParameterSetter &)=delete
 
const FWLongParameterSetteroperator= (const FWLongParameterSetter &)=delete
 
 ~FWLongParameterSetter () override
 
- Public Member Functions inherited from FWParameterSetterBase
void attach (FWParameterBase *, FWParameterSetterEditorBase *)
 
 FWParameterSetterBase ()
 
 FWParameterSetterBase (const FWParameterSetterBase &)=delete
 
const FWParameterSetterBaseoperator= (const FWParameterSetterBase &)=delete
 
virtual void setEnabled (bool)
 
virtual ~FWParameterSetterBase ()
 

Private Attributes

FWLongParameterm_param
 
TGNumberEntry * m_widget
 

Additional Inherited Members

- Static Public Member Functions inherited from FWParameterSetterBase
static std::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 34 of file FWLongParameterSetter.cc.

34 : m_param(nullptr), m_widget(nullptr) {}
FWLongParameterSetter::~FWLongParameterSetter ( )
override

Definition at line 41 of file FWLongParameterSetter.cc.

41 {}
FWLongParameterSetter::FWLongParameterSetter ( const FWLongParameterSetter )
delete

Member Function Documentation

void FWLongParameterSetter::attach ( FWParameterBase iParam)
overridevirtual

Implements FWParameterSetterBase.

Definition at line 59 of file FWLongParameterSetter.cc.

References cms::cuda::assert(), and m_param.

59  {
60  m_param = dynamic_cast<FWLongParameter*>(iParam);
61  assert(nullptr != m_param);
62 }
assert(be >=bs)
TGFrame * FWLongParameterSetter::build ( TGFrame *  iParent,
bool  labelBack = true 
)
overridevirtual

Implements FWParameterSetterBase.

Definition at line 64 of file FWLongParameterSetter.cc.

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

64  {
65  TGCompositeFrame* frame = new TGHorizontalFrame(iParent);
66 
67  // number entry widget
68  TGNumberFormat::ELimit limits =
69  m_param->min() == m_param->max()
70  ? TGNumberFormat::kNELNoLimits
71  : (m_param->min() > m_param->max() ? TGNumberFormat::kNELLimitMin : TGNumberFormat::kNELLimitMinMax);
72  double min = 0;
73  double max = 1;
74  if (m_param->min() != m_param->max()) {
75  min = m_param->min();
76  max = m_param->max();
77  }
78  m_widget = new TGNumberEntry(frame,
79  m_param->value(),
80  5, // number of digits
81  0, // widget ID
82  TGNumberFormat::kNESInteger, // style
83  TGNumberFormat::kNEAAnyNumber, // input value filter
84  limits, // specify limits
85  min, // min value
86  max); // max value
87 
88  m_widget->Connect("ValueSet(Long_t)", "FWLongParameterSetter", this, "doUpdate(Long_t)");
89 
90  // label
91  TGLabel* label = new TGLabel(frame, m_param->name().c_str());
92  if (labelBack) {
93  frame->AddFrame(m_widget, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 2, 6, 2, 2));
94  frame->AddFrame(label, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 2, 2, 0, 0));
95  } else {
96  frame->AddFrame(label, new TGLayoutHints(kLHintsLeft | kLHintsCenterY));
97  frame->AddFrame(m_widget, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 2, 8, 2, 2));
98  }
99 
100  return frame;
101 }
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 103 of file FWLongParameterSetter.cc.

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

103  {
104  //std::cout <<"doUpdate called"<<std::endl;
105 
106  // Idiotic TGNumberEntry arrow buttons can send several events and if
107  // individual event processing takes longer it can happen that the widget
108  // gets detroyed in the meantime. So, process all events from arrows as
109  // soon as possible.
110  static bool in_update = false;
111  if (in_update)
112  return;
113  in_update = true;
114  gClient->ProcessEventsFor((TGWindow*)gTQSender);
115  in_update = false;
116 
117  assert(nullptr != m_param);
118  assert(nullptr != m_widget);
119  //std::cout <<m_widget->GetNumberEntry()->GetNumber()<<std::endl;
120  m_param->set(m_widget->GetNumberEntry()->GetIntNumber());
121  update();
122 }
assert(be >=bs)
const FWLongParameterSetter& FWLongParameterSetter::operator= ( const FWLongParameterSetter )
delete

Member Data Documentation

FWLongParameter* FWLongParameterSetter::m_param
private

Definition at line 53 of file FWLongParameterSetter.h.

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

TGNumberEntry* FWLongParameterSetter::m_widget
private

Definition at line 54 of file FWLongParameterSetter.h.

Referenced by build(), and doUpdate().