File indexing completed on 2024-04-06 12:11:35
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include "TGButton.h"
0016 #include <cassert>
0017 #include <iostream>
0018
0019
0020 #include "Fireworks/Core/src/FWBoolParameterSetter.h"
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033 FWBoolParameterSetter::FWBoolParameterSetter() : m_param(nullptr), m_widget(nullptr) {}
0034
0035
0036
0037
0038
0039
0040 FWBoolParameterSetter::~FWBoolParameterSetter() {}
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
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 ) {
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
0083
0084
0085
0086
0087