many important changes to configuration system and specific parameters
[ardour.git] / libs / gtkmm2ext / choice.cc
index 195716ada9f72863420f11669825171ddb9de521..7f5f869adaf3c8485047a4137f831c3b26d72913 100644 (file)
@@ -18,6 +18,7 @@
     $Id$
 */
 
+#include <gtkmm/label.h>
 #include <gtkmm2ext/choice.h>
 
 using namespace std;
@@ -25,40 +26,36 @@ using namespace Gtkmm2ext;
 using namespace sigc;
 using namespace Gtk;
 
-Choice::Choice (string prompt,
-               vector<string> choices)
-       : Gtk::Window (WINDOW_TOPLEVEL),
-         prompt_label (prompt)
+Choice::Choice (string prompt, vector<string> choices, bool center)
 {
        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");
-       add (packer);
-       
-       packer.set_spacing (10);
-       packer.set_border_width (10);
-       packer.pack_start (prompt_label);
-       packer.pack_start (button_packer);
-       prompt_label.set_name ("ChoicePrompt");
-       
-       for (n = 0, i = choices.begin(); i != choices.end(); ++i, ++n) {
-               Button *button = manage (new Gtk::Button (*i));
-               button->set_name ("ChoiceButton");
 
-               button_packer.set_spacing (5);
-               button_packer.set_homogeneous (true);
-               button_packer.pack_start (*button, false, true);
+       HBox* dhbox = manage (new HBox());
+       Image* dimage = manage (new Gtk::Image(Stock::DIALOG_QUESTION, Gtk::ICON_SIZE_DIALOG));
+       Label* label = manage (new Label (prompt));
 
-               button->signal_clicked().connect (bind (mem_fun (*this, &Choice::_choice_made), n));
-               buttons.push_back (button);
-       }
+       dhbox->pack_start (*dimage, true, false, 10);
+       dhbox->pack_start  (*label, true, false, 10);
 
-       signal_delete_event().connect(mem_fun(*this, &Choice::closed));
+       get_vbox()->set_border_width (12);
+       get_vbox()->pack_start (*dhbox,  true, false);
+       
+       set_has_separator (false);
+       set_resizable (false);
+       show_all_children ();
 
-       packer.show_all ();
-       which_choice = -1;
+       for (n = 0, i = choices.begin(); i != choices.end(); ++i, ++n) {
+               add_button (*i, n);
+       }
 }
 
 void
@@ -71,26 +68,3 @@ Choice::on_realize ()
 Choice::~Choice ()
 {
 }
-
-void
-Choice::_choice_made (int nbutton)
-{
-       which_choice = nbutton;
-       choice_made (which_choice);
-       chosen ();
-}
-
-gint
-Choice::closed (GdkEventAny *ev)
-{
-       which_choice = -1;
-       choice_made (which_choice);
-       chosen ();
-       return TRUE;
-}
-
-int
-Choice::get_choice ()
-{
-       return which_choice;
-}