2 * \file xforms/Alert_pimpl.C
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
13 #include "Alert_pimpl.h"
15 #include "forms_gettext.h"
16 #include "xforms_helpers.h"
21 #include <boost/tuple/tuple.hpp>
23 #include "lyx_forms.h"
25 using lyx::frontend::formatted;
26 using lyx::frontend::idex;
27 using lyx::frontend::parse_shortcut;
34 void warning_pimpl(string const &, string const & message)
36 fl_show_messages(formatted(message, 300).c_str());
40 void error_pimpl(string const &, string const & message)
42 fl_show_messages(formatted(message, 300).c_str());
46 void information_pimpl(string const &, string const & message)
48 fl_show_messages(formatted(message, 300).c_str());
52 int prompt_pimpl(string const &, string const & question,
53 int default_button, int /*escape_button*/,
54 string const & b1, string const & b2, string const & b3)
59 boost::tie(b1label, b1sc) = parse_shortcut(b1);
60 boost::tie(b2label, b2sc) = parse_shortcut(b2);
61 boost::tie(b3label, b3sc) = parse_shortcut(b3);
64 fl_set_choices_shortcut(b1sc.c_str(), b2sc.c_str(), "");
65 return fl_show_choices(formatted(question, 300).c_str(),
66 2, b1label.c_str(), b2label.c_str(), "", default_button + 1) - 1;
68 fl_set_choices_shortcut(b1sc.c_str(), b2sc.c_str(), b3sc.c_str());
69 return fl_show_choices(formatted(question, 300).c_str(),
70 3, b1label.c_str(), b2label.c_str(), b3label.c_str(),
71 default_button + 1) - 1;
76 pair<bool, string> const askForText_pimpl(string const & msg, string const & dflt)
78 fl_set_resource("flInput.cancel.label", idex(_("Cancel|^[")).c_str());
79 fl_set_resource("flInput.ok.label", idex(_("OK|^M")).c_str());
80 fl_set_resource("flInput.clear.label", idex(_("Clear|#C")).c_str());
81 char const * tmp = fl_show_input(msg.c_str(), dflt.c_str());
83 return make_pair<bool, string>(true, string(tmp));
85 return make_pair<bool, string>(false, string());