Branch for 2.7.7.
[pidgin-git.git] / pidgin / gtkstatusbox.h
blob37b536788f598e3a87459db6f9b23a3f62c75786
1 /*
2 * @file gtkstatusbox.c GTK+ Status Selection Widget
3 * @ingroup pidgin
4 */
6 /* pidgin
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.
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.
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.
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
28 #ifndef __PIDGIN_STATUS_BOX_H__
29 #define __PIDGIN_STATUS_BOX_H__
31 #include <gtk/gtk.h>
32 #include "gtkimhtml.h"
33 #include "account.h"
34 #include "imgstore.h"
35 #include "savedstatuses.h"
36 #include "status.h"
38 G_BEGIN_DECLS
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))
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.
53 typedef enum
55 PIDGIN_STATUS_BOX_TYPE_SEPARATOR,
56 PIDGIN_STATUS_BOX_TYPE_PRIMITIVE,
57 PIDGIN_STATUS_BOX_TYPE_POPULAR,
58 PIDGIN_STATUS_BOX_TYPE_SAVED_POPULAR,
59 PIDGIN_STATUS_BOX_TYPE_CUSTOM,
60 PIDGIN_STATUS_BOX_TYPE_SAVED,
61 PIDGIN_STATUS_BOX_NUM_TYPES
62 } PidginStatusBoxItemType;
64 typedef struct _PidginStatusBox PidginStatusBox;
65 typedef struct _PidginStatusBoxClass PidginStatusBoxClass;
67 struct _PidginStatusBox
69 GtkContainer parent_instance;
71 /**
72 * This GtkListStore contains only one row--the currently selected status.
74 GtkListStore *store;
76 /**
77 * This is the dropdown GtkListStore that contains the available statuses,
78 * plus some recently used statuses, plus the "Custom..." and "Saved..."
79 * options.
81 GtkListStore *dropdown_store;
83 PurpleAccount *account;
85 /* This will be non-NULL and contain a sample account
86 * when all enabled accounts use the same statuses */
87 PurpleAccount *token_status_account;
89 GtkWidget *vbox, *sw;
90 GtkWidget *imhtml;
92 PurpleStoredImage *buddy_icon_img;
93 GdkPixbuf *buddy_icon;
94 GdkPixbuf *buddy_icon_hover;
95 GtkWidget *buddy_icon_sel;
96 GtkWidget *icon;
97 GtkWidget *icon_box;
98 GtkWidget *icon_box_menu;
99 GdkCursor *hand_cursor;
100 GdkCursor *arrow_cursor;
101 int icon_size;
102 gboolean icon_opaque;
104 gboolean imhtml_visible;
106 GtkWidget *cell_view;
107 GtkCellRenderer *icon_rend;
108 GtkCellRenderer *text_rend;
110 GdkPixbuf *error_pixbuf;
111 int connecting_index;
112 GdkPixbuf *connecting_pixbufs[9];
113 int typing_index;
114 GdkPixbuf *typing_pixbufs[6];
116 gboolean network_available;
117 gboolean connecting;
118 guint typing;
120 GtkTreeIter iter;
121 char *error;
124 * These widgets are made for renderin'
125 * That's just what they'll do
126 * One of these days these widgets
127 * Are gonna render all over you
129 GtkWidget *hbox;
130 GtkWidget *toggle_button;
131 GtkWidget *vsep;
132 GtkWidget *arrow;
134 GtkWidget *popup_window;
135 GtkWidget *popup_frame;
136 GtkWidget *scrolled_window;
137 GtkWidget *cell_view_frame;
138 GtkTreeViewColumn *column;
139 GtkWidget *tree_view;
140 gboolean popup_in_progress;
141 GtkTreeRowReference *active_row;
144 struct _PidginStatusBoxClass
146 GtkContainerClass parent_class;
148 /* signals */
149 void (* changed) (GtkComboBox *combo_box);
151 /* Padding for future expansion */
152 void (*_gtk_reserved0) (void);
153 void (*_gtk_reserved1) (void);
154 void (*_gtk_reserved2) (void);
155 void (*_gtk_reserved3) (void);
159 GType pidgin_status_box_get_type (void) G_GNUC_CONST;
160 GtkWidget *pidgin_status_box_new (void);
161 GtkWidget *pidgin_status_box_new_with_account (PurpleAccount *);
163 void
164 pidgin_status_box_add(PidginStatusBox *status_box, PidginStatusBoxItemType type, GdkPixbuf *pixbuf, const char *text, const char *sec_text, gpointer data);
166 void
167 pidgin_status_box_add_separator(PidginStatusBox *status_box);
169 void
170 pidgin_status_box_set_network_available(PidginStatusBox *status_box, gboolean available);
172 void
173 pidgin_status_box_set_connecting(PidginStatusBox *status_box, gboolean connecting);
175 void
176 pidgin_status_box_pulse_connecting(PidginStatusBox *status_box);
178 void
179 pidgin_status_box_set_buddy_icon(PidginStatusBox *status_box, PurpleStoredImage *img);
181 char *pidgin_status_box_get_message(PidginStatusBox *status_box);
183 G_END_DECLS
185 #endif /* __GTK_PIDGIN_STATUS_COMBO_BOX_H__ */