using namespace sigc;
using namespace Gtk;
-Choice::Choice (string prompt, vector<string> choices)
+Choice::Choice (string title, string prompt, vector<string> choices, bool center)
+ : Dialog (title)
{
int n;
vector<string>::iterator i;
+
+ if (center) {
+ set_position (Gtk::WIN_POS_CENTER);
+ } else {
+ set_position (Gtk::WIN_POS_MOUSE);
+ }
- set_position (Gtk::WIN_POS_CENTER);
set_name ("ChoiceWindow");
+ HBox* dhbox = manage (new HBox());
+ Image* dimage = manage (new Gtk::Image(Stock::DIALOG_QUESTION, Gtk::ICON_SIZE_DIALOG));
Label* label = manage (new Label (prompt));
- label->show ();
- get_vbox()->pack_start (*label);
-
- for (n = 0, i = choices.begin(); i != choices.end(); ++i, ++n) {
+ dhbox->pack_start (*dimage, true, false, 10);
+ dhbox->pack_start (*label, true, false, 10);
- Button* button;
+ get_vbox()->set_border_width (12);
+ get_vbox()->pack_start (*dhbox, true, false);
+
+ set_has_separator (false);
+ set_resizable (false);
+ show_all_children ();
- button = add_button (*i, RESPONSE_ACCEPT);
- button->signal_button_release_event().connect (bind (mem_fun (*this, &Choice::choice_made), n), false);
+ for (n = 0, i = choices.begin(); i != choices.end(); ++i, ++n) {
+ add_button (*i, n);
}
-
- which_choice = -1;
}
void
Choice::~Choice ()
{
}
-
-bool
-Choice::choice_made (GdkEventButton* ev, int nbutton)
-{
- which_choice = nbutton;
- response (RESPONSE_ACCEPT);
- return true;
-}
-
-int
-Choice::get_choice ()
-{
- return which_choice;
-}