CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FWGUIEventSelector.cc
Go to the documentation of this file.
1 #include "TGLabel.h"
2 #include "TGComboBox.h"
3 
10 
11 
12 FWGUIEventSelector::FWGUIEventSelector(TGCompositeFrame* p, FWEventSelector* sel, std::vector<std::string>& triggerProcessList):
13  TGHorizontalFrame(p),
14  m_guiSelector(0),
15  m_origSelector(0),
16  m_text1(0),
17  m_text2(0),
18  m_enableBtn(0),
19  m_deleteBtn(0),
20  m_nEvents(0),
21  m_combo(0),
22  m_validator(0)
23 {
26 
27  if (!m_guiSelector->m_triggerProcess.empty())
28  {
29  m_combo = new TGComboBox(this);
30  int cnt = 0;
31  int id = -1;
32  for ( std::vector<std::string>::iterator i = triggerProcessList.begin(); i!=triggerProcessList.end(); ++i)
33  {
34  if ((*i).c_str() == sel->m_triggerProcess) id = cnt;
35  m_combo->AddEntry((*i).c_str(), cnt++);
36  }
37 
38  if (id < 0)
39  {
40  m_combo->AddEntry(sel->m_triggerProcess.c_str(), cnt);
41  id = cnt;
42  }
43  m_combo->Select(id, false);
44  m_combo->Resize(80, 21);
45  AddFrame(m_combo, new TGLayoutHints(kLHintsNormal, 2,2,0,1));
46 
48  m_combo->Connect("Selected(const char*)", "FWGUIEventSelector", this, "triggerProcessCallback(const char*)");
49  }
50 
51  // -------------- expression
52 
54  m_text1->SetHeight(20);
56  m_text1->ChangeOptions(0);
57  m_text1->Connect("TextChanged(char*)", "FWGUIEventSelector", this, "expressionCallback(char*)");
58  AddFrame(m_text1, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 2,2,1,1));
59 
60  // -------------- comment
61 
62  TGCompositeFrame *cfr = new TGHorizontalFrame(this, 120, 20, kFixedSize);
63  AddFrame(cfr,new TGLayoutHints( kLHintsNormal, 2, 2, 1, 3 ));
65  // m_text2->SetHeight(21);
67  m_text2->ChangeOptions(0);
68  m_text2->Connect("TextChanged(char*)", "string", &m_guiSelector->m_description, "assign(char*)");
69  cfr->AddFrame(m_text2, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 2,2,0,0));
70 
71  // ---------------- selection info
72 
73  TGHorizontalFrame* labFrame = new TGHorizontalFrame(this, 60, 22, kFixedSize);
74  AddFrame(labFrame, new TGLayoutHints(kLHintsBottom, 2, 2, 2, 2));
75  m_nEvents = new TGLabel(labFrame, "");
76  m_nEvents->SetTextJustify(kTextLeft );
77  labFrame->AddFrame(m_nEvents, new TGLayoutHints(kLHintsCenterY|kLHintsExpandX));
78  updateNEvents();
79 
80  // ---------------- enable
81 
82  m_enableBtn = new TGCheckButton(this,"");
83  m_enableBtn->SetToolTipText("Enable/disable the selection");
85  m_enableBtn->Connect("Toggled(bool)","FWGUIEventSelector", this, "enableCallback(bool)");
86  AddFrame(m_enableBtn, new TGLayoutHints(kLHintsNormal | kLHintsCenterY , 2, 2, 0, 0));
87 
88  // ---------------- delete
89  m_deleteBtn = new FWCustomIconsButton(this, fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"delete.png"),
90  fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"delete-over.png"),
91  fClient->GetPicture(FWCheckBoxIcon::coreIcondir()+"delete-disabled.png"));
92  AddFrame(m_deleteBtn, new TGLayoutHints(kLHintsRight|kLHintsCenterY, 2,2,0, 0));
93  TQObject::Connect(m_deleteBtn, "Clicked()", "FWGUIEventSelector", this, "deleteCallback()");
94 
95 }
96 //____________________________________________________________________________
98 {
99  delete m_guiSelector;
100  delete m_validator;
101 }
102 
103 //____________________________________________________________________________
105 {
107  selectorChanged();
108 }
109 
110 //______________________________________________________________________________
112 {
113  Emit("removeSelector(FWGUIEventSelector*)", (Long_t)s);
114 }
115 
116 //______________________________________________________________________________
118 {
119  removeSelector(this);
120 }
121 
122 //______________________________________________________________________________
124 {
126  m_validator->setProcess(txt);
127  selectorChanged();
128 }
129 
130 //______________________________________________________________________________
132 {
134  selectorChanged();
135 }
136 
137 //______________________________________________________________________________
139 {
141  Emit("selectorChanged()");
142 }
143 
144 //______________________________________________________________________________
146 {
147 
149  {
150  m_nEvents->Enable();
151  const char* txtInfo = Form("%3d", m_origSelector ? m_origSelector->m_selected : -1);
152  m_nEvents->SetText(txtInfo);
153  }
154  else
155  {
156  m_nEvents->Disable();
157  m_nEvents->SetText("no check");
158  }
159 }
static const TString & coreIcondir()
void removeSelector(FWGUIEventSelector *)
int i
Definition: DBlmapReader.cc:9
FWGUIValidatingTextEntry * m_text2
FWGUIValidatingTextEntry * m_text1
void expressionCallback(char *)
std::string m_triggerProcess
FWGUIEventSelector(TGCompositeFrame *p, FWEventSelector *sel, std::vector< std::string > &triggerProcessList)
FWEventSelector * m_origSelector
void setProcess(const char *x)
FWHLTValidator * m_validator
std::string m_expression
FWCustomIconsButton * m_deleteBtn
void setValidator(FWValidatorBase *)
std::string m_description
FWEventSelector * m_guiSelector
void triggerProcessCallback(const char *)
Definition: DDAxes.h:10
TGCheckButton * m_enableBtn