aboutsummaryrefslogtreecommitdiffstats
path: root/ui/gtk/simple_dialog.h
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2014-09-24 14:06:23 -0700
committerGerald Combs <gerald@wireshark.org>2014-09-25 22:02:43 +0000
commitea6fa049c9c43a6852c2a1e8b72598e13a27786b (patch)
tree317fec804ce7aaaf619f813bba9c0efda22020b6 /ui/gtk/simple_dialog.h
parent2ee45fe2daffe10b519dc54699480db1c0a4f5ed (diff)
Update the simple dialog code.
Rename simple_dialog_qt.{cpp,h} to simple_dialog.{cpp,h}. Make it a subclass of QMessageBox. Queue messages at startup similar to GTK+. Move the GTK+-specific simple_dialog declarations to gtk/simple_dialog.h. Don't yell at the user so much. Replace exclamation points with periods. Change-Id: I1cc771106222d5e06f1f52d67ac29d6dc367cce4 Reviewed-on: https://code.wireshark.org/review/4288 Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'ui/gtk/simple_dialog.h')
-rw-r--r--ui/gtk/simple_dialog.h109
1 files changed, 109 insertions, 0 deletions
diff --git a/ui/gtk/simple_dialog.h b/ui/gtk/simple_dialog.h
new file mode 100644
index 0000000000..f805e959fe
--- /dev/null
+++ b/ui/gtk/simple_dialog.h
@@ -0,0 +1,109 @@
+/* simple_dialog.h
+ * Definitions for alert box routines with toolkit-independent APIs but
+ * toolkit-dependent implementations.
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * 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.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __SIMPLE_DIALOG_H__
+#define __SIMPLE_DIALOG_H__
+
+#include "ui/simple_dialog.h"
+
+/** @file
+ * Simple dialog box.
+ * @ingroup dialog_group
+ */
+
+/** Callback function type for simple_dialog_set_cb() */
+typedef void (* simple_dialog_cb_t) (gpointer dialog, gint btn, gpointer data);
+
+/** Set the callback function for the dialog, called when a button was pressed.
+ *
+ * @param dialog the dialog from simple_dialog()
+ * @param callback_fct the callback function to set
+ * @param data data to be passed to the callback function
+ */
+extern void simple_dialog_set_cb(gpointer dialog, simple_dialog_cb_t callback_fct, gpointer data);
+
+/** Close the dialog, useful for "no button" dialogs.
+ *
+ * @param dialog the dialog to close from simple_dialog()
+ */
+extern void simple_dialog_close(gpointer dialog);
+
+/** Add a check button to the dialog (e.g. "Don't show this message again")
+ *
+ * @param dialog the dialog from simple_dialog()
+ * @param text the text to display
+ */
+extern void simple_dialog_check_set(gpointer dialog, const gchar *text);
+
+/** Get the check buttons state.
+ *
+ * @param dialog the dialog from simple_dialog()
+ * @return current button state (TRUE is checked)
+ */
+extern gboolean simple_dialog_check_get(gpointer dialog);
+
+/**
+ * Display all queued messages.
+ * If a routine is called to display a dialog before there are any windows
+ * open, information to use to display the dialog is queued up. This
+ * routine should be called once there are windows open, so that the queued
+ * up dialogs are displayed on top of those windows.
+ */
+extern void display_queued_messages(void);
+
+/*
+ * 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,
+ const char *msg_format, ...) G_GNUC_PRINTF(4, 5);
+
+/*
+ * 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.
+ */
+extern void simple_error_message_box(const char *msg_format, ...);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __SIMPLE_DIALOG_H__ */
+
+/*
+ * 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:
+ */