Public Member Functions | Private Attributes | List of all members
evdb::ParamFrame Class Reference

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

#include "/cvmfs/nova.opensciencegrid.org/externals/nuevdb/v1_00_02/source/nuevdb/EventDisplayBase/ParameterSetEdit.h"

Public Member Functions

 ParamFrame (const TGWindow *p, std::vector< std::string > &names, std::vector< std::string > &value, 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 Attributes

TGGroupFrame * fFrame
 
TGCanvas * fCanvas
 
TGMatrixLayout * fML
 

Detailed Description

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

Definition at line 21 of file ParameterSetEdit.h.

Constructor & Destructor Documentation

evdb::ParamFrame::ParamFrame ( const TGWindow *  p,
std::vector< std::string > &  names,
std::vector< std::string > &  value,
std::vector< TGTextEntry * > &  fT2 
)

Definition at line 60 of file ParameterSetEdit.cxx.

References b, compare(), fCanvas, fFrame, fML, make_syst_table_plots::h, MECModelEnuComparisons::i, and confusionMatrixTree::t.

64  {
65  // Create tile view container. Used to show colormap.
66 
67  fFrame = new TGGroupFrame(p, "Parameters", kVerticalFrame);
68 
69  TGLayoutHints* fLH3 = new TGLayoutHints(kLHintsCenterX|kLHintsExpandX,
70  2,2,2,2);
71 
72  fML = new TGMatrixLayout(fFrame, 0, 2, 2);
73  fFrame->SetLayoutManager(fML);
74  int h=26;
75 
76  for (unsigned int i=0; i<name.size(); ++i) {
77  // skip if the name is module_label, module_type or service_type
78  if((name[i].compare("module_label") == 0) ||
79  (name[i].compare("module_type") == 0) ||
80  (name[i].compare("service_type") == 0)) continue;
81 
82  // Build the parameter label
83  TGTextButton*
84  b = new TGTextButton(fFrame,
85  name[i].c_str(),
86  -1,
87  TGButton::GetDefaultGC()(),
88  TGTextButton::GetDefaultFontStruct(),
89  0);
90  fFrame->AddFrame(b, fLH3);
91 
92  // Build the text edit box for the values
93  TGTextEntry* t = new TGTextEntry(fFrame, value[i].c_str());
94 
95  // Set the size of the edit box
96  t->Resize(225,18);
97  fFrame->AddFrame(t, fLH3);
98  fT2.push_back(t);
99  h += 26;
100  }
101  if (h>30*26) h = 30*26;
102 
103  fFrame->Resize(fFrame->GetWidth(), h);
104 
105  fFrame->Connect("ProcessedEvent(Event_t*)", "evdb::ParamFrame", this,
106  "HandleMouseWheel(Event_t*)");
107  fCanvas = 0;
108 
109  delete fLH3;
110  }
const XML_Char * name
Definition: expat.h:151
const char * p
Definition: xmltok.h:285
TGMatrixLayout * fML
const XML_Char int const XML_Char * value
Definition: expat.h:331
TGGroupFrame * fFrame
bool compare(const GFluxGenerator &g1, const GFluxGenerator &g2)
const hit & b
Definition: hits.cxx:21
virtual evdb::ParamFrame::~ParamFrame ( )
inlinevirtual

Definition at line 35 of file ParameterSetEdit.h.

References fFrame.

35 { delete fFrame; }
TGGroupFrame * fFrame

Member Function Documentation

TGGroupFrame* evdb::ParamFrame::GetFrame ( ) const
inline

Definition at line 37 of file ParameterSetEdit.h.

References fFrame.

Referenced by evdb::ParameterSetEdit::ParameterSetEdit().

37 { return fFrame; }
TGGroupFrame * fFrame
int evdb::ParamFrame::GetHeight ( ) const

Definition at line 114 of file ParameterSetEdit.cxx.

References fFrame.

Referenced by evdb::ParameterSetEdit::ParameterSetEdit(), and SetCanvas().

115  {
116  if (fFrame) return fFrame->GetHeight();
117  else return 0;
118  }
TGGroupFrame * fFrame
int evdb::ParamFrame::GetWidth ( ) const

Definition at line 122 of file ParameterSetEdit.cxx.

References fFrame.

Referenced by SetCanvas().

123  {
124  if (fFrame) return fFrame->GetWidth();
125  else return 0;
126  }
TGGroupFrame * fFrame
void evdb::ParamFrame::HandleMouseWheel ( Event_t *  event)

Definition at line 130 of file ParameterSetEdit.cxx.

References fCanvas, and makeDatasetsPage::page.

Referenced by SetCanvas().

131  {
132  // Handle mouse wheel to scroll.
133 
134  if (event->fType != kButtonPress && event->fType != kButtonRelease)
135  return;
136 
137  Int_t page = 0;
138  if (event->fCode == kButton4 || event->fCode == kButton5) {
139  if (!fCanvas) return;
140  if (fCanvas->GetContainer()->GetHeight())
141  page = Int_t(Float_t(fCanvas->GetViewPort()->GetHeight() *
142  fCanvas->GetViewPort()->GetHeight()) /
143  fCanvas->GetContainer()->GetHeight());
144  }
145 
146  if (event->fCode == kButton4) {
147  //scroll up
148  Int_t newpos = fCanvas->GetVsbPosition() - page;
149  if (newpos < 0) newpos = 0;
150  fCanvas->SetVsbPosition(newpos);
151  }
152  if (event->fCode == kButton5) {
153  // scroll down
154  Int_t newpos = fCanvas->GetVsbPosition() + page;
155  fCanvas->SetVsbPosition(newpos);
156  }
157  }
void evdb::ParamFrame::SetCanvas ( TGCanvas *  canvas)
inline

Member Data Documentation

TGCanvas* evdb::ParamFrame::fCanvas
private

Definition at line 26 of file ParameterSetEdit.h.

Referenced by HandleMouseWheel(), and ParamFrame().

TGGroupFrame* evdb::ParamFrame::fFrame
private

Definition at line 25 of file ParameterSetEdit.h.

Referenced by GetFrame(), GetHeight(), GetWidth(), ParamFrame(), and ~ParamFrame().

TGMatrixLayout* evdb::ParamFrame::fML
private

Definition at line 27 of file ParameterSetEdit.h.

Referenced by ParamFrame().


The documentation for this class was generated from the following files: