CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

FWEnumParameterSetter Class Reference

#include <Fireworks/Core/interface/FWEnumParameterSetter.h>

Inheritance diagram for FWEnumParameterSetter:
FWParameterSetterBase

List of all members.

Public Member Functions

virtual TGFrame * build (TGFrame *iParent, bool labelBack=true)
void doUpdate (Int_t id)
 FWEnumParameterSetter ()
TGComboBox * getWidget ()
virtual void setEnabled (bool)
virtual ~FWEnumParameterSetter ()

Private Member Functions

virtual void attach (FWParameterBase *)
 FWEnumParameterSetter (const FWEnumParameterSetter &)
const FWEnumParameterSetteroperator= (const FWEnumParameterSetter &)

Private Attributes

FWEnumParameterm_param
TGComboBox * m_widget

Detailed Description

Description: [one line class summary]

Usage: <usage>

Definition at line 32 of file FWEnumParameterSetter.h.


Constructor & Destructor Documentation

FWEnumParameterSetter::FWEnumParameterSetter ( )

Definition at line 32 of file FWEnumParameterSetter.cc.

                                             :
   m_param(0),
   m_widget(0)
{}
FWEnumParameterSetter::~FWEnumParameterSetter ( ) [virtual]

Definition at line 42 of file FWEnumParameterSetter.cc.

{}
FWEnumParameterSetter::FWEnumParameterSetter ( const FWEnumParameterSetter ) [private]

Member Function Documentation

void FWEnumParameterSetter::attach ( FWParameterBase iParam) [private, virtual]

Implements FWParameterSetterBase.

Definition at line 62 of file FWEnumParameterSetter.cc.

References m_param.

{
   m_param = dynamic_cast<FWEnumParameter*>(iParam);
   assert(0!=m_param);
}
TGFrame * FWEnumParameterSetter::build ( TGFrame *  iParent,
bool  labelBack = true 
) [virtual]

Implements FWParameterSetterBase.

Definition at line 69 of file FWEnumParameterSetter.cc.

References FWEnumParameter::entryMap(), FWParameterSetterBase::frame(), diffTwoXMLs::label, m_param, m_widget, FWParameterBase::name(), and FWGenericParameter< T >::value().

{
   TGCompositeFrame *frame = new TGHorizontalFrame(iParent);

   m_widget = new TGComboBox(frame);
   std::map<Long_t, std::string>::const_iterator me = m_param->entryMap().begin();
   UInt_t max_len = 0;
   while (me != m_param->entryMap().end())
   {
      m_widget->AddEntry(me->second.c_str(), static_cast<Int_t>(me->first));
      if (me->second.length() > max_len) max_len = me->second.length();
      ++me;
   }
   m_widget->Resize(8*max_len + 20, 20);
   m_widget->Select(static_cast<Int_t>(m_param->value()), kFALSE);

   m_widget->Connect("Selected(Int_t)", "FWEnumParameterSetter", this, "doUpdate(Int_t)");

   // label
   TGLabel* label = new TGLabel(frame, m_param->name().c_str());
   if (labelBack)
   {
      frame->AddFrame(m_widget, new TGLayoutHints(kLHintsLeft|kLHintsCenterY, 2,6,2,2));
      frame->AddFrame(label, new TGLayoutHints(kLHintsLeft|kLHintsCenterY, 2, 4, 0, 0));
   }
   else
   {
      frame->AddFrame(label, new TGLayoutHints(kLHintsLeft|kLHintsCenterY) );
      frame->AddFrame(m_widget, new TGLayoutHints(kLHintsLeft|kLHintsCenterY, 2,8,2,2));
   }
   return frame;
}
void FWEnumParameterSetter::doUpdate ( Int_t  id)

Definition at line 103 of file FWEnumParameterSetter.cc.

References m_param, m_widget, FWGenericParameter< T >::set(), and FWParameterSetterBase::update().

{
   assert(0!=m_param);
   assert(0!=m_widget);
   m_param->set((Long_t) id);
   update();
}
TGComboBox* FWEnumParameterSetter::getWidget ( ) [inline]

Definition at line 51 of file FWEnumParameterSetter.h.

References m_widget.

{ return m_widget; }
const FWEnumParameterSetter& FWEnumParameterSetter::operator= ( const FWEnumParameterSetter ) [private]
void FWEnumParameterSetter::setEnabled ( bool  x) [virtual]

Reimplemented from FWParameterSetterBase.

Definition at line 112 of file FWEnumParameterSetter.cc.

References m_widget.

{
   m_widget->SetEnabled(x);
}

Member Data Documentation

Definition at line 61 of file FWEnumParameterSetter.h.

Referenced by attach(), build(), and doUpdate().

TGComboBox* FWEnumParameterSetter::m_widget [private]

Definition at line 62 of file FWEnumParameterSetter.h.

Referenced by build(), doUpdate(), getWidget(), and setEnabled().