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

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

#include <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.

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  }
static QCString name
Definition: declinfo.cpp:673
int compare(unsigned *r, sha1::digest_t const &d)
Definition: sha1_test_2.cc:61
uint size() const
Definition: qcstring.h:201
TGMatrixLayout * fML
p
Definition: test.py:223
TGGroupFrame * fFrame
static bool * b
Definition: config.cpp:1043
h
training ###############################
Definition: train_cnn.py:186
virtual evdb::ParamFrame::~ParamFrame ( )
inlinevirtual

Definition at line 35 of file ParameterSetEdit.h.

35 { delete fFrame; }
TGGroupFrame * fFrame

Member Function Documentation

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

Definition at line 37 of file ParameterSetEdit.h.

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

Definition at line 114 of file ParameterSetEdit.cxx.

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.

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.

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  }
Event finding and building.
void evdb::ParamFrame::SetCanvas ( TGCanvas *  canvas)
inline

Definition at line 39 of file ParameterSetEdit.h.

39 { fCanvas = canvas; }

Member Data Documentation

TGCanvas* evdb::ParamFrame::fCanvas
private

Definition at line 26 of file ParameterSetEdit.h.

TGGroupFrame* evdb::ParamFrame::fFrame
private

Definition at line 25 of file ParameterSetEdit.h.

TGMatrixLayout* evdb::ParamFrame::fML
private

Definition at line 27 of file ParameterSetEdit.h.


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