Remove ambiguous API implementation
[ardour.git] / libs / widgets / choice.cc
1 /*
2     Copyright (C) 1998-99 Paul Barton-Davis
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18     $Id$
19 */
20
21 #include <gtkmm/label.h>
22 #include <widgets/choice.h>
23
24 using namespace std;
25 using namespace sigc;
26 using namespace Gtk;
27 using namespace ArdourWidgets;
28
29 Choice::Choice (string title, string prompt, vector<string> choices, bool center)
30         : Dialog (title)
31 {
32         int n;
33         vector<string>::iterator i;
34
35         if (center) {
36                 set_position (Gtk::WIN_POS_CENTER);
37         } else {
38                 set_position (Gtk::WIN_POS_MOUSE);
39         }
40
41         set_name ("ChoiceWindow");
42
43         HBox* dhbox = manage (new HBox());
44         Image* dimage = manage (new Gtk::Image(Stock::DIALOG_QUESTION, Gtk::ICON_SIZE_DIALOG));
45         Label* label = manage (new Label (prompt));
46
47         dhbox->pack_start (*dimage, true, false, 10);
48         dhbox->pack_start  (*label, true, false, 10);
49
50         get_vbox()->set_border_width (12);
51         get_vbox()->pack_start (*dhbox,  true, false);
52
53         set_has_separator (false);
54         set_resizable (false);
55         show_all_children ();
56
57         for (n = 0, i = choices.begin(); i != choices.end(); ++i, ++n) {
58                 add_button (*i, n);
59         }
60 }
61
62 void
63 Choice::on_realize ()
64 {
65         Gtk::Window::on_realize();
66         get_window()->set_decorations (Gdk::WMDecoration (Gdk::DECOR_BORDER|Gdk::DECOR_RESIZEH));
67 }
68
69 Choice::~Choice ()
70 {
71 }