18 using std::ostringstream;
27 lb->AddEntry(lbitems[i], i);
33 TGListBox * lb,
const vector<string> * lbitems)
38 for(lbiter = lbitems->begin(); lbiter != lbitems->end(); ++lbiter) {
40 if( lbiter->size() > 0 ) {
42 lb->AddEntry( lbiter->c_str(), i);
50 SLOG(
"GuiUtils",
pDEBUG) <<
"Selecting all listbox entries";
51 SLOG(
"GuiUtils",
pDEBUG) <<
"n-entries = " << lb->GetNumberOfEntries();
53 for(
int i = 0; i < lb->GetNumberOfEntries(); i++) lb->Select(i);
55 lb->SelectionChanged();
60 SLOG(
"GuiUtils",
pDEBUG) <<
"Reseting all listbox entries";
61 SLOG(
"GuiUtils",
pDEBUG) <<
"n-entries = " << lb->GetNumberOfEntries();
63 TList * selected_entries =
new TList();
64 TGLBEntry * selected_entry = 0;
66 lb->GetSelectedEntries(selected_entries);
68 TIter lbentry(selected_entries);
70 while( (selected_entry = (TGLBEntry *) lbentry.Next()) )
71 lb->Select( selected_entry->EntryId() , kFALSE);
73 delete selected_entries;
75 lb->SelectionChanged();
79 TGListBox * lb,
const char * lbitems[])
83 lb->GetSelectedEntries( &selections );
85 TGLBEntry * lbentry = 0;
87 TIter selection_iter(&selections);
91 ostringstream str_select;
93 while( (lbentry = (TGLBEntry *) selection_iter.Next()) ) {
95 str_select << lbitems[ lbentry->EntryId() ];
97 if(++i < selections.GetSize() ) str_select <<
", ";
100 if(i==0)
return "empty";
102 return str_select.str();
106 const char * lbitems[],
const char * selection)
111 if (
strcmp(lbitems[i], selection) == 0 )
return i;
122 cb->AddEntry(cbitems[i], i);
128 TGComboBox * cb,
const vector<string> * cbitems)
133 for(cbiter = cbitems->begin(); cbiter != cbitems->end(); ++cbiter) {
135 if( cbiter->size() > 0 ) {
136 cb->AddEntry( cbiter->c_str(), i);
143 TGComboBox * cb,
const char * cbitems[])
145 TGLBEntry * selected_entry = cb->GetSelectedEntry();
147 if(selected_entry)
return string(cbitems[selected_entry->EntryId()]);
152 const char * cbitems[],
const char * selection)
155 while( cbitems[i] ) {
156 if (
strcmp(cbitems[i], selection) == 0 )
return i;
void FillComboBox(TGComboBox *cb, const char *cbitems[])
void SelectAllListBoxEntries(TGListBox *lb)
void ResetAllListBoxSelections(TGListBox *lb)
string ListBoxSelectionAsString(TGListBox *lb, const char *lbitems[])
string ComboBoxSelectionAsString(TGComboBox *cb, const char *cbitems[])
int ComboBoxSelectionId(const char *cbitems[], const char *sel)
int strcmp(const String &s1, const String &s2)
void FillListBox(TGListBox *lb, const char *lbitems[])
int ListBoxSelectionId(const char *lbitems[], const char *sel)
#define SLOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a short string (using the FUNCTION and...