From 3aa346b253d515c3d0715ec5e0fa8b6ad477c4e5 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 22 Mar 2006 17:03:00 +0000 Subject: significant changes in code to handle import/embedding - much cleaner and less code, plus the import progress bar now works; unify response handling for Gtkmm2ext::Choice git-svn-id: svn://localhost/trunk/ardour2@415 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/gtkmm2ext/choice.cc | 34 +++++++++++----------------------- 1 file changed, 11 insertions(+), 23 deletions(-) (limited to 'libs/gtkmm2ext/choice.cc') diff --git a/libs/gtkmm2ext/choice.cc b/libs/gtkmm2ext/choice.cc index d1de376312..d00d75d38b 100644 --- a/libs/gtkmm2ext/choice.cc +++ b/libs/gtkmm2ext/choice.cc @@ -26,28 +26,30 @@ using namespace Gtkmm2ext; using namespace sigc; using namespace Gtk; -Choice::Choice (string prompt, vector choices) +Choice::Choice (string prompt, vector choices, bool center) { int n; vector::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"); Label* label = manage (new Label (prompt)); label->show (); + get_vbox()->set_border_width (12); get_vbox()->pack_start (*label); - for (n = 0, i = choices.begin(); i != choices.end(); ++i, ++n) { + set_has_separator (false); - Button* button; - - 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 +62,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; -} -- cgit v1.2.3