Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:27:08

0001 // -*- C++ -*-
0002 //
0003 // Package:     Core
0004 // Class  :     FWBoolParameterSetter
0005 //
0006 // Implementation:
0007 //     <Notes on implementation>
0008 //
0009 // Original Author:  Chris Jones
0010 //         Created:  Mon Mar 10 11:22:32 CDT 2008
0011 //
0012 
0013 // system include files
0014 
0015 #include "TGButton.h"
0016 #include <cassert>
0017 #include <iostream>
0018 
0019 // user include files
0020 #include "Fireworks/Core/src/FWBoolParameterSetter.h"
0021 
0022 //
0023 // constants, enums and typedefs
0024 //
0025 
0026 //
0027 // static data member definitions
0028 //
0029 
0030 //
0031 // constructors and destructor
0032 //
0033 FWBoolParameterSetter::FWBoolParameterSetter() : m_param(nullptr), m_widget(nullptr) {}
0034 
0035 // FWBoolParameterSetter::FWBoolParameterSetter(const FWBoolParameterSetter& rhs)
0036 // {
0037 //    // do actual copying here;
0038 // }
0039 
0040 FWBoolParameterSetter::~FWBoolParameterSetter() {}
0041 
0042 //
0043 // assignment operators
0044 //
0045 // const FWBoolParameterSetter& FWBoolParameterSetter::operator=(const FWBoolParameterSetter& rhs)
0046 // {
0047 //   //An exception safe implementation is
0048 //   FWBoolParameterSetter temp(rhs);
0049 //   swap(rhs);
0050 //
0051 //   return *this;
0052 // }
0053 
0054 //
0055 // member functions
0056 //
0057 
0058 void FWBoolParameterSetter::attach(FWParameterBase* iParam) {
0059   m_param = dynamic_cast<FWBoolParameter*>(iParam);
0060   assert(nullptr != m_param);
0061 }
0062 
0063 TGFrame* FWBoolParameterSetter::build(TGFrame* iParent, bool /*labelBack*/) {
0064   TGCompositeFrame* frame = new TGHorizontalFrame(iParent);
0065 
0066   m_widget = new TGCheckButton(frame, m_param->name().c_str(), 0);
0067   m_widget->SetState(m_param->value() ? kButtonDown : kButtonUp);
0068   m_widget->Connect("Clicked()", "FWBoolParameterSetter", this, "doUpdate()");
0069   frame->AddFrame(m_widget, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 2, 0, 1, 1));
0070   return frame;
0071 }
0072 
0073 void FWBoolParameterSetter::setEnabled(bool x) { m_widget->SetEnabled(x); }
0074 
0075 void FWBoolParameterSetter::doUpdate() {
0076   assert(nullptr != m_param);
0077   assert(nullptr != m_widget);
0078   m_param->set(m_widget->IsOn());
0079   update();
0080 }
0081 //
0082 // const member functions
0083 //
0084 
0085 //
0086 // static member functions
0087 //