2001-11-26 10:19:58 +00:00
|
|
|
/**
|
2002-03-11 22:47:41 +00:00
|
|
|
* \file xforms/Alert_pimpl.C
|
2002-09-05 15:14:23 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2001-11-26 10:19:58 +00:00
|
|
|
*
|
2002-09-05 14:10:50 +00:00
|
|
|
* \author John Levon
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS
|
2001-11-26 10:19:58 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2002-03-11 17:00:41 +00:00
|
|
|
|
2001-11-26 10:19:58 +00:00
|
|
|
#include "Alert.h"
|
2002-03-21 21:21:28 +00:00
|
|
|
#include "Alert_pimpl.h"
|
2002-06-13 13:43:51 +00:00
|
|
|
#include "forms_gettext.h"
|
2002-03-11 17:00:41 +00:00
|
|
|
#include "gettext.h"
|
|
|
|
|
|
|
|
#include <algorithm>
|
|
|
|
#include FORMS_H_LOCATION
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2001-11-26 10:19:58 +00:00
|
|
|
using std::pair;
|
|
|
|
using std::make_pair;
|
|
|
|
|
|
|
|
void alert_pimpl(string const & s1, string const & s2, string const & s3)
|
|
|
|
{
|
|
|
|
fl_set_resource("flAlert.dismiss.label", _("Dismiss"));
|
|
|
|
fl_show_alert(s1.c_str(), s2.c_str(), s3.c_str(), 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool askQuestion_pimpl(string const & s1, string const & s2, string const & s3)
|
|
|
|
{
|
2003-02-27 15:53:23 +00:00
|
|
|
fl_set_resource("flQuestion.yes.label", idex(_("Yes|#y")).c_str());
|
|
|
|
fl_set_resource("flQuestion.no.label", idex(_("No|#n")).c_str());
|
2001-11-26 10:19:58 +00:00
|
|
|
return fl_show_question((s1 + "\n" + s2 + "\n" + s3).c_str(), 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int askConfirmation_pimpl(string const & s1, string const & s2, string const & s3)
|
|
|
|
{
|
2003-02-27 15:53:23 +00:00
|
|
|
string const yes = _("Yes|#Y");
|
|
|
|
string const no = _("No|#N");
|
|
|
|
string const cancel = _("Cancel|^[");
|
|
|
|
|
|
|
|
fl_set_choices_shortcut(scex(yes).c_str(), scex(no).c_str(),
|
|
|
|
scex(cancel).c_str());
|
2002-03-21 21:21:28 +00:00
|
|
|
return fl_show_choice(s1.c_str(), s2.c_str(), s3.c_str(),
|
2003-02-27 15:53:23 +00:00
|
|
|
3, idex(yes).c_str(), idex(no).c_str(),
|
|
|
|
idex(cancel).c_str(), 3);
|
2001-11-26 10:19:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pair<bool, string> const askForText_pimpl(string const & msg, string const & dflt)
|
|
|
|
{
|
2002-11-29 09:26:53 +00:00
|
|
|
fl_set_resource("flInput.cancel.label", idex(_("Cancel|^[")).c_str());
|
2003-02-27 15:53:23 +00:00
|
|
|
fl_set_resource("flInput.ok.label", idex(_("OK|^M")).c_str());
|
|
|
|
fl_set_resource("flInput.clear.label", idex(_("Clear|#C")).c_str());
|
2001-11-26 10:19:58 +00:00
|
|
|
char const * tmp = fl_show_input(msg.c_str(), dflt.c_str());
|
|
|
|
if (tmp != 0)
|
2002-03-21 16:59:12 +00:00
|
|
|
return make_pair<bool, string>(true, string(tmp));
|
2001-11-26 10:19:58 +00:00
|
|
|
else
|
2002-03-21 16:59:12 +00:00
|
|
|
return make_pair<bool, string>(false, string());
|
2001-11-26 10:19:58 +00:00
|
|
|
}
|