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 }
FWGUIValidatingTextEntry::setValidator
void setValidator(FWValidatorBase *)
Definition: FWGUIValidatingTextEntry.cc:78
mps_fire.i
i
Definition: mps_fire.py:355
FWCheckBoxIcon::coreIcondir
static const TString & coreIcondir()
Definition: FWCheckBoxIcon.cc:76
FWCustomIconsButton.h
FWHLTValidator
Definition: FWHLTValidator.h:15
FWGUIEventSelector::m_origSelector
FWEventSelector * m_origSelector
Definition: FWGUIEventSelector.h:38
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
FWGUIEventSelector::m_combo
TGComboBox * m_combo
Definition: FWGUIEventSelector.h:46
FWCheckBoxIcon.h
FWGUIEventSelector::selectorChanged
void selectorChanged()
Definition: FWGUIEventSelector.cc:128
FWEventSelector::m_triggerProcess
std::string m_triggerProcess
Definition: FWEventSelector.h:19
DDAxes::x
FWGUIValidatingTextEntry
Definition: FWGUIValidatingTextEntry.h:35
FWEventSelector.h
FWEventSelector
Definition: FWEventSelector.h:12
alignCSCRings.s
s
Definition: alignCSCRings.py:92
FWGUIEventSelector::m_nEvents
TGLabel * m_nEvents
Definition: FWGUIEventSelector.h:44
vertices_cff.x
x
Definition: vertices_cff.py:29
FWGUIValidatingTextEntry.h
FWGUIEventSelector::~FWGUIEventSelector
~FWGUIEventSelector() override
Definition: FWGUIEventSelector.cc:95
FWGUIEventSelector::m_enableBtn
TGCheckButton * m_enableBtn
Definition: FWGUIEventSelector.h:42
FWEventSelector::m_expression
std::string m_expression
Definition: FWEventSelector.h:17
FWGUIEventSelector
Definition: FWGUIEventSelector.h:15
FWEventSelector::m_selected
int m_selected
Definition: FWEventSelector.h:21
FWGUIEventSelector::removeSelector
void removeSelector(FWGUIEventSelector *)
Definition: FWGUIEventSelector.cc:107
FWCustomIconsButton
Definition: FWCustomIconsButton.h:29
hcaldqm::fClient
Definition: DQModule.h:24
FWGUIEventSelector.h
FWEventSelector::m_description
std::string m_description
Definition: FWEventSelector.h:18
FWGUIEventSelector::m_text2
FWGUIValidatingTextEntry * m_text2
Definition: FWGUIEventSelector.h:41
FWGUIEventSelector::m_guiSelector
FWEventSelector * m_guiSelector
Definition: FWGUIEventSelector.h:37
FWGUIEventSelector::m_text1
FWGUIValidatingTextEntry * m_text1
Definition: FWGUIEventSelector.h:40
FWGUIEventSelector::expressionCallback
void expressionCallback(char *)
Definition: FWGUIEventSelector.cc:122
FWEventSelector::m_updated
bool m_updated
Definition: FWEventSelector.h:22
FWGUIEventSelector::enableCallback
void enableCallback(bool)
Definition: FWGUIEventSelector.cc:101
FWEventSelector::m_enabled
bool m_enabled
Definition: FWEventSelector.h:20
FWGUIEventSelector::triggerProcessCallback
void triggerProcessCallback(const char *)
Definition: FWGUIEventSelector.cc:115
FWHLTValidator.h
FWGUIEventSelector::FWGUIEventSelector
FWGUIEventSelector(TGCompositeFrame *p, FWEventSelector *sel, std::vector< std::string > &triggerProcessList)
Definition: FWGUIEventSelector.cc:11
FWGUIEventSelector::m_validator
FWHLTValidator * m_validator
Definition: FWGUIEventSelector.h:47
FWGUIEventSelector::updateNEvents
void updateNEvents()
Definition: FWGUIEventSelector.cc:135
FWGUIEventSelector::deleteCallback
void deleteCallback()
Definition: FWGUIEventSelector.cc:112
EgammaValidation_Wenu_cff.sel
sel
Definition: EgammaValidation_Wenu_cff.py:33
FWHLTValidator::setProcess
void setProcess(const char *x)
Definition: FWHLTValidator.h:20
FWGUIEventSelector::m_deleteBtn
FWCustomIconsButton * m_deleteBtn
Definition: FWGUIEventSelector.h:43