CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/Fireworks/Core/src/FWViewEnergyScaleEditor.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:     Core
00004 // Class  :     FWViewEnergyScaleEditor
00005 // 
00006 // Implementation:
00007 //     [Notes on implementation]
00008 //
00009 // Original Author:  Alja Mrak-Tadel 
00010 //         Created:  Fri Sep 24 18:52:19 CEST 2010
00011 // $Id: FWViewEnergyScaleEditor.cc,v 1.3 2012/08/01 00:41:36 amraktad Exp $
00012 //
00013 
00014 // system include files
00015 
00016 // user include files
00017 #include "TGButton.h"
00018 #include "TGLabel.h"
00019 #include "Fireworks/Core/interface/FWViewEnergyScaleEditor.h"
00020 #include "Fireworks/Core/interface/FWEveView.h"
00021 #include "Fireworks/Core/interface/FWViewEnergyScale.h"
00022 #include "Fireworks/Core/interface/FWParameterSetterBase.h"
00023 
00024 
00025 //
00026 // constants, enums and typedefs
00027 //
00028 
00029 //
00030 // static data member definitions
00031 //
00032 
00033 //
00034 // constructors and destructor
00035 //
00036 FWViewEnergyScaleEditor::FWViewEnergyScaleEditor(FWViewEnergyScale* s, TGCompositeFrame* w, bool addAutoScaleControll):
00037    TGVerticalFrame(w),
00038    m_scale(s),
00039    m_enabled(true)
00040 { 
00041    addParam(&m_scale->m_plotEt);
00042    addParam(&m_scale->m_scaleMode);
00043    addParam(&m_scale->m_fixedValToHeight, "FixedScaleMode");
00044    if (addAutoScaleControll)
00045       addParam(&m_scale->m_maxTowerHeight, "AutomaticScaleMode");
00046 }
00047 
00048 
00049 FWViewEnergyScaleEditor::~FWViewEnergyScaleEditor()
00050 {
00051 }
00052 
00053 
00054 //
00055 // member functions
00056 //
00057 void
00058 FWViewEnergyScaleEditor::setEnabled(bool x)
00059 {
00060    m_enabled =x;
00061    typedef  std::vector<boost::shared_ptr<FWParameterSetterBase> > sList;
00062    for (sList::iterator i = m_setters.begin(); i!=m_setters.end(); ++i)
00063    {
00064       (*i)->setEnabled(m_enabled);
00065    }
00066 }
00067 
00068 void
00069 FWViewEnergyScaleEditor::addParam(FWParameterBase* param, const char* title)
00070 {
00071    int leftPad = 0;
00072    if (title)
00073    {
00074       leftPad = 10;
00075       AddFrame(new TGLabel(this, title), new TGLayoutHints(kLHintsLeft, leftPad, 0, 0, 0));   
00076       leftPad *= 2;
00077    }
00078    
00079    boost::shared_ptr<FWParameterSetterBase> ptr( FWParameterSetterBase::makeSetterFor(param) );
00080    ptr->attach((FWParameterBase*)param, this);
00081    TGFrame* pframe = ptr->build(this);
00082    AddFrame(pframe, new TGLayoutHints(kLHintsLeft, leftPad, 0, 0, 0));
00083    m_setters.push_back(ptr);
00084 }