test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FWStringParameterSetter.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Core
4 // Class : FWStringParameterSetter
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 #include "TGLabel.h"
15 #include "TGTextEntry.h"
16 
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 // FWStringParameterSetter::FWStringParameterSetter(const FWStringParameterSetter& rhs)
41 // {
42 // // do actual copying here;
43 // }
44 
46 {
47 }
48 
49 //
50 // assignment operators
51 //
52 // const FWStringParameterSetter& FWStringParameterSetter::operator=(const FWStringParameterSetter& rhs)
53 // {
54 // //An exception safe implementation is
55 // FWStringParameterSetter 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<FWStringParameter*>(iParam);
69  assert(0!=m_param);
70 }
71 
72 TGFrame*
73 FWStringParameterSetter::build(TGFrame* iParent, bool labelBack)
74 {
75  TGCompositeFrame* frame = new TGHorizontalFrame(iParent,180,20,kFixedWidth);
76 
77  m_widget = new TGTextEntry(frame, m_param->name().c_str(), 0);
78  m_widget->SetText( m_param->value().c_str() );
79  m_widget->Connect("ReturnPressed()", "FWStringParameterSetter", this, "doUpdate()");
80  // label
81  TGLabel* label = new TGLabel(frame,m_param->name().c_str());
82  if (labelBack)
83  {
84  frame->AddFrame(m_widget, new TGLayoutHints(kLHintsExpandX|kLHintsCenterY,2,2,1,1));
85  frame->AddFrame(label, new TGLayoutHints(kLHintsLeft|kLHintsCenterY,4,2,1,1) );
86  }
87  else
88  {
89  frame->AddFrame(label, new TGLayoutHints(kLHintsLeft|kLHintsCenterY) );
90  frame->AddFrame(m_widget, new TGLayoutHints(kLHintsLeft|kLHintsCenterY, 2,8,2,2));
91  }
92  return frame;
93 }
94 
95 void
97 {
98  assert(0!=m_param);
99  assert(0!=m_widget);
100  m_param->set(m_widget->GetText());
101  update();
102 }
103 //
104 // const member functions
105 //
106 
107 //
108 // static member functions
109 //
FWParameterSetterEditorBase * frame() const
assert(m_qm.get())
virtual void attach(FWParameterBase *)
virtual TGFrame * build(TGFrame *iParent, bool labelBack=true)
const std::string & name() const