2 * Copyright (C) 2017 Robin Gareus <robin@gareus.org>
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
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.
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 #ifndef _gtk2ardour_luadialog_h_
20 #define _gtk2ardour_luadialog_h_
23 #include <gtkmm/table.h>
24 #include <gtkmm/messagedialog.h>
26 #include "LuaBridge/LuaBridge.h"
34 Info, Warning, Question, Error
38 OK, Close, Cancel, Yes_No, OK_Cancel
41 Message (std::string const&, std::string const&, Message::MessageType, Message::ButtonType);
46 Message (Message const&); // prevent copy construction
48 static Gtk::ButtonsType to_gtk_bt (ButtonType bt);
49 static Gtk::MessageType to_gtk_mt (MessageType mt);
51 Gtk::MessageDialog _message_dialog;
54 class LuaDialogWidget {
56 LuaDialogWidget (std::string const& key, std::string const& label)
57 : _key (key), _label (label)
60 virtual ~LuaDialogWidget () {}
62 virtual Gtk::Widget* widget () = 0;
63 virtual void assign (luabridge::LuaRef* rv) const = 0;
64 std::string const& label () const { return _label; }
65 std::string const& key () const { return _key; }
75 Dialog (std::string const&, luabridge::LuaRef);
77 int run (lua_State *L);
80 Dialog (Dialog const&); // prevent copy construction
82 typedef std::vector<LuaDialogWidget*> DialogWidgets;
83 DialogWidgets _widgets;