CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 // $Id: FWBoolParameterSetter.cc,v 1.7 2011/02/11 19:56:36 amraktad Exp $
12 //
13 
14 // system include files
15 
16 #include "TGButton.h"
17 #include <assert.h>
18 #include <iostream>
19 
20 // user include files
22 
23 //
24 // constants, enums and typedefs
25 //
26 
27 //
28 // static data member definitions
29 //
30 
31 //
32 // constructors and destructor
33 //
35  m_param(0),
36  m_widget(0)
37 {
38 }
39 
40 // FWBoolParameterSetter::FWBoolParameterSetter(const FWBoolParameterSetter& rhs)
41 // {
42 // // do actual copying here;
43 // }
44 
46 {
47 }
48 
49 //
50 // assignment operators
51 //
52 // const FWBoolParameterSetter& FWBoolParameterSetter::operator=(const FWBoolParameterSetter& rhs)
53 // {
54 // //An exception safe implementation is
55 // FWBoolParameterSetter temp(rhs);
56 // swap(rhs);
57 //
58 // return *this;
59 // }
60 
61 //
62 // member functions
63 //
64 
65 void
67 {
68  m_param = dynamic_cast<FWBoolParameter*>(iParam);
69  assert(0!=m_param);
70 }
71 
72 TGFrame*
73 FWBoolParameterSetter::build(TGFrame* iParent, bool /*labelBack*/)
74 {
75  TGCompositeFrame* frame = new TGHorizontalFrame(iParent);
76 
77  m_widget = new TGCheckButton(frame, m_param->name().c_str(), 0);
78  m_widget->SetState( m_param->value() ? kButtonDown : kButtonUp );
79  m_widget->Connect("Clicked()", "FWBoolParameterSetter", this, "doUpdate()");
80  frame->AddFrame(m_widget, new TGLayoutHints(kLHintsLeft|kLHintsCenterY,2,0,1,1));
81  return frame;
82 }
83 
84 void
86 {
87  m_widget->SetEnabled(x);
88 }
89 
90 void
92 {
93  assert(0!=m_param);
94  assert(0!=m_widget);
95  m_param->set(m_widget->IsOn());
96  update();
97 }
98 //
99 // const member functions
100 //
101 
102 //
103 // static member functions
104 //
virtual void attach(FWParameterBase *)
FWParameterSetterEditorBase * frame() const
virtual void setEnabled(bool)
virtual TGFrame * build(TGFrame *iParent, bool labelBack=true)
x
Definition: VDTMath.h:216
const std::string & name() const