2002-02-16 15:59:55 +00:00
|
|
|
// -*- C++ -*-
|
2001-11-26 10:19:58 +00:00
|
|
|
/**
|
2007-04-28 20:44:46 +00:00
|
|
|
* \file alert.h
|
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-12-01 22:59:25 +00:00
|
|
|
* \author John Levon
|
2002-09-05 14:10:50 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2001-11-26 10:19:58 +00:00
|
|
|
*/
|
|
|
|
|
2002-02-16 15:59:55 +00:00
|
|
|
#ifndef LYX_ALERT_H
|
|
|
|
#define LYX_ALERT_H
|
|
|
|
|
2014-11-30 11:52:01 +00:00
|
|
|
#include "support/strfwd.h"
|
2002-02-16 15:59:55 +00:00
|
|
|
|
|
|
|
|
2006-10-07 16:47:54 +00:00
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
2001-11-26 10:19:58 +00:00
|
|
|
namespace Alert {
|
|
|
|
|
2023-07-16 14:48:49 +00:00
|
|
|
typedef unsigned short buttonid;
|
|
|
|
|
2003-03-29 07:09:13 +00:00
|
|
|
/**
|
2019-05-13 03:16:25 +00:00
|
|
|
* Prompt for a question. Returns 0-3 for the chosen button.
|
2003-04-27 16:40:50 +00:00
|
|
|
* Set default_button and cancel_button to reasonable values. b1-b3
|
|
|
|
* should have accelerators marked with an '&'. title should be
|
|
|
|
* a short summary. Strings should be gettextised.
|
|
|
|
* Please think about the poor user.
|
2003-03-29 07:09:13 +00:00
|
|
|
*
|
|
|
|
* Remember to use boost::format. If you make any of these buttons
|
|
|
|
* "Yes" or "No", I will personally come around to your house and
|
|
|
|
* slap you with fish, and not in an enjoyable way either.
|
|
|
|
*/
|
2023-07-16 14:48:49 +00:00
|
|
|
buttonid prompt(docstring const & title, docstring const & question,
|
|
|
|
buttonid default_button, buttonid cancel_button,
|
2019-05-13 03:16:25 +00:00
|
|
|
docstring const & b0, docstring const & b1,
|
|
|
|
docstring const & b2 = empty_docstring(),
|
|
|
|
docstring const & b3 = empty_docstring());
|
2003-03-29 07:09:13 +00:00
|
|
|
|
2003-03-29 09:02:08 +00:00
|
|
|
/**
|
2003-03-31 01:15:44 +00:00
|
|
|
* Display a warning to the user. Title should be a short (general) summary.
|
2003-03-29 09:02:08 +00:00
|
|
|
* Only use this if the user cannot perform some remedial action.
|
2009-04-19 11:57:52 +00:00
|
|
|
* \p askshowagain will display a check box where the user can turn off the
|
|
|
|
* warning for future cases. Ponder carefully if this is feasible.
|
2016-12-04 17:28:03 +00:00
|
|
|
*
|
|
|
|
* The console output takes care of converting any Qt html to plain text.
|
2003-03-29 09:02:08 +00:00
|
|
|
*/
|
2009-04-19 11:57:52 +00:00
|
|
|
void warning(docstring const & title, docstring const & message,
|
2020-10-16 07:19:34 +00:00
|
|
|
bool askshowagain = false);
|
2003-03-29 09:02:08 +00:00
|
|
|
|
|
|
|
/**
|
2003-03-31 01:15:44 +00:00
|
|
|
* Display a warning to the user. Title should be a short (general) summary.
|
2003-03-29 09:02:08 +00:00
|
|
|
* Only use this if the user cannot perform some remedial action.
|
2014-06-07 09:12:31 +00:00
|
|
|
* On some systems it is possible to show a backtrace.
|
2016-12-04 17:28:03 +00:00
|
|
|
*
|
|
|
|
* The console output takes care of converting any Qt html to plain text.
|
2003-03-29 09:02:08 +00:00
|
|
|
*/
|
2014-06-07 09:12:31 +00:00
|
|
|
void error(docstring const & title, docstring const & message, bool backtrace = false);
|
2003-03-29 09:02:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Informational message. Use very very sparingly. That is, you must
|
|
|
|
* apply to me, in triplicate, under the sea, breathing in petrol
|
|
|
|
* and reciting the Nicene Creed, whilst running uphill and also
|
|
|
|
* eating.
|
|
|
|
*/
|
2006-10-21 00:16:43 +00:00
|
|
|
void information(docstring const & title, docstring const & message);
|
2003-03-29 09:02:08 +00:00
|
|
|
|
2008-10-30 13:47:41 +00:00
|
|
|
/**
|
|
|
|
* Asks for a text. Returns true for OK. Obtained message is in response
|
|
|
|
* (even empty string). dflt stands for default message in the dialog.
|
|
|
|
*/
|
2007-11-13 23:00:36 +00:00
|
|
|
bool askForText(docstring & response, docstring const & msg,
|
2014-11-30 11:52:01 +00:00
|
|
|
docstring const & dflt = empty_docstring());
|
2002-02-16 15:59:55 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
} // namespace Alert
|
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
2002-02-16 15:59:55 +00:00
|
|
|
|
2002-06-12 02:54:19 +00:00
|
|
|
#endif // LYX_ALERT_H
|