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 //
34  m_param(nullptr),
35  m_widget(nullptr)
36 {
37 }
38 
39 // FWBoolParameterSetter::FWBoolParameterSetter(const FWBoolParameterSetter& rhs)
40 // {
41 // // do actual copying here;
42 // }
43 
45 {
46 }
47 
48 //
49 // assignment operators
50 //
51 // const FWBoolParameterSetter& FWBoolParameterSetter::operator=(const FWBoolParameterSetter& rhs)
52 // {
53 // //An exception safe implementation is
54 // FWBoolParameterSetter temp(rhs);
55 // swap(rhs);
56 //
57 // return *this;
58 // }
59 
60 //
61 // member functions
62 //
63 
64 void
66 {
67  m_param = dynamic_cast<FWBoolParameter*>(iParam);
68  assert(nullptr!=m_param);
69 }
70 
71 TGFrame*
72 FWBoolParameterSetter::build(TGFrame* iParent, bool /*labelBack*/)
73 {
74  TGCompositeFrame* frame = new TGHorizontalFrame(iParent);
75 
76  m_widget = new TGCheckButton(frame, m_param->name().c_str(), 0);
77  m_widget->SetState( m_param->value() ? kButtonDown : kButtonUp );
78  m_widget->Connect("Clicked()", "FWBoolParameterSetter", this, "doUpdate()");
79  frame->AddFrame(m_widget, new TGLayoutHints(kLHintsLeft|kLHintsCenterY,2,0,1,1));
80  return frame;
81 }
82 
83 void
85 {
86  m_widget->SetEnabled(x);
87 }
88 
89 void
91 {
92  assert(nullptr!=m_param);
93  assert(nullptr!=m_widget);
94  m_param->set(m_widget->IsOn());
95  update();
96 }
97 //
98 // const member functions
99 //
100 
101 //
102 // static member functions
103 //
FWParameterSetterEditorBase * frame() const
TGFrame * build(TGFrame *iParent, bool labelBack=true) override
#define nullptr
void attach(FWParameterBase *) override
void setEnabled(bool) override
const std::string & name() const