pidgin/gtkstatusbox.h

changeset 16238
33bf2fd32108
parent 12779
b0d89f38aebb
parent 15931
716b5fac1895
equal deleted inserted replaced
13071:b98e72d4089a 16238:33bf2fd32108
1 /*
2 * @file gtkstatusbox.c GTK+ Status Selection Widget
3 * @ingroup gtkui
4 *
5 * pidgin
6 *
7 * Pidgin is the legal property of its developers, whose names are too numerous
8 * to list here. Please refer to the COPYRIGHT file distributed with this
9 * source distribution.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */
25
26
27 #ifndef __PIDGIN_STATUS_BOX_H__
28 #define __PIDGIN_STATUS_BOX_H__
29
30 #include <gtk/gtk.h>
31 #include "gtkimhtml.h"
32 #include "account.h"
33 #include "savedstatuses.h"
34 #include "status.h"
35 #include <gtk/gtktreemodel.h>
36 #include <gtk/gtktreeview.h>
37
38 G_BEGIN_DECLS
39
40 #define PIDGIN_TYPE_STATUS_BOX (pidgin_status_box_get_type ())
41 #define PIDGIN_STATUS_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PIDGIN_TYPE_STATUS_BOX, PidginStatusBox))
42 #define PIDGIN_STATUS_BOX_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), PIDGIN_TYPE_STATUS_BOX, PidginStatusBoxClass))
43 #define PIDGIN_IS_STATUS_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PIDGIN_TYPE_STATUS_BOX))
44 #define PIDGIN_IS_STATUS_BOX_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), PIDGIN_TYPE_STATUS_BOX))
45 #define PIDGIN_STATUS_BOX_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), PIDGIN_TYPE_STATUS_BOX, PidginStatusBoxClass))
46
47 /**
48 * This is a hidden field in the GtkStatusBox that identifies the
49 * item in the list store. The item could be a normal
50 * PurpleStatusPrimitive, or it could be something special like the
51 * "Custom..." item, or "Saved..." or a GtkSeparator.
52 */
53 typedef enum
54 {
55 PIDGIN_STATUS_BOX_TYPE_SEPARATOR,
56 PIDGIN_STATUS_BOX_TYPE_PRIMITIVE,
57 PIDGIN_STATUS_BOX_TYPE_POPULAR,
58 PIDGIN_STATUS_BOX_TYPE_CUSTOM,
59 PIDGIN_STATUS_BOX_TYPE_SAVED,
60 PIDGIN_STATUS_BOX_NUM_TYPES
61 } PidginStatusBoxItemType;
62
63 typedef struct _PidginStatusBox PidginStatusBox;
64 typedef struct _PidginStatusBoxClass PidginStatusBoxClass;
65
66 struct _PidginStatusBox
67 {
68 GtkContainer parent_instance;
69
70 /**
71 * This GtkListStore contains only one row--the currently selected status.
72 */
73 GtkListStore *store;
74
75 /**
76 * This is the dropdown GtkListStore that contains the available statuses,
77 * plus some recently used statuses, plus the "Custom..." and "Saved..."
78 * options.
79 */
80 GtkListStore *dropdown_store;
81
82 PurpleAccount *account;
83
84 /* This will be non-NULL and contain a sample account
85 * when all enabled accounts use the same statuses */
86 PurpleAccount *token_status_account;
87
88 GtkWidget *vbox, *sw;
89 GtkWidget *imhtml;
90
91 char *buddy_icon_path;
92 GdkPixbuf *buddy_icon;
93 GdkPixbuf *buddy_icon_hover;
94 GtkWidget *buddy_icon_sel;
95 GtkWidget *icon;
96 GtkWidget *icon_box;
97 GtkWidget *icon_box_menu;
98 GdkCursor *hand_cursor;
99 GdkCursor *arrow_cursor;
100 int icon_size;
101 gboolean icon_opaque;
102
103 gboolean imhtml_visible;
104
105 GtkWidget *cell_view;
106 GtkCellRenderer *icon_rend;
107 GtkCellRenderer *text_rend;
108
109 GdkPixbuf *error_pixbuf;
110 int connecting_index;
111 GdkPixbuf *connecting_pixbufs[9];
112 int typing_index;
113 GdkPixbuf *typing_pixbufs[6];
114
115 gboolean network_available;
116 gboolean connecting;
117 guint typing;
118
119 GtkTreeIter iter;
120 char *error;
121
122 /*
123 * These widgets are made for renderin'
124 * That's just what they'll do
125 * One of these days these widgets
126 * Are gonna render all over you
127 */
128 GtkWidget *hbox;
129 GtkWidget *toggle_button;
130 GtkWidget *vsep;
131 GtkWidget *arrow;
132
133 GtkWidget *popup_window;
134 GtkWidget *popup_frame;
135 GtkWidget *scrolled_window;
136 GtkWidget *cell_view_frame;
137 GtkTreeViewColumn *column;
138 GtkWidget *tree_view;
139 gboolean popup_in_progress;
140 GtkTreeRowReference *active_row;
141 };
142
143 struct _PidginStatusBoxClass
144 {
145 GtkContainerClass parent_class;
146
147 /* signals */
148 void (* changed) (GtkComboBox *combo_box);
149
150 /* Padding for future expansion */
151 void (*_gtk_reserved0) (void);
152 void (*_gtk_reserved1) (void);
153 void (*_gtk_reserved2) (void);
154 void (*_gtk_reserved3) (void);
155 };
156
157
158 GType pidgin_status_box_get_type (void) G_GNUC_CONST;
159 GtkWidget *pidgin_status_box_new (void);
160 GtkWidget *pidgin_status_box_new_with_account (PurpleAccount *);
161
162 void
163 pidgin_status_box_add(PidginStatusBox *status_box, PidginStatusBoxItemType type, GdkPixbuf *pixbuf, const char *text, const char *sec_text, gpointer data);
164
165 void
166 pidgin_status_box_add_separator(PidginStatusBox *status_box);
167
168 void
169 pidgin_status_box_set_network_available(PidginStatusBox *status_box, gboolean available);
170
171 void
172 pidgin_status_box_set_connecting(PidginStatusBox *status_box, gboolean connecting);
173
174 void
175 pidgin_status_box_pulse_connecting(PidginStatusBox *status_box);
176
177 void
178 pidgin_status_box_set_buddy_icon(PidginStatusBox *status_box, const char *filename);
179
180 const char *
181 pidgin_status_box_get_buddy_icon(PidginStatusBox *status_box);
182
183 char *pidgin_status_box_get_message(PidginStatusBox *status_box);
184
185 G_END_DECLS
186
187 #endif /* __GTK_PIDGIN_STATUS_COMBO_BOX_H__ */

mercurial