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 
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 //
FWParameterSetterEditorBase * frame() const
#define nullptr
TGFrame * build(TGFrame *iParent, bool labelBack=true) override
void attach(FWParameterBase *) override
void setEnabled(bool) override
const std::string & name() const