Mercurial > pidgin.yaz
comparison pidgin/minidialog.h @ 21402:9fef5d307a27
Create a PidginMiniDialog widget; make pidgin_make_mini_dialog() in gtkutils.c
a relatively thin wrapper around it.
author | Will Thompson <will.thompson@collabora.co.uk> |
---|---|
date | Sun, 04 Nov 2007 14:43:45 +0000 |
parents | |
children | 2e60aae8b9c5 |
comparison
equal
deleted
inserted
replaced
21401:c1c7e28223f8 | 21402:9fef5d307a27 |
---|---|
1 /** | |
2 * @file minidialog.h API for the #PidginMiniDialog Gtk widget. | |
3 * @ingroup pidgin | |
4 */ | |
5 | |
6 /* pidgin | |
7 * | |
8 * Pidgin is the legal property of its developers, whose names are too numerous | |
9 * to list here. Please refer to the COPYRIGHT file distributed with this | |
10 * source distribution. | |
11 * | |
12 * This program is free software; you can redistribute it and/or modify | |
13 * it under the terms of the GNU General Public License as published by | |
14 * the Free Software Foundation; either version 2 of the License, or | |
15 * (at your option) any later version. | |
16 * | |
17 * This program is distributed in the hope that it will be useful, | |
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 * GNU General Public License for more details. | |
21 * | |
22 * You should have received a copy of the GNU General Public License | |
23 * along with this program; if not, write to the Free Software | |
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA | |
25 */ | |
26 | |
27 #ifndef __PIDGIN_MINI_DIALOG_H__ | |
28 #define __PIDGIN_MINI_DIALOG_H__ | |
29 | |
30 #include <glib-object.h> | |
31 #include <gtk/gtkvbox.h> | |
32 #include <gtk/gtklabel.h> | |
33 | |
34 G_BEGIN_DECLS | |
35 | |
36 #define PIDGIN_TYPE_MINI_DIALOG pidgin_mini_dialog_get_type() | |
37 | |
38 #define PIDGIN_MINI_DIALOG(obj) \ | |
39 (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ | |
40 PIDGIN_TYPE_MINI_DIALOG, PidginMiniDialog)) | |
41 | |
42 #define PIDGIN_MINI_DIALOG_CLASS(klass) \ | |
43 (G_TYPE_CHECK_CLASS_CAST ((klass), \ | |
44 PIDGIN_TYPE_MINI_DIALOG, PidginMiniDialogClass)) | |
45 | |
46 #define PIDGIN_IS_MINI_DIALOG(obj) \ | |
47 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ | |
48 PIDGIN_TYPE_MINI_DIALOG)) | |
49 | |
50 #define PIDGIN_IS_MINI_DIALOG_CLASS(klass) \ | |
51 (G_TYPE_CHECK_CLASS_TYPE ((klass), \ | |
52 PIDGIN_TYPE_MINI_DIALOG)) | |
53 | |
54 #define PIDGIN_MINI_DIALOG_GET_CLASS(obj) \ | |
55 (G_TYPE_INSTANCE_GET_CLASS ((obj), \ | |
56 PIDGIN_TYPE_MINI_DIALOG, PidginMiniDialogClass)) | |
57 | |
58 /** | |
59 * A widget resembling a diminutive dialog box, designed to be embedded in the | |
60 * #PidginBuddyList. Mini-dialogs have titles, optional descriptions, and a row | |
61 * of buttons at the bottom; above the buttons is a <tt>GtkHBox</tt> into which | |
62 * you can pack any random widgets you want to add to the dialog. When any of | |
63 * the dialog's buttons is clicked, the dialog will be destroyed. | |
64 * | |
65 * Dialogs have the following GObject properties: | |
66 * <dl> | |
67 * <dt><tt>"title"</tt> (<tt>char *</tt>)</dt> | |
68 * <dd>A string to be displayed as the dialog's title.</dd> | |
69 * <dt><tt>"description"</tt> (<tt>char *</tt>)</dt> | |
70 * <dd>A string to be displayed as the dialog's description. If this is @c | |
71 * NULL, the description widget will be hidden. | |
72 * </dd> | |
73 * <dt><tt>"icon-name"</tt> (<tt>char *</tt>)</dt> | |
74 * <dd>The Gtk stock id of an icon for the dialog, or @c NULL for no icon. | |
75 * @see pidginstock.h | |
76 * </dd> | |
77 * </dl> | |
78 */ | |
79 typedef struct { | |
80 GtkVBox parent; | |
81 | |
82 /** A GtkVBox into which extra widgets for the dialog should be packed. | |
83 */ | |
84 GtkBox *contents; | |
85 | |
86 gpointer priv; | |
87 } PidginMiniDialog; | |
88 | |
89 /** The class of #PidginMiniDialog objects. */ | |
90 typedef struct { | |
91 GtkBoxClass parent_class; | |
92 } PidginMiniDialogClass; | |
93 | |
94 /** The type of a callback triggered by a button in a mini-dialog being pressed. | |
95 * @param mini_dialog a dialog, one of whose buttons has been pressed. | |
96 * @param button the button which was pressed. | |
97 * @param user_data arbitrary data, supplied to | |
98 * pidgin_mini_dialog_add_button() when the button was | |
99 * created. | |
100 */ | |
101 typedef void (*PidginMiniDialogCallback)(PidginMiniDialog *mini_dialog, | |
102 GtkButton *button, gpointer user_data); | |
103 | |
104 /** Get the GType of #PidginMiniDialog. */ | |
105 GType pidgin_mini_dialog_get_type (void); | |
106 | |
107 /** Creates a new #PidginMiniDialog. This is a shortcut for creating the dialog | |
108 * with @c g_object_new() then setting each property yourself. | |
109 * @return a new #PidginMiniDialog. | |
110 */ | |
111 PidginMiniDialog *pidgin_mini_dialog_new(const gchar *title, | |
112 const gchar *description, const gchar *icon_name); | |
113 | |
114 /** Shortcut for setting a mini-dialog's title via GObject properties. | |
115 * @param mini_dialog a mini-dialog | |
116 * @param title the new title for @a mini_dialog | |
117 */ | |
118 void pidgin_mini_dialog_set_title(PidginMiniDialog *mini_dialogtitle , | |
119 const char *title); | |
120 | |
121 /** Shortcut for setting a mini-dialog's description via GObject properties. | |
122 * @param mini_dialog a mini-dialog | |
123 * @param description the new description for @a mini_dialog, or @c NULL to | |
124 * hide the description widget. | |
125 */ | |
126 void pidgin_mini_dialog_set_description(PidginMiniDialog *mini_dialog, | |
127 const char *description); | |
128 | |
129 /** Shortcut for setting a mini-dialog's icon via GObject properties. | |
130 * @param mini_dialog a mini-dialog | |
131 * @param title the Gtk stock ID of an icon, or @c NULL for no icon. | |
132 */ | |
133 void pidgin_mini_dialog_set_icon_name(PidginMiniDialog *mini_dialog, | |
134 const char *icon_name); | |
135 | |
136 /** Adds a new button to a mini-dialog, and attaches the supplied callback to | |
137 * its <tt>clicked</tt> signal. After a button is clicked, the dialog is | |
138 * destroyed. | |
139 * @param mini_dialog a mini-dialog | |
140 * @param text the text to display on the new button | |
141 * @param clicked_cb the function to call when the button is clicked | |
142 * @param user_data arbitrary data to pass to @a clicked_cb when it is | |
143 * called. | |
144 */ | |
145 void pidgin_mini_dialog_add_button(PidginMiniDialog *mini_dialog, | |
146 const char *text, PidginMiniDialogCallback clicked_cb, | |
147 gpointer user_data); | |
148 | |
149 G_END_DECLS | |
150 | |
151 #endif /* __PIDGIN_MINI_DIALOG_H__ */ |