Simple utilities for GENIE Graphical User Interface widgets.
More...
Simple utilities for GENIE Graphical User Interface widgets.
- Author
- Costas Andreopoulos <c.andreopoulos \at cern.ch> University of Liverpool
- Created:\n January 12, 2004
- License:\n Copyright (c) 2003-2025, The GENIE Collaboration
- For the full text of the license visit http://copyright.genie-mc.org
◆ ComboBoxSelectionAsString()
| string genie::utils::gui::ComboBoxSelectionAsString |
( |
TGComboBox * | cb, |
|
|
const char * | cbitems[] ) |
Definition at line 142 of file GUIUtils.cxx.
144{
145 TGLBEntry * selected_entry = cb->GetSelectedEntry();
146
147 if(selected_entry) return string(cbitems[selected_entry->EntryId()]);
148 else return "";
149}
◆ ComboBoxSelectionId()
| int genie::utils::gui::ComboBoxSelectionId |
( |
const char * | cbitems[], |
|
|
const char * | sel ) |
Definition at line 151 of file GUIUtils.cxx.
153{
154 int i = 0;
155 while( cbitems[i] ) {
156 if ( strcmp(cbitems[i], selection) == 0 ) return i;
157 i++;
158 }
159 return 0;
160}
◆ FillComboBox() [1/2]
| void genie::utils::gui::FillComboBox |
( |
TGComboBox * | cb, |
|
|
const char * | cbitems[] ) |
Definition at line 117 of file GUIUtils.cxx.
118{
119 int i = 0;
120 while( cbitems[i] )
121 {
122 cb->AddEntry(cbitems[i], i);
123 i++;
124 }
125}
◆ FillComboBox() [2/2]
| void genie::utils::gui::FillComboBox |
( |
TGComboBox * | cb, |
|
|
const vector< string > * | cbitems ) |
Definition at line 127 of file GUIUtils.cxx.
129{
130 int i = 0;
131 vector<string>::const_iterator cbiter;
132
133 for(cbiter = cbitems->begin(); cbiter != cbitems->end(); ++cbiter) {
134
135 if( cbiter->size() > 0 ) {
136 cb->AddEntry( cbiter->c_str(), i);
137 i++;
138 }
139 }
140}
◆ FillListBox() [1/2]
| void genie::utils::gui::FillListBox |
( |
TGListBox * | lb, |
|
|
const char * | lbitems[] ) |
Definition at line 22 of file GUIUtils.cxx.
23{
24 int i = 0;
25 while( lbitems[i] )
26 {
27 lb->AddEntry(lbitems[i], i);
28 i++;
29 }
30}
◆ FillListBox() [2/2]
| void genie::utils::gui::FillListBox |
( |
TGListBox * | lb, |
|
|
const vector< string > * | lbitems ) |
Definition at line 32 of file GUIUtils.cxx.
34{
35 int i = 0;
36 vector<string>::const_iterator lbiter;
37
38 for(lbiter = lbitems->begin(); lbiter != lbitems->end(); ++lbiter) {
39
40 if( lbiter->size() > 0 ) {
41
42 lb->AddEntry( lbiter->c_str(), i);
43 i++;
44 }
45 }
46}
◆ ListBoxSelectionAsString()
| string genie::utils::gui::ListBoxSelectionAsString |
( |
TGListBox * | lb, |
|
|
const char * | lbitems[] ) |
Definition at line 78 of file GUIUtils.cxx.
80{
81 TList selections;
82
83 lb->GetSelectedEntries( &selections );
84
85 TGLBEntry * lbentry = 0;
86
87 TIter selection_iter(&selections);
88
89 int i = 0;
90
91 ostringstream str_select;
92
93 while( (lbentry = (TGLBEntry *) selection_iter.Next()) ) {
94
95 str_select << lbitems[ lbentry->EntryId() ];
96
97 if(++i < selections.GetSize() ) str_select << ", ";
98 }
99
100 if(i==0) return "empty";
101
102 return str_select.str();
103}
◆ ListBoxSelectionId()
| int genie::utils::gui::ListBoxSelectionId |
( |
const char * | lbitems[], |
|
|
const char * | sel ) |
Definition at line 105 of file GUIUtils.cxx.
107{
108 int i = 0;
109 while( lbitems[i] )
110 {
111 if ( strcmp(lbitems[i], selection) == 0 ) return i;
112 i++;
113 }
114 return 0;
115}
◆ ResetAllListBoxSelections()
| void genie::utils::gui::ResetAllListBoxSelections |
( |
TGListBox * | lb | ) |
|
Definition at line 58 of file GUIUtils.cxx.
59{
60 SLOG(
"GuiUtils",
pDEBUG) <<
"Reseting all listbox entries";
61 SLOG(
"GuiUtils",
pDEBUG) <<
"n-entries = " << lb->GetNumberOfEntries();
62
63 TList * selected_entries = new TList();
64 TGLBEntry * selected_entry = 0;
65
66 lb->GetSelectedEntries(selected_entries);
67
68 TIter lbentry(selected_entries);
69
70 while( (selected_entry = (TGLBEntry *) lbentry.Next()) )
71 lb->Select( selected_entry->EntryId() , kFALSE);
72
73 delete selected_entries;
74
75 lb->SelectionChanged();
76}
#define SLOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a short string (using the FUNCTION and...
References pDEBUG, and SLOG.
◆ SelectAllListBoxEntries()
| void genie::utils::gui::SelectAllListBoxEntries |
( |
TGListBox * | lb | ) |
|
Definition at line 48 of file GUIUtils.cxx.
49{
50 SLOG(
"GuiUtils",
pDEBUG) <<
"Selecting all listbox entries";
51 SLOG(
"GuiUtils",
pDEBUG) <<
"n-entries = " << lb->GetNumberOfEntries();
52
53 for(int i = 0; i < lb->GetNumberOfEntries(); i++) lb->Select(i);
54
55 lb->SelectionChanged();
56}
References pDEBUG, and SLOG.