lyx_mirror/src/frontends/xforms/Alert_pimpl.C
John Levon 37a1ffccb9 Big shake up of all Alert::askQuestion/Confirmation into something
hopefully a lot better.

Warning: this may negatively affect your muscle memory :(


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6622 a592a061-630c-0410-9148-cb99ea01b6c8
2003-03-29 07:09:13 +00:00

61 lines
1.6 KiB
C

/**
* \file xforms/Alert_pimpl.C
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author John Levon
*
* Full author contact details are available in file CREDITS
*/
#include <config.h>
#include "Alert.h"
#include "Alert_pimpl.h"
#include "forms_gettext.h"
#include "gettext.h"
#include <algorithm>
#include FORMS_H_LOCATION
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);
}
#warning error needs fixing up
#warning a "&Save" -> "Save|#S" is whats needed
#warning and a format maybe, and fixup default_button ?
int prompt_pimpl(string const & title, string const & question,
int default_button,
string const & b1, string const & b2, string const & b3);
{
if (b3.empty()) {
return fl_show_choice(title.c_str(), question.c_str(), "",
2, b1.c_str(), b2.c_str(), 2);
} else {
return fl_show_choice(title.c_str(), question.c_str(), "",
3, b1.c_str(), b2.c_str(), b3.c_str(), 3);
}
}
pair<bool, string> const askForText_pimpl(string const & msg, string const & dflt)
{
fl_set_resource("flInput.cancel.label", idex(_("Cancel|^[")).c_str());
fl_set_resource("flInput.ok.label", idex(_("OK|^M")).c_str());
fl_set_resource("flInput.clear.label", idex(_("Clear|#C")).c_str());
char const * tmp = fl_show_input(msg.c_str(), dflt.c_str());
if (tmp != 0)
return make_pair<bool, string>(true, string(tmp));
else
return make_pair<bool, string>(false, string());
}