CMS 3D CMS Logo

/data/git/CMSSW_5_3_11_patch5/src/Fireworks/Core/src/FWBoolParameterSetter.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:     Core
00004 // Class  :     FWBoolParameterSetter
00005 //
00006 // Implementation:
00007 //     <Notes on implementation>
00008 //
00009 // Original Author:  Chris Jones
00010 //         Created:  Mon Mar 10 11:22:32 CDT 2008
00011 // $Id: FWBoolParameterSetter.cc,v 1.7 2011/02/11 19:56:36 amraktad Exp $
00012 //
00013 
00014 // system include files
00015 
00016 #include "TGButton.h"
00017 #include <assert.h>
00018 #include <iostream>
00019 
00020 // user include files
00021 #include "Fireworks/Core/src/FWBoolParameterSetter.h"
00022 
00023 //
00024 // constants, enums and typedefs
00025 //
00026 
00027 //
00028 // static data member definitions
00029 //
00030 
00031 //
00032 // constructors and destructor
00033 //
00034 FWBoolParameterSetter::FWBoolParameterSetter() :
00035    m_param(0),
00036    m_widget(0)
00037 {
00038 }
00039 
00040 // FWBoolParameterSetter::FWBoolParameterSetter(const FWBoolParameterSetter& rhs)
00041 // {
00042 //    // do actual copying here;
00043 // }
00044 
00045 FWBoolParameterSetter::~FWBoolParameterSetter()
00046 {
00047 }
00048 
00049 //
00050 // assignment operators
00051 //
00052 // const FWBoolParameterSetter& FWBoolParameterSetter::operator=(const FWBoolParameterSetter& rhs)
00053 // {
00054 //   //An exception safe implementation is
00055 //   FWBoolParameterSetter temp(rhs);
00056 //   swap(rhs);
00057 //
00058 //   return *this;
00059 // }
00060 
00061 //
00062 // member functions
00063 //
00064 
00065 void
00066 FWBoolParameterSetter::attach(FWParameterBase* iParam)
00067 {
00068    m_param = dynamic_cast<FWBoolParameter*>(iParam);
00069    assert(0!=m_param);
00070 }
00071 
00072 TGFrame*
00073 FWBoolParameterSetter::build(TGFrame* iParent, bool /*labelBack*/)
00074 {
00075    TGCompositeFrame* frame = new TGHorizontalFrame(iParent);
00076 
00077    m_widget = new TGCheckButton(frame, m_param->name().c_str(), 0);
00078    m_widget->SetState( m_param->value() ? kButtonDown : kButtonUp );
00079    m_widget->Connect("Clicked()", "FWBoolParameterSetter", this, "doUpdate()");
00080    frame->AddFrame(m_widget, new TGLayoutHints(kLHintsLeft|kLHintsCenterY,2,0,1,1));
00081    return frame;
00082 }
00083 
00084 void
00085 FWBoolParameterSetter::setEnabled(bool x)
00086 {
00087    m_widget->SetEnabled(x);
00088 }
00089 
00090 void
00091 FWBoolParameterSetter::doUpdate()
00092 {
00093    assert(0!=m_param);
00094    assert(0!=m_widget);
00095    m_param->set(m_widget->IsOn());
00096    update();
00097 }
00098 //
00099 // const member functions
00100 //
00101 
00102 //
00103 // static member functions
00104 //