]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/Alert_pimpl.C
Really dull and boring header shit
[lyx.git] / src / frontends / xforms / Alert_pimpl.C
1 /**
2  * \file xforms/Alert_pimpl.C
3  * Read the file COPYING
4  *
5  * \author John Levon
6  *
7  * Full author contact details are available in file CREDITS
8  */
9
10 #include <config.h>
11
12 #ifdef __GNUG__
13 #pragma implementation
14 #endif
15
16 #include "Alert.h"
17 #include "Alert_pimpl.h"
18 #include "forms_gettext.h"
19 #include "gettext.h"
20
21 #include <algorithm>
22 #include FORMS_H_LOCATION
23
24 using std::pair;
25 using std::make_pair;
26
27 void alert_pimpl(string const & s1, string const & s2, string const & s3)
28 {
29         fl_set_resource("flAlert.dismiss.label", _("Dismiss"));
30         fl_show_alert(s1.c_str(), s2.c_str(), s3.c_str(), 0);
31 }
32
33
34 bool askQuestion_pimpl(string const & s1, string const & s2, string const & s3)
35 {
36         fl_set_resource("flQuestion.yes.label", idex(_("Yes|Yy#y")));
37         fl_set_resource("flQuestion.no.label", idex(_("No|Nn#n")));
38         return fl_show_question((s1 + "\n" + s2 + "\n" + s3).c_str(), 0);
39 }
40
41
42 int askConfirmation_pimpl(string const & s1, string const & s2, string const & s3)
43 {
44         fl_set_choices_shortcut(scex(_("Yes|Yy#y")),
45                                 scex(_("No|Nn#n")),
46                                 scex(_("Cancel|^[")));
47         return fl_show_choice(s1.c_str(), s2.c_str(), s3.c_str(),
48                               3, idex(_("Yes|Yy#y")),
49                               idex(_("No|Nn#n")),
50                               idex(_("Cancel|^[")), 3);
51 }
52
53
54 pair<bool, string> const askForText_pimpl(string const & msg, string const & dflt)
55 {
56         fl_set_resource("flInput.cancel.label", idex(_("Cancel|^[")));
57         fl_set_resource("flInput.ok.label", idex(_("OK|#O")));
58         fl_set_resource("flInput.clear.label", idex(_("Clear|#e")));
59         char const * tmp = fl_show_input(msg.c_str(), dflt.c_str());
60         if (tmp != 0)
61                 return make_pair<bool, string>(true, string(tmp));
62         else
63                 return make_pair<bool, string>(false, string());
64 }