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() [1/2]

FWLongParameterSetter::FWLongParameterSetter ( )

Definition at line 34 of file FWLongParameterSetter.cc.

34 : m_param(nullptr), m_widget(nullptr) {}

◆ ~FWLongParameterSetter()

FWLongParameterSetter::~FWLongParameterSetter ( )
override

Definition at line 41 of file FWLongParameterSetter.cc.

41 {}

◆ FWLongParameterSetter() [2/2]

FWLongParameterSetter::FWLongParameterSetter ( const FWLongParameterSetter )
privatedelete

Member Function Documentation

◆ attach()

void FWLongParameterSetter::attach ( FWParameterBase iParam)
overridevirtual

Implements FWParameterSetterBase.

Definition at line 59 of file FWLongParameterSetter.cc.

59  {
60  m_param = dynamic_cast<FWLongParameter*>(iParam);
61  assert(nullptr != m_param);
62 }

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

◆ build()

TGFrame * FWLongParameterSetter::build ( TGFrame *  iParent,
bool  labelBack = true 
)
overridevirtual

Implements FWParameterSetterBase.

Definition at line 64 of file FWLongParameterSetter.cc.

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 }

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

◆ doUpdate()

void FWLongParameterSetter::doUpdate ( Long_t  )

Definition at line 103 of file FWLongParameterSetter.cc.

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 }

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

◆ operator=()

const FWLongParameterSetter& FWLongParameterSetter::operator= ( const FWLongParameterSetter )
privatedelete

Member Data Documentation

◆ m_param

FWLongParameter* FWLongParameterSetter::m_param
private

Definition at line 53 of file FWLongParameterSetter.h.

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

◆ m_widget

TGNumberEntry* FWLongParameterSetter::m_widget
private

Definition at line 54 of file FWLongParameterSetter.h.

Referenced by build(), and doUpdate().

FWLongParameterSetter::m_widget
TGNumberEntry * m_widget
Definition: FWLongParameterSetter.h:54
FWGenericParameterWithRange::max
T max() const
Definition: FWGenericParameterWithRange.h:47
min
T min(T a, T b)
Definition: MathUtil.h:58
cms::cuda::assert
assert(be >=bs)
FWGenericParameter::set
void set(T iValue)
Definition: FWGenericParameter.h:70
FWGenericParameterWithRange::min
T min() const
Definition: FWGenericParameterWithRange.h:46
FWParameterSetterBase::update
void update() const
Definition: FWParameterSetterBase.cc:74
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
FWParameterBase::name
const std::string & name() const
Definition: FWParameterBase.h:39
TH2PolyOfflineMaps.limits
limits
Definition: TH2PolyOfflineMaps.py:45
FWGenericParameter::value
T value() const
Definition: FWGenericParameter.h:50
FWParameterSetterBase::frame
FWParameterSetterEditorBase * frame() const
Definition: FWParameterSetterBase.h:51
FWLongParameterSetter::m_param
FWLongParameter * m_param
Definition: FWLongParameterSetter.h:53
label
const char * label
Definition: PFTauDecayModeTools.cc:11