minor header fix for OS X
[ardour.git] / libs / gtkmm2ext / choice.cc
index d1de37631235bec8d5fc225ab83cfa263e33c2e2..363942eab7d834d023b0657ea879599ed356a4fd 100644 (file)
@@ -26,28 +26,37 @@ using namespace Gtkmm2ext;
 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
@@ -60,17 +69,3 @@ Choice::on_realize ()
 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;
-}