Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

evdb::ParamFrame Class Reference

Helper class to setup scroll bars in evdb::CfgEdit. More...

#include <CfgEdit.h>

List of all members.

Public Member Functions

 ParamFrame (const TGWindow *p, cfg::Config *cfg, std::vector< std::string > &names, std::vector< std::string > &tags, std::vector< std::string > &comments, std::vector< TGTextEntry * > &fT2)
virtual ~ParamFrame ()
TGGroupFrame * GetFrame () const
void SetCanvas (TGCanvas *canvas)
void HandleMouseWheel (Event_t *event)
int GetHeight () const
int GetWidth () const

Private Member Functions

 RQ_OBJECT ("evdb::ParamFrame")

Private Attributes

TGGroupFrame * fFrame
TGCanvas * fCanvas
TGMatrixLayout * fML


Detailed Description

Helper class to setup scroll bars in evdb::CfgEdit.

Definition at line 23 of file CfgEdit.h.


Constructor & Destructor Documentation

ParamFrame::ParamFrame const TGWindow *  p,
cfg::Config cfg,
std::vector< std::string > &  names,
std::vector< std::string > &  tags,
std::vector< std::string > &  comments,
std::vector< TGTextEntry * > &  fT2
 

Definition at line 35 of file CfgEdit.cxx.

References cfg::Param::GetComment(), cfg::Param::GetName(), and cfg::Param::XMLTag().

00041 {
00042   // Create tile view container. Used to show colormap.
00043   
00044   fFrame = new TGGroupFrame(p, "Parameters", kVerticalFrame);
00045 
00046   TGLayoutHints* fLH3 = new TGLayoutHints(kLHintsCenterX|kLHintsExpandX,
00047                                           2,2,2,2);
00048 
00049   fML = new TGMatrixLayout(fFrame, 0, 2, 2);
00050   fFrame->SetLayoutManager(fML);
00051   cfg::Config::ParamMap::iterator itr   (cfg->ParMap().begin());
00052   cfg::Config::ParamMap::iterator itrEnd(cfg->ParMap().end());
00053 
00054   int h=0;
00055 
00056   for (;itr!=itrEnd;++itr) {
00057     cfg::Param* p = itr->second;
00058 
00059     // Store the parameter fields for later edit operation
00060     name.   push_back( p->GetName() );
00061     tag.    push_back( p->XMLTag()  );
00062     comment.push_back( p->GetComment() );
00063     
00064     // Build the parameter label
00065     std::ostringstream tag;
00066     tag << p->GetName() << "  <" << p->XMLTag() << ">";
00067     TGTextButton*
00068       b = new TGTextButton(fFrame, 
00069                            tag.str().c_str(),
00070                            -1, 
00071                            TGButton::GetDefaultGC()(),
00072                            TGTextButton::GetDefaultFontStruct(), 
00073                            0);
00074     b->SetToolTipText(p->GetComment());
00075     fFrame->AddFrame(b, fLH3);
00076     
00077     // Build the text edit box for the values
00078     std::ostringstream value;
00079     value << (*p);
00080     TGTextEntry* t = new TGTextEntry(fFrame, value.str().c_str());
00081     
00082     // Set the size of the edit box
00083     t->Resize(225,18);
00084     fFrame->AddFrame(t, fLH3);
00085     fT2.push_back(t);
00086     h += 18;
00087   }
00088 
00089   fFrame->Resize(fFrame->GetWidth(), 400);
00090 
00091   fFrame->Connect("ProcessedEvent(Event_t*)", "evdb::ParamFrame", this,
00092                   "HandleMouseWheel(Event_t*)");
00093   fCanvas = 0;
00094 
00095   delete fLH3;
00096 }

virtual evdb::ParamFrame::~ParamFrame  )  [inline, virtual]
 

Definition at line 38 of file CfgEdit.h.

00038 { delete fFrame; }


Member Function Documentation

TGGroupFrame* evdb::ParamFrame::GetFrame  )  const [inline]
 

Definition at line 40 of file CfgEdit.h.

Referenced by evdb::CfgEdit::CfgEdit().

00040 { return fFrame; }

int ParamFrame::GetHeight  )  const
 

Definition at line 100 of file CfgEdit.cxx.

References fFrame.

Referenced by evdb::CfgEdit::CfgEdit().

00101 {
00102   if (fFrame) return fFrame->GetHeight();
00103   else        return 0;
00104 }

int ParamFrame::GetWidth  )  const
 

Definition at line 108 of file CfgEdit.cxx.

References fFrame.

00109 {
00110   if (fFrame) return fFrame->GetWidth();
00111   else        return 0;
00112 }

void ParamFrame::HandleMouseWheel Event_t *  event  ) 
 

Definition at line 116 of file CfgEdit.cxx.

References fCanvas.

00117 {
00118   // Handle mouse wheel to scroll.
00119   
00120   if (event->fType != kButtonPress && event->fType != kButtonRelease)
00121     return;
00122   
00123   Int_t page = 0;
00124   if (event->fCode == kButton4 || event->fCode == kButton5) {
00125     if (!fCanvas) return;
00126     if (fCanvas->GetContainer()->GetHeight())
00127       page = Int_t(Float_t(fCanvas->GetViewPort()->GetHeight() *
00128                            fCanvas->GetViewPort()->GetHeight()) /
00129                    fCanvas->GetContainer()->GetHeight());
00130   }
00131   
00132   if (event->fCode == kButton4) {
00133     //scroll up
00134     Int_t newpos = fCanvas->GetVsbPosition() - page;
00135     if (newpos < 0) newpos = 0;
00136     fCanvas->SetVsbPosition(newpos);
00137   }
00138   if (event->fCode == kButton5) {
00139     // scroll down
00140     Int_t newpos = fCanvas->GetVsbPosition() + page;
00141     fCanvas->SetVsbPosition(newpos);
00142   }
00143 }

evdb::ParamFrame::RQ_OBJECT "evdb::ParamFrame"   )  [private]
 

void evdb::ParamFrame::SetCanvas TGCanvas *  canvas  )  [inline]
 

Definition at line 42 of file CfgEdit.h.

Referenced by evdb::CfgEdit::CfgEdit().

00042 { fCanvas = canvas; }


Member Data Documentation

TGCanvas* evdb::ParamFrame::fCanvas [private]
 

Definition at line 28 of file CfgEdit.h.

Referenced by HandleMouseWheel().

TGGroupFrame* evdb::ParamFrame::fFrame [private]
 

Definition at line 27 of file CfgEdit.h.

Referenced by GetHeight(), and GetWidth().

TGMatrixLayout* evdb::ParamFrame::fML [private]
 

Definition at line 29 of file CfgEdit.h.


The documentation for this class was generated from the following files:
Generated on Sun Mar 15 04:45:26 2009 for NOvA Offline by  doxygen 1.3.9.1