Beast - Music Synthesizer and Composer  0.11.1+10.g2da35
gxkdialog.hh
Go to the documentation of this file.
1  // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
2 #ifndef __GXK_DIALOG_H__
3 #define __GXK_DIALOG_H__
4 
5 #include "gxkutils.hh"
6 
7 /* --- type macros --- */
8 #define GXK_TYPE_DIALOG (gxk_dialog_get_type ())
9 #define GXK_DIALOG(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GXK_TYPE_DIALOG, GxkDialog))
10 #define GXK_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GXK_TYPE_DIALOG, GxkDialogClass))
11 #define GXK_IS_DIALOG(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GXK_TYPE_DIALOG))
12 #define GXK_IS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GXK_TYPE_DIALOG))
13 #define GXK_DIALOG_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), GXK_TYPE_DIALOG, GxkDialogClass))
14 
15 
16 /* --- typedefs & enums --- */
17 typedef struct _GxkDialog GxkDialog;
18 typedef struct _GxkDialogClass GxkDialogClass;
19 typedef enum
20 {
21  GXK_DIALOG_HIDE_ON_DELETE = 1 << 0, /* hide instead of destroy on window manager delete event */
22  GXK_DIALOG_IGNORE_ESCAPE = 1 << 1, /* prevents delete event generation on Escape key presses */
23  GXK_DIALOG_DELETE_BUTTON = 1 << 2, /* add a "Close" button */
24  GXK_DIALOG_STATUS_BAR = 1 << 3, /* add a status bar */
25  GXK_DIALOG_WINDOW_GROUP = 1 << 4,
26  GXK_DIALOG_MODAL = 1 << 5,
27  GXK_DIALOG_POPUP_POS = 1 << 6, /* popup at mouse pointer */
28  GXK_DIALOG_PRESERVE_STATE = 1 << 7 /* don't always reset size etc. upon hiding */
29 } GxkDialogFlags;
30 
31 
32 /* --- structures --- */
33 struct _GxkDialog
34 {
35  GtkWindow window;
36 
37  GtkWidget *vbox;
38 
39  /*< private >*/
40  GtkObject *alive_object; /* dialog is destroyed with this object */
41  GxkDialogFlags flags;
42  gpointer *pointer_loc; /* nullified on destroy */
43  GtkWidget *status_bar;
44  GtkWidget *default_widget;
45  GtkWidget *focus_widget;
46  GtkWidget *sep;
47  GtkWidget *hbox;
48  GtkWidget *mbox;
49  GtkWidget *child;
50 };
52 {
53  GtkWindowClass parent_class;
54 };
55 
56 
57 /* --- prototypes --- */
58 GType gxk_dialog_get_type (void);
59 gpointer gxk_dialog_new (gpointer pointer_loc,
60  GtkObject *alive_object,
61  GxkDialogFlags flags,
62  const gchar *title,
63  GtkWidget *child);
64 gpointer gxk_dialog_new_radget (gpointer pointer_loc,
65  GtkObject *alive_object,
66  GxkDialogFlags flags,
67  const gchar *title,
68  const gchar *domain_name,
69  const gchar *radget_name);
70 void gxk_dialog_set_sizes (GxkDialog *dialog,
71  gint min_width,
72  gint min_height,
73  gint default_width,
74  gint default_height);
75 void gxk_dialog_set_title (GxkDialog *dialog,
76  const gchar *title);
77 void gxk_dialog_set_focus (GxkDialog *dialog,
78  GtkWidget *widget);
79 void gxk_dialog_set_default (GxkDialog *dialog,
80  GtkWidget *widget);
81 void gxk_dialog_set_child (GxkDialog *dialog,
82  GtkWidget *child);
83 GtkWidget* gxk_dialog_get_child (GxkDialog *dialog);
84 GxkDialog* gxk_dialog_get_status_window (void);
85 void gxk_dialog_add_flags (GxkDialog *dialog,
86  GxkDialogFlags flags);
87 void gxk_dialog_clear_flags (GxkDialog *dialog,
88  GxkDialogFlags flags);
89 void gxk_dialog_remove_actions (GxkDialog *dialog);
90 #define gxk_dialog_action( dialog, action, callback, data) \
91  gxk_dialog_action_multi ((dialog), (action), (callback), (data), 0, (GxkDialogMultiFlags) 0)
92 #define gxk_dialog_default_action( dialog, action, callback, data) \
93  gxk_dialog_action_multi ((dialog), (action), (callback), (data), 0, GXK_DIALOG_MULTI_DEFAULT)
94 #define gxk_dialog_action_swapped( dialog, action, callback, data) \
95  gxk_dialog_action_multi ((dialog), (action), (callback), (data), 0, GXK_DIALOG_MULTI_SWAPPED)
96 #define gxk_dialog_default_action_swapped( dialog, action, callback, data) \
97  gxk_dialog_action_multi ((dialog), (action), (callback), (data), 0, GXK_DIALOG_MULTI_DEFAULT | GXK_DIALOG_MULTI_SWAPPED)
98 
99 
100 /* --- internal --- */
101 typedef enum /*< skip >*/
102 {
103  GXK_DIALOG_MULTI_DEFAULT = 1,
104  GXK_DIALOG_MULTI_SWAPPED = 2
105 } GxkDialogMultiFlags;
106 GtkWidget* gxk_dialog_action_multi (GxkDialog *dialog,
107  const gchar *action,
108  gpointer callback,
109  gpointer data,
110  const gchar *icon_stock_id,
111  GxkDialogMultiFlags multi_mode);
112 
113 // == Flags Enumeration Operators in C++ ==
114 #ifdef __cplusplus
115 constexpr GxkDialogFlags operator& (GxkDialogFlags s1, GxkDialogFlags s2) { return GxkDialogFlags (s1 & (long long unsigned) s2); }
116 inline GxkDialogFlags& operator&= (GxkDialogFlags &s1, GxkDialogFlags s2) { s1 = s1 & s2; return s1; }
117 constexpr GxkDialogFlags operator| (GxkDialogFlags s1, GxkDialogFlags s2) { return GxkDialogFlags (s1 | (long long unsigned) s2); }
118 inline GxkDialogFlags& operator|= (GxkDialogFlags &s1, GxkDialogFlags s2) { s1 = s1 | s2; return s1; }
119 constexpr GxkDialogFlags operator~ (GxkDialogFlags s1) { return GxkDialogFlags (~(long long unsigned) s1); }
120 constexpr GxkDialogMultiFlags operator& (GxkDialogMultiFlags s1, GxkDialogMultiFlags s2) { return GxkDialogMultiFlags (s1 & (long long unsigned) s2); }
121 inline GxkDialogMultiFlags& operator&= (GxkDialogMultiFlags &s1, GxkDialogMultiFlags s2) { s1 = s1 & s2; return s1; }
122 constexpr GxkDialogMultiFlags operator| (GxkDialogMultiFlags s1, GxkDialogMultiFlags s2) { return GxkDialogMultiFlags (s1 | (long long unsigned) s2); }
123 inline GxkDialogMultiFlags& operator|= (GxkDialogMultiFlags &s1, GxkDialogMultiFlags s2) { s1 = s1 | s2; return s1; }
124 constexpr GxkDialogMultiFlags operator~ (GxkDialogMultiFlags s1) { return GxkDialogMultiFlags (~(long long unsigned) s1); }
125 #endif // __cplusplus
126 
127 #endif /* __GXK_DIALOG_H__ */
void gxk_dialog_add_flags(GxkDialog *dialog, GxkDialogFlags flags)
Definition: gxkdialog.cc:351
void gxk_dialog_set_title(GxkDialog *dialog, const gchar *title)
Definition: gxkdialog.cc:336
GtkWidget * gxk_dialog_action_multi(GxkDialog *dialog, const gchar *action, gpointer callback, gpointer data, const gchar *icon_stock_id, GxkDialogMultiFlags multi_mode)
Definition: gxkdialog.cc:622
void gxk_dialog_set_child(GxkDialog *dialog, GtkWidget *child)
Definition: gxkdialog.cc:403
GxkDialog * gxk_dialog_get_status_window(void)
Definition: gxkdialog.cc:584
void gxk_dialog_set_sizes(GxkDialog *dialog, gint min_width, gint min_height, gint default_width, gint default_height)
Definition: gxkdialog.cc:307
gpointer gxk_dialog_new(gpointer pointer_loc, GtkObject *alive_object, GxkDialogFlags flags, const gchar *title, GtkWidget *child)
Definition: gxkdialog.cc:244
void gxk_dialog_remove_actions(GxkDialog *dialog)
Definition: gxkdialog.cc:604
void gxk_dialog_set_default(GxkDialog *dialog, GtkWidget *widget)
Definition: gxkdialog.cc:448
GtkWidget * gxk_dialog_get_child(GxkDialog *dialog)
Definition: gxkdialog.cc:388
void gxk_dialog_set_focus(GxkDialog *dialog, GtkWidget *widget)
Definition: gxkdialog.cc:428
Definition: gxkdialog.hh:51
void gxk_dialog_clear_flags(GxkDialog *dialog, GxkDialogFlags flags)
Definition: gxkdialog.cc:370
Definition: gxkdialog.hh:33