comparison gtk/gtkstatusbox.h @ 14191:009db0b357b5

This is a hand-crafted commit to migrate across subversion revisions 16854:16861, due to some vagaries of the way the original renames were done. Witness that monotone can do in one revision what svn had to spread across several.
author Ethan Blanton <elb@pidgin.im>
date Sat, 16 Dec 2006 04:59:55 +0000
parents
children 587268c9c6d7
comparison
equal deleted inserted replaced
14190:366be2ce35a7 14191:009db0b357b5
1 /*
2 * @file gtkstatusbox.c GTK+ Status Selection Widget
3 * @ingroup gtkui
4 *
5 * gaim
6 *
7 * Gaim 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 __GTK_GAIM_STATUS_BOX_H__
28 #define __GTK_GAIM_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 GTK_GAIM_TYPE_STATUS_BOX (gtk_gaim_status_box_get_type ())
41 #define GTK_GAIM_STATUS_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_GAIM_TYPE_STATUS_BOX, GtkGaimStatusBox))
42 #define GTK_GAIM_STATUS_BOX_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), GTK_GAIM_TYPE_STATUS_BOX, GtkGaimStatusBoxClass))
43 #define GTK_GAIM_IS_STATUS_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_GAIM_TYPE_STATUS_BOX))
44 #define GTK_GAIM_IS_STATUS_BOX_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), GTK_GAIM_TYPE_STATUS_BOX))
45 #define GTK_GAIM_STATUS_BOX_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), GTK_GAIM_TYPE_STATUS_BOX, GtkGaimStatusBoxClass))
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 * GaimStatusPrimitive, or it could be something special like the
51 * "Custom..." item, or "Saved..." or a GtkSeparator.
52 */
53 typedef enum
54 {
55 GTK_GAIM_STATUS_BOX_TYPE_SEPARATOR,
56 GTK_GAIM_STATUS_BOX_TYPE_PRIMITIVE,
57 GTK_GAIM_STATUS_BOX_TYPE_POPULAR,
58 GTK_GAIM_STATUS_BOX_TYPE_CUSTOM,
59 GTK_GAIM_STATUS_BOX_TYPE_SAVED,
60 GTK_GAIM_STATUS_BOX_NUM_TYPES
61 } GtkGaimStatusBoxItemType;
62
63 typedef struct _GtkGaimStatusBox GtkGaimStatusBox;
64 typedef struct _GtkGaimStatusBoxClass GtkGaimStatusBoxClass;
65
66 struct _GtkGaimStatusBox
67 {
68 GtkComboBox 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 GaimAccount *account;
83
84 GtkWidget *vbox, *sw;
85 GtkWidget *imhtml;
86
87 char *buddy_icon_path;
88 GdkPixbuf *buddy_icon;
89 GdkPixbuf *buddy_icon_hover;
90 GtkWidget *buddy_icon_sel;
91 GtkWidget *icon;
92 GtkWidget *icon_box;
93 GdkCursor *hand_cursor;
94 GdkCursor *arrow_cursor;
95 int icon_size;
96
97 gboolean imhtml_visible;
98
99 GtkWidget *cell_view;
100 GtkCellRenderer *icon_rend;
101 GtkCellRenderer *text_rend;
102
103 GdkPixbuf *error_pixbuf;
104 int connecting_index;
105 GdkPixbuf *connecting_pixbufs[4];
106 int typing_index;
107 GdkPixbuf *typing_pixbufs[4];
108
109 gboolean connecting;
110 guint typing;
111
112 GtkTreeIter iter;
113 char *error;
114
115 gulong status_changed_signal;
116
117 /*
118 * These widgets are made for renderin'
119 * That's just what they'll do
120 * One of these days these widgets
121 * Are gonna render all over you
122 */
123 GtkWidget *hbox;
124 GtkWidget *toggle_button;
125 GtkWidget *vsep;
126 GtkWidget *arrow;
127 };
128
129 struct _GtkGaimStatusBoxClass
130 {
131 GtkComboBoxClass parent_class;
132
133 /* signals */
134 void (* changed) (GtkComboBox *combo_box);
135
136 /* Padding for future expansion */
137 void (*_gtk_reserved0) (void);
138 void (*_gtk_reserved1) (void);
139 void (*_gtk_reserved2) (void);
140 void (*_gtk_reserved3) (void);
141 };
142
143
144 GType gtk_gaim_status_box_get_type (void) G_GNUC_CONST;
145 GtkWidget *gtk_gaim_status_box_new (void);
146 GtkWidget *gtk_gaim_status_box_new_with_account (GaimAccount *);
147
148 void
149 gtk_gaim_status_box_add(GtkGaimStatusBox *status_box, GtkGaimStatusBoxItemType type, GdkPixbuf *pixbuf, const char *text, const char *sec_text, gpointer data);
150
151 void
152 gtk_gaim_status_box_add_separator(GtkGaimStatusBox *status_box);
153
154 void
155 gtk_gaim_status_box_set_connecting(GtkGaimStatusBox *status_box, gboolean connecting);
156
157 void
158 gtk_gaim_status_box_pulse_connecting(GtkGaimStatusBox *status_box);
159
160 void
161 gtk_gaim_status_box_set_buddy_icon(GtkGaimStatusBox *status_box, const char *filename);
162
163 const char *
164 gtk_gaim_status_box_get_buddy_icon(GtkGaimStatusBox *status_box);
165
166 char *gtk_gaim_status_box_get_message(GtkGaimStatusBox *status_box);
167
168 G_END_DECLS
169
170 #endif /* __GTK_GAIM_GTK_STATUS_COMBO_BOX_H__ */