CMS 3D CMS Logo

FWBoolParameterSetter.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Core
4 // Class : FWBoolParameterSetter
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author: Chris Jones
10 // Created: Mon Mar 10 11:22:32 CDT 2008
11 //
12 
13 // system include files
14 
15 #include "TGButton.h"
16 #include <cassert>
17 #include <iostream>
18 
19 // user include files
21 
22 //
23 // constants, enums and typedefs
24 //
25 
26 //
27 // static data member definitions
28 //
29 
30 //
31 // constructors and destructor
32 //
33 FWBoolParameterSetter::FWBoolParameterSetter() : m_param(nullptr), m_widget(nullptr) {}
34 
35 // FWBoolParameterSetter::FWBoolParameterSetter(const FWBoolParameterSetter& rhs)
36 // {
37 // // do actual copying here;
38 // }
39 
41 
42 //
43 // assignment operators
44 //
45 // const FWBoolParameterSetter& FWBoolParameterSetter::operator=(const FWBoolParameterSetter& rhs)
46 // {
47 // //An exception safe implementation is
48 // FWBoolParameterSetter temp(rhs);
49 // swap(rhs);
50 //
51 // return *this;
52 // }
53 
54 //
55 // member functions
56 //
57 
59  m_param = dynamic_cast<FWBoolParameter*>(iParam);
60  assert(nullptr != m_param);
61 }
62 
63 TGFrame* FWBoolParameterSetter::build(TGFrame* iParent, bool /*labelBack*/) {
64  TGCompositeFrame* frame = new TGHorizontalFrame(iParent);
65 
66  m_widget = new TGCheckButton(frame, m_param->name().c_str(), 0);
67  m_widget->SetState(m_param->value() ? kButtonDown : kButtonUp);
68  m_widget->Connect("Clicked()", "FWBoolParameterSetter", this, "doUpdate()");
69  frame->AddFrame(m_widget, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 2, 0, 1, 1));
70  return frame;
71 }
72 
73 void FWBoolParameterSetter::setEnabled(bool x) { m_widget->SetEnabled(x); }
74 
76  assert(nullptr != m_param);
77  assert(nullptr != m_widget);
78  m_param->set(m_widget->IsOn());
79  update();
80 }
81 //
82 // const member functions
83 //
84 
85 //
86 // static member functions
87 //
FWBoolParameterSetter::build
TGFrame * build(TGFrame *iParent, bool labelBack=true) override
Definition: FWBoolParameterSetter.cc:63
FWBoolParameterSetter.h
FWBoolParameterSetter::m_widget
TGCheckButton * m_widget
Definition: FWBoolParameterSetter.h:53
FWParameterBase
Definition: FWParameterBase.h:31
FWBoolParameterSetter::m_param
FWBoolParameter * m_param
Definition: FWBoolParameterSetter.h:52
cms::cuda::assert
assert(be >=bs)
FWGenericParameter::set
void set(T iValue)
Definition: FWGenericParameter.h:70
DDAxes::x
FWBoolParameterSetter::FWBoolParameterSetter
FWBoolParameterSetter()
Definition: FWBoolParameterSetter.cc:33
vertices_cff.x
x
Definition: vertices_cff.py:29
FWParameterSetterBase::update
void update() const
Definition: FWParameterSetterBase.cc:74
FWBoolParameterSetter::setEnabled
void setEnabled(bool) override
Definition: FWBoolParameterSetter.cc:73
FWBoolParameterSetter::~FWBoolParameterSetter
~FWBoolParameterSetter() override
Definition: FWBoolParameterSetter.cc:40
FWBoolParameterSetter::attach
void attach(FWParameterBase *) override
Definition: FWBoolParameterSetter.cc:58
FWBoolParameterSetter::doUpdate
void doUpdate()
Definition: FWBoolParameterSetter.cc:75
FWParameterBase::name
const std::string & name() const
Definition: FWParameterBase.h:39
FWGenericParameter::value
T value() const
Definition: FWGenericParameter.h:50
FWParameterSetterBase::frame
FWParameterSetterEditorBase * frame() const
Definition: FWParameterSetterBase.h:51