| 1 | /* /////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: assertdlg_gtk.h |
| 3 | // Purpose: GtkAssertDialog |
| 4 | // Author: Francesco Montorsi |
| 5 | // Id: $Id$ |
| 6 | // Copyright: (c) 2006 Francesco Montorsi |
| 7 | // Licence: wxWindows licence |
| 8 | /////////////////////////////////////////////////////////////////////////// */ |
| 9 | |
| 10 | #ifndef __GTK_ASSERTDLG_H__ |
| 11 | #define __GTK_ASSERTDLG_H__ |
| 12 | |
| 13 | #ifdef __cplusplus |
| 14 | extern "C" { |
| 15 | #endif /* __cplusplus */ |
| 16 | |
| 17 | #include <gtk/gtkdialog.h> |
| 18 | #include <gtk/gtklabel.h> |
| 19 | |
| 20 | #define GTK_TYPE_ASSERT_DIALOG (gtk_assert_dialog_get_type ()) |
| 21 | #define GTK_ASSERT_DIALOG(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GTK_TYPE_ASSERT_DIALOG, GtkAssertDialog)) |
| 22 | #define GTK_ASSERT_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_ASSERT_DIALOG, GtkAssertDialogClass)) |
| 23 | #define GTK_IS_ASSERT_DIALOG(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GTK_TYPE_ASSERT_DIALOG)) |
| 24 | #define GTK_IS_ASSERT_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ASSERT_DIALOG)) |
| 25 | #define GTK_ASSERT_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ASSERT_DIALOG, GtkAssertDialogClass)) |
| 26 | |
| 27 | typedef struct _GtkAssertDialog GtkAssertDialog; |
| 28 | typedef struct _GtkAssertDialogClass GtkAssertDialogClass; |
| 29 | typedef void (*GtkAssertDialogStackFrameCallback)(void *); |
| 30 | |
| 31 | struct _GtkAssertDialog |
| 32 | { |
| 33 | GtkDialog parent_instance; |
| 34 | |
| 35 | /* GtkAssertDialog widgets */ |
| 36 | GtkWidget *expander; |
| 37 | GtkWidget *message; |
| 38 | GtkWidget *treeview; |
| 39 | |
| 40 | GtkWidget *shownexttime; |
| 41 | |
| 42 | /* callback for processing the stack frame */ |
| 43 | GtkAssertDialogStackFrameCallback callback; |
| 44 | void *userdata; |
| 45 | }; |
| 46 | |
| 47 | struct _GtkAssertDialogClass |
| 48 | { |
| 49 | GtkDialogClass parent_class; |
| 50 | }; |
| 51 | |
| 52 | typedef enum |
| 53 | { |
| 54 | GTK_ASSERT_DIALOG_STOP, |
| 55 | GTK_ASSERT_DIALOG_CONTINUE, |
| 56 | GTK_ASSERT_DIALOG_CONTINUE_SUPPRESSING |
| 57 | } GtkAssertDialogResponseID; |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | GType gtk_assert_dialog_get_type(void); |
| 63 | GtkWidget *gtk_assert_dialog_new(void); |
| 64 | |
| 65 | /* get the assert message */ |
| 66 | gchar *gtk_assert_dialog_get_message(GtkAssertDialog *assertdlg); |
| 67 | |
| 68 | /* set the assert message */ |
| 69 | void gtk_assert_dialog_set_message(GtkAssertDialog *assertdlg, const gchar *msg); |
| 70 | |
| 71 | /* get a string containing all stack frames appended to the dialog */ |
| 72 | gchar *gtk_assert_dialog_get_backtrace(GtkAssertDialog *assertdlg); |
| 73 | |
| 74 | /* sets the callback to use when the user wants to see the stackframe */ |
| 75 | void gtk_assert_dialog_set_backtrace_callback(GtkAssertDialog *assertdlg, |
| 76 | GtkAssertDialogStackFrameCallback callback, |
| 77 | void *userdata); |
| 78 | |
| 79 | /* appends a stack frame to the dialog */ |
| 80 | void gtk_assert_dialog_append_stack_frame(GtkAssertDialog *dlg, |
| 81 | const gchar *function, |
| 82 | const gchar *arguments, |
| 83 | const gchar *sourcefile, |
| 84 | guint line_number); |
| 85 | |
| 86 | #ifdef __cplusplus |
| 87 | } |
| 88 | #endif /* __cplusplus */ |
| 89 | |
| 90 | #endif /* __GTK_ASSERTDLG_H__ */ |
| 91 | |
| 92 | |