2000-01-03 06:59:25 +00:00
|
|
|
/* simple_dialog.h
|
2004-02-04 01:10:37 +00:00
|
|
|
* Definitions for alert box routines with toolkit-independent APIs but
|
2000-01-03 06:59:25 +00:00
|
|
|
* toolkit-dependent implementations.
|
|
|
|
*
|
2006-05-21 05:12:17 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2000-01-03 06:59:25 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
2000-01-03 06:59:25 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
2000-01-03 06:59:25 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2012-06-28 22:56:06 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2000-01-03 06:59:25 +00:00
|
|
|
*/
|
|
|
|
|
2014-09-24 21:06:23 +00:00
|
|
|
#ifndef __SIMPLE_DIALOG_UI_H__
|
|
|
|
#define __SIMPLE_DIALOG_UI_H__
|
2000-01-03 06:59:25 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
2004-06-04 20:04:34 +00:00
|
|
|
/** @file
|
|
|
|
* Simple dialog box.
|
|
|
|
* @ingroup dialog_group
|
|
|
|
*/
|
2004-02-04 01:10:37 +00:00
|
|
|
|
|
|
|
|
2004-06-04 20:04:34 +00:00
|
|
|
/** Dialog types. */
|
2009-09-08 18:02:43 +00:00
|
|
|
typedef enum {
|
2004-06-04 20:04:34 +00:00
|
|
|
ESD_TYPE_INFO, /**< tells the user something they should know, but not requiring
|
|
|
|
any action; the only button should be "OK" */
|
|
|
|
ESD_TYPE_WARN, /**< tells the user about a problem; the only button should be "OK" */
|
|
|
|
ESD_TYPE_CONFIRMATION, /**< asks the user for confirmation; there should be more than
|
|
|
|
one button */
|
2005-09-20 01:53:38 +00:00
|
|
|
ESD_TYPE_ERROR, /**< tells the user about a serious problem; the only button should be "OK" */
|
2005-10-03 07:30:49 +00:00
|
|
|
ESD_TYPE_STOP /**< tells the user a stop action is in progress, there should be no button */
|
2004-06-04 20:04:34 +00:00
|
|
|
} ESD_TYPE_E;
|
2000-10-09 06:38:36 +00:00
|
|
|
|
2005-09-20 01:53:38 +00:00
|
|
|
/** display no buttons at all */
|
|
|
|
#define ESD_BTN_NONE 0x00
|
2004-06-04 20:04:34 +00:00
|
|
|
/** display an "Ok" button */
|
2009-09-08 18:02:43 +00:00
|
|
|
#define ESD_BTN_OK 0x01
|
2004-06-04 20:04:34 +00:00
|
|
|
/** display a "Cancel" button */
|
2009-09-08 18:02:43 +00:00
|
|
|
#define ESD_BTN_CANCEL 0x02
|
2004-06-04 20:04:34 +00:00
|
|
|
/** display a "Yes" button */
|
2009-09-08 18:02:43 +00:00
|
|
|
#define ESD_BTN_YES 0x04
|
2004-06-04 20:04:34 +00:00
|
|
|
/** display a "No" button */
|
2009-09-08 18:02:43 +00:00
|
|
|
#define ESD_BTN_NO 0x08
|
2004-06-04 20:04:34 +00:00
|
|
|
/** display a "Clear" button */
|
2004-07-13 07:15:45 +00:00
|
|
|
#define ESD_BTN_CLEAR 0x10
|
|
|
|
/** display a "Save" button */
|
|
|
|
#define ESD_BTN_SAVE 0x20
|
|
|
|
/** display a "Continue without Saving" button */
|
2009-09-08 18:02:43 +00:00
|
|
|
#define ESD_BTN_DONT_SAVE 0x40
|
2009-05-27 02:42:43 +00:00
|
|
|
/** display a "Quit without Saving" button */
|
2009-09-08 18:02:43 +00:00
|
|
|
#define ESD_BTN_QUIT_DONT_SAVE 0x80
|
2000-01-03 06:59:25 +00:00
|
|
|
|
2004-06-04 20:04:34 +00:00
|
|
|
/** Standard button combination "Ok" + "Cancel". */
|
2014-10-06 03:40:42 +00:00
|
|
|
#define ESD_BTNS_OK_CANCEL (ESD_BTN_OK|ESD_BTN_CANCEL)
|
2004-06-04 20:04:34 +00:00
|
|
|
/** Standard button combination "Yes" + "No". */
|
2014-10-06 03:40:42 +00:00
|
|
|
#define ESD_BTNS_YES_NO (ESD_BTN_YES|ESD_BTN_NO)
|
2004-06-04 20:04:34 +00:00
|
|
|
/** Standard button combination "Yes" + "No" + "Cancel". */
|
2014-10-06 03:40:42 +00:00
|
|
|
#define ESD_BTNS_YES_NO_CANCEL (ESD_BTN_YES|ESD_BTN_NO|ESD_BTN_CANCEL)
|
2004-07-13 07:15:45 +00:00
|
|
|
/** Standard button combination "No" + "Cancel" + "Save". */
|
2014-10-06 03:40:42 +00:00
|
|
|
#define ESD_BTNS_SAVE_DONTSAVE (ESD_BTN_SAVE|ESD_BTN_DONT_SAVE)
|
2004-07-13 07:15:45 +00:00
|
|
|
#define ESD_BTNS_SAVE_DONTSAVE_CANCEL (ESD_BTN_DONT_SAVE|ESD_BTN_CANCEL|ESD_BTN_SAVE)
|
2009-05-27 02:42:43 +00:00
|
|
|
/** Standard button combination "Quit without saving" + "Cancel" + "Save". */
|
|
|
|
#define ESD_BTNS_SAVE_QUIT_DONTSAVE_CANCEL (ESD_BTN_QUIT_DONT_SAVE|ESD_BTN_CANCEL|ESD_BTN_SAVE)
|
2011-10-05 05:53:53 +00:00
|
|
|
/** Standard button combination "Quit without saving" + "Cancel". */
|
|
|
|
#define ESD_BTNS_QUIT_DONTSAVE_CANCEL (ESD_BTN_QUIT_DONT_SAVE|ESD_BTN_CANCEL)
|
2004-02-04 01:10:37 +00:00
|
|
|
|
2004-06-04 20:04:34 +00:00
|
|
|
/** Create and show a simple dialog.
|
|
|
|
*
|
|
|
|
* @param type type of dialog
|
|
|
|
* @param btn_mask the buttons to display
|
|
|
|
* @param msg_format printf like message format
|
|
|
|
* @param ... printf like parameters
|
|
|
|
* @return the newly created dialog
|
|
|
|
*/
|
|
|
|
extern gpointer simple_dialog(ESD_TYPE_E type, gint btn_mask,
|
2004-04-16 23:17:13 +00:00
|
|
|
const gchar *msg_format, ...)
|
2010-01-25 13:20:53 +00:00
|
|
|
G_GNUC_PRINTF(3, 4);
|
2009-11-04 00:02:52 +00:00
|
|
|
|
2009-09-08 18:02:43 +00:00
|
|
|
/** Surround the primary dialog message text by
|
2004-06-04 20:04:34 +00:00
|
|
|
* simple_dialog_primary_start() and simple_dialog_primary_end().
|
|
|
|
* To highlight the first sentence (will take effect on GTK2 only).
|
|
|
|
*/
|
2012-12-26 05:57:06 +00:00
|
|
|
extern const char *simple_dialog_primary_start(void);
|
2009-09-08 18:02:43 +00:00
|
|
|
/** Surround the primary dialog message text by
|
2004-06-04 20:04:34 +00:00
|
|
|
* simple_dialog_primary_start() and simple_dialog_primary_end().
|
|
|
|
* To highlight the first sentence (will take effect on GTK2 only).
|
|
|
|
*/
|
2012-12-26 05:57:06 +00:00
|
|
|
extern const char *simple_dialog_primary_end(void);
|
2004-02-03 17:59:01 +00:00
|
|
|
|
2004-06-04 20:04:34 +00:00
|
|
|
/** Escape the message text, if it probably contains Pango escape sequences.
|
|
|
|
* For example html like tags starting with a <.
|
|
|
|
*
|
|
|
|
* @param msg the string to escape
|
|
|
|
* @return the escaped message text, must be freed with g_free() later
|
|
|
|
*/
|
|
|
|
extern char *simple_dialog_format_message(const char *msg);
|
|
|
|
|
2012-06-17 22:32:03 +00:00
|
|
|
/*
|
|
|
|
* Alert box, with optional "don't show this message again" variable
|
|
|
|
* and checkbox, and optional secondary text.
|
|
|
|
*/
|
|
|
|
extern void simple_message_box(ESD_TYPE_E type, gboolean *notagain,
|
|
|
|
const char *secondary_msg,
|
2014-07-01 20:39:25 +00:00
|
|
|
const char *msg_format, ...) G_GNUC_PRINTF(4, 5);
|
2012-06-17 22:32:03 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Error alert box, taking a format and a va_list argument.
|
|
|
|
*/
|
|
|
|
extern void vsimple_error_message_box(const char *msg_format, va_list ap);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Error alert box, taking a format and a list of arguments.
|
|
|
|
*/
|
2015-07-04 02:38:54 +00:00
|
|
|
extern void simple_error_message_box(const char *msg_format, ...) G_GNUC_PRINTF(1, 2);
|
2012-06-17 22:32:03 +00:00
|
|
|
|
2000-01-03 06:59:25 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
2014-09-24 21:06:23 +00:00
|
|
|
#endif /* __SIMPLE_DIALOG_UI_H__ */
|
2012-10-24 15:52:45 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Editor modelines
|
|
|
|
*
|
|
|
|
* Local Variables:
|
|
|
|
* c-basic-offset: 4
|
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: nil
|
|
|
|
* End:
|
|
|
|
*
|
|
|
|
* ex: set shiftwidth=4 tabstop=8 expandtab:
|
|
|
|
* :indentSize=4:tabSize=8:noTabs=true:
|
|
|
|
*/
|