This commit is contained in:
fgerlits 2006-11-26 10:48:57 +00:00
parent 48b05506d0
commit ad0dd8d2bc
4 changed files with 60 additions and 6 deletions

View File

@ -183,6 +183,15 @@ class WidgetFactory :
loadImage(const std::string imageName)
throw (std::invalid_argument);
/**
* Convert an integer to a string.
*
* @param number the number to be converted.
* @return the string value of the number (in base 10).
*/
static Glib::ustring
itoa(int number) throw ();
public:
/**
@ -304,6 +313,19 @@ class WidgetFactory :
Ptr<ResourceBundle>::Ref bundle)
throw ();
/**
* Create a combo box that holds a range of numeric entries.
* It is the reponsibility of the caller to dispose of the created
* object properly.
*
* @param lowerLimit the lowest entry in the combo box.
* @param upperLimit the highest entry in the combo box.
* @return a combo box, that holds numeric entries.
*/
ComboBoxText *
createNumericComboBoxText(int lowerLimit,
int upperLimit) throw ();
/**
* Create and return a blue singular container.
* It is the reponsibility of the caller to dispose of the created

View File

@ -506,6 +506,24 @@ WidgetFactory :: createOperatorComboBoxText(
}
/*------------------------------------------------------------------------------
* Create a numeric combo box
*----------------------------------------------------------------------------*/
ComboBoxText *
WidgetFactory :: createNumericComboBoxText(int lowerLimit,
int upperLimit)
throw ()
{
ComboBoxText * comboBox = new ComboBoxText(comboBoxLeftImage,
comboBoxCenterImage,
comboBoxRightImage);
for (int i = lowerLimit; i <= upperLimit; ++i) {
comboBox->append_text(itoa(i));
}
return comboBox;
}
/*------------------------------------------------------------------------------
* Create a blue bin
*----------------------------------------------------------------------------*/
@ -684,3 +702,16 @@ WidgetFactory :: createDateTimeChooserWindow(Ptr<ResourceBundle>::Ref bundle)
return new DateTimeChooserWindow(bundle);
}
/*------------------------------------------------------------------------------
* Convert an integer to a string.
*----------------------------------------------------------------------------*/
Glib::ustring
WidgetFactory :: itoa(int number) throw ()
{
std::ostringstream stream;
stream << number;
Glib::ustring string = stream.str();
return string;
}

View File

@ -89,8 +89,8 @@ SchedulePlaylistWindow :: SchedulePlaylistWindow (
playlistLabel = Gtk::manage(new Gtk::Label(*playlist->getTitle()));
calendar = Gtk::manage(new Gtk::Calendar());
hourEntry = Gtk::manage(wf->createEntryBin());
minuteEntry = Gtk::manage(wf->createEntryBin());
hourEntry = Gtk::manage(wf->createNumericComboBoxText(0, 23));
minuteEntry = Gtk::manage(wf->createNumericComboBoxText(0, 59));
layout = Gtk::manage(new Gtk::Table());
@ -139,9 +139,10 @@ SchedulePlaylistWindow :: onScheduleButtonClicked (void) throw ()
// get the hour and minute from the entries
// and construct an HH:MM:00.00 string from it
Ptr<std::string>::Ref timeStr(new std::string(hourEntry->get_text()));
Ptr<std::string>::Ref timeStr(new std::string(
hourEntry->get_active_text()));
*timeStr += ":";
*timeStr += minuteEntry->get_text();
*timeStr += minuteEntry->get_active_text();
*timeStr += ":00.00";
Ptr<posix_time::ptime>::Ref selectedTime;

View File

@ -122,7 +122,7 @@ class SchedulePlaylistWindow : public GuiWindow
/**
* The entry field for hour.
*/
EntryBin * hourEntry;
ComboBoxText * hourEntry;
/**
* The minute label.
@ -132,7 +132,7 @@ class SchedulePlaylistWindow : public GuiWindow
/**
* The minute entry field.
*/
EntryBin * minuteEntry;
ComboBoxText * minuteEntry;
/**
* The schedule button.