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