CMS 3D CMS Logo

FWGUIEventSelector.cc
Go to the documentation of this file.
1 #include "TGLabel.h"
2 #include "TGComboBox.h"
3 
10 
13  std::vector<std::string>& triggerProcessList)
14  : TGHorizontalFrame(p),
15  m_guiSelector(nullptr),
16  m_origSelector(nullptr),
17  m_text1(nullptr),
18  m_text2(nullptr),
19  m_enableBtn(nullptr),
20  m_deleteBtn(nullptr),
21  m_nEvents(nullptr),
22  m_combo(nullptr),
23  m_validator(nullptr) {
26 
27  if (!m_guiSelector->m_triggerProcess.empty()) {
28  m_combo = new TGComboBox(this);
29  int cnt = 0;
30  int id = -1;
31  for (std::vector<std::string>::iterator i = triggerProcessList.begin(); i != triggerProcessList.end(); ++i) {
32  if (*i == sel->m_triggerProcess)
33  id = cnt;
34  m_combo->AddEntry((*i).c_str(), cnt++);
35  }
36 
37  if (id < 0) {
38  m_combo->AddEntry(sel->m_triggerProcess.c_str(), cnt);
39  id = cnt;
40  }
41  m_combo->Select(id, false);
42  m_combo->Resize(80, 21);
43  AddFrame(m_combo, new TGLayoutHints(kLHintsNormal, 2, 2, 0, 1));
44 
46  m_combo->Connect("Selected(const char*)", "FWGUIEventSelector", this, "triggerProcessCallback(const char*)");
47  }
48 
49  // -------------- expression
50 
52  m_text1->SetHeight(20);
54  m_text1->ChangeOptions(0);
55  m_text1->Connect("TextChanged(char*)", "FWGUIEventSelector", this, "expressionCallback(char*)");
56  AddFrame(m_text1, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 2, 2, 1, 1));
57 
58  // -------------- comment
59 
60  TGCompositeFrame* cfr = new TGHorizontalFrame(this, 120, 20, kFixedSize);
61  AddFrame(cfr, new TGLayoutHints(kLHintsNormal, 2, 2, 1, 3));
63  // m_text2->SetHeight(21);
65  m_text2->ChangeOptions(0);
66  m_text2->Connect("TextChanged(char*)", "string", &m_guiSelector->m_description, "assign(char*)");
67  cfr->AddFrame(m_text2, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 2, 2, 0, 0));
68 
69  // ---------------- selection info
70 
71  TGHorizontalFrame* labFrame = new TGHorizontalFrame(this, 60, 22, kFixedSize);
72  AddFrame(labFrame, new TGLayoutHints(kLHintsBottom, 2, 2, 2, 2));
73  m_nEvents = new TGLabel(labFrame, "");
74  m_nEvents->SetTextJustify(kTextLeft);
75  labFrame->AddFrame(m_nEvents, new TGLayoutHints(kLHintsCenterY | kLHintsExpandX));
76  updateNEvents();
77 
78  // ---------------- enable
79 
80  m_enableBtn = new TGCheckButton(this, "");
81  m_enableBtn->SetToolTipText("Enable/disable the selection");
83  m_enableBtn->Connect("Toggled(bool)", "FWGUIEventSelector", this, "enableCallback(bool)");
84  AddFrame(m_enableBtn, new TGLayoutHints(kLHintsNormal | kLHintsCenterY, 2, 2, 0, 0));
85 
86  // ---------------- delete
88  fClient->GetPicture(FWCheckBoxIcon::coreIcondir() + "delete.png"),
89  fClient->GetPicture(FWCheckBoxIcon::coreIcondir() + "delete-over.png"),
90  fClient->GetPicture(FWCheckBoxIcon::coreIcondir() + "delete-disabled.png"));
91  AddFrame(m_deleteBtn, new TGLayoutHints(kLHintsRight | kLHintsCenterY, 2, 2, 0, 0));
92  TQObject::Connect(m_deleteBtn, "Clicked()", "FWGUIEventSelector", this, "deleteCallback()");
93 }
94 //____________________________________________________________________________
96  delete m_guiSelector;
97  delete m_validator;
98 }
99 
100 //____________________________________________________________________________
103  selectorChanged();
104 }
105 
106 //______________________________________________________________________________
108  Emit("removeSelector(FWGUIEventSelector*)", (Long_t)s);
109 }
110 
111 //______________________________________________________________________________
113 
114 //______________________________________________________________________________
117  m_validator->setProcess(txt);
118  selectorChanged();
119 }
120 
121 //______________________________________________________________________________
124  selectorChanged();
125 }
126 
127 //______________________________________________________________________________
129  if (m_origSelector)
130  m_origSelector->m_updated = false;
131  Emit("selectorChanged()");
132 }
133 
134 //______________________________________________________________________________
137  m_nEvents->Enable();
138  const char* txtInfo = Form("%3d", m_origSelector ? m_origSelector->m_selected : -1);
139  m_nEvents->SetText(txtInfo);
140  } else {
141  m_nEvents->Disable();
142  m_nEvents->SetText("no check");
143  }
144 }
static const TString & coreIcondir()
void removeSelector(FWGUIEventSelector *)
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
float x
void triggerProcessCallback(const char *)
~FWGUIEventSelector() override
TGCheckButton * m_enableBtn