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