CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

FWLongParameterSetter Class Reference

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

Inheritance diagram for FWLongParameterSetter:
FWParameterSetterBase

List of all members.

Public Member Functions

virtual void attach (FWParameterBase *)
virtual TGFrame * build (TGFrame *iParent, bool labelBack=true)
void doUpdate (Long_t)
 FWLongParameterSetter ()
virtual ~FWLongParameterSetter ()

Private Member Functions

 FWLongParameterSetter (const FWLongParameterSetter &)
const FWLongParameterSetteroperator= (const FWLongParameterSetter &)

Private Attributes

FWLongParameterm_param
TGNumberEntry * m_widget

Detailed Description

Description: <one line="" class="" summary>="">

Usage: <usage>

Definition at line 32 of file FWLongParameterSetter.h.


Constructor & Destructor Documentation

FWLongParameterSetter::FWLongParameterSetter ( )

Definition at line 36 of file FWLongParameterSetter.cc.

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

Definition at line 47 of file FWLongParameterSetter.cc.

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

Member Function Documentation

void FWLongParameterSetter::attach ( FWParameterBase iParam) [virtual]

Implements FWParameterSetterBase.

Definition at line 68 of file FWLongParameterSetter.cc.

References m_param.

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

Implements FWParameterSetterBase.

Definition at line 75 of file FWLongParameterSetter.cc.

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

{
   TGCompositeFrame* frame = new TGHorizontalFrame(iParent);

   // number entry widget
   TGNumberFormat::ELimit limits = m_param->min()==m_param->max() ?
      TGNumberFormat::kNELNoLimits :
      ( m_param->min() > m_param->max() ? TGNumberFormat::kNELLimitMin : TGNumberFormat::kNELLimitMinMax);
   double min = 0;
   double max = 1;
   if (m_param->min()!=m_param->max())
   {
      min=m_param->min();
      max=m_param->max();
   }
   m_widget = new TGNumberEntry
      (frame, m_param->value(),
       5,                         // number of digits
       0,                         // widget ID
       TGNumberFormat::kNESInteger, // style
       TGNumberFormat::kNEAAnyNumber, // input value filter
       limits,                    // specify limits
       min,                       // min value
       max);                      // max value

   m_widget->Connect("ValueSet(Long_t)", "FWLongParameterSetter", this, "doUpdate(Long_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,2,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 FWLongParameterSetter::doUpdate ( Long_t  )

Definition at line 119 of file FWLongParameterSetter.cc.

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

{
   //std::cout <<"doUpdate called"<<std::endl;

   // Idiotic TGNumberEntry arrow buttons can send several events and if
   // individual event processing takes longer it can happen that the widget
   // gets detroyed in the meantime. So, process all events from arrows as
   // soon as possible.
   static bool in_update = false;
   if (in_update)
      return;
   in_update = true;
   gClient->ProcessEventsFor((TGWindow*)gTQSender);
   in_update = false;
      
   assert(0!=m_param);
   assert(0!=m_widget);
   //std::cout <<m_widget->GetNumberEntry()->GetNumber()<<std::endl;
   m_param->set(m_widget->GetNumberEntry()->GetIntNumber());
   update();
}
const FWLongParameterSetter& FWLongParameterSetter::operator= ( const FWLongParameterSetter ) [private]

Member Data Documentation

Definition at line 55 of file FWLongParameterSetter.h.

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

TGNumberEntry* FWLongParameterSetter::m_widget [private]

Definition at line 56 of file FWLongParameterSetter.h.

Referenced by build(), and doUpdate().