Merged in default (pull request #594)
[pidgin-git.git] / pidgin / gtkstatusbox.h
blobe73fe161001c7066a483b473a299ece243e9e303
1 /* pidgin
3 * Pidgin is the legal property of its developers, whose names are too numerous
4 * to list here. Please refer to the COPYRIGHT file distributed with this
5 * source distribution.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
22 #ifndef __PIDGIN_STATUS_BOX_H__
23 #define __PIDGIN_STATUS_BOX_H__
24 /**
25 * SECTION:gtkstatusbox
26 * @section_id: pidgin-gtkstatusbox
27 * @short_description: <filename>gtkstatusbox.h</filename>
28 * @title: Status Selection Widget
31 #include <gtk/gtk.h>
33 #include <talkatu.h>
35 #include "account.h"
36 #include "savedstatuses.h"
37 #include "status.h"
39 G_BEGIN_DECLS
41 #define PIDGIN_TYPE_STATUS_BOX (pidgin_status_box_get_type ())
42 #define PIDGIN_STATUS_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PIDGIN_TYPE_STATUS_BOX, PidginStatusBox))
43 #define PIDGIN_STATUS_BOX_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), PIDGIN_TYPE_STATUS_BOX, PidginStatusBoxClass))
44 #define PIDGIN_IS_STATUS_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PIDGIN_TYPE_STATUS_BOX))
45 #define PIDGIN_IS_STATUS_BOX_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), PIDGIN_TYPE_STATUS_BOX))
46 #define PIDGIN_STATUS_BOX_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), PIDGIN_TYPE_STATUS_BOX, PidginStatusBoxClass))
48 /**
49 * PidginStatusBoxItemType:
51 * This is a hidden field in the GtkStatusBox that identifies the
52 * item in the list store. The item could be a normal
53 * PurpleStatusPrimitive, or it could be something special like the
54 * "Custom..." item, or "Saved..." or a GtkSeparator.
56 typedef enum
58 PIDGIN_STATUS_BOX_TYPE_SEPARATOR,
59 PIDGIN_STATUS_BOX_TYPE_PRIMITIVE,
60 PIDGIN_STATUS_BOX_TYPE_POPULAR,
61 PIDGIN_STATUS_BOX_TYPE_SAVED_POPULAR,
62 PIDGIN_STATUS_BOX_TYPE_CUSTOM,
63 PIDGIN_STATUS_BOX_TYPE_SAVED,
64 PIDGIN_STATUS_BOX_NUM_TYPES
65 } PidginStatusBoxItemType;
67 typedef struct _PidginStatusBox PidginStatusBox;
68 typedef struct _PidginStatusBoxClass PidginStatusBoxClass;
70 /**
71 * PidginStatusBox:
72 * @store: This GtkListStore contains only one row--the currently
73 * selected status.
74 * @dropdown_store: This is the dropdown GtkListStore that contains the
75 * available statuses, plus some recently used statuses, plus
76 * the "Custom..." and "Saved..." options.
77 * @token_status_account: This will be non-NULL and contain a sample account
78 * when all enabled accounts use the same statuses
80 struct _PidginStatusBox
82 GtkContainer parent_instance;
84 /*< public >*/
85 GtkListStore *store;
86 GtkListStore *dropdown_store;
88 PurpleAccount *account;
90 PurpleAccount *token_status_account;
92 GtkWidget *vbox;
93 gboolean editor_visible;
94 GtkWidget *editor;
95 GtkWidget *view;
96 GtkTextBuffer *buffer;
98 PurpleImage *buddy_icon_img;
99 GdkPixbuf *buddy_icon;
100 GdkPixbuf *buddy_icon_hover;
101 GtkFileChooserNative *buddy_icon_sel;
102 GtkWidget *icon;
103 GtkWidget *icon_box;
104 GtkWidget *icon_box_menu;
105 GdkCursor *hand_cursor;
106 GdkCursor *arrow_cursor;
107 int icon_size;
108 gboolean icon_opaque;
111 GtkWidget *cell_view;
112 GtkCellRenderer *icon_rend;
113 GtkCellRenderer *text_rend;
115 GdkPixbuf *error_pixbuf;
116 int connecting_index;
117 GdkPixbuf *connecting_pixbufs[9];
118 int typing_index;
119 GdkPixbuf *typing_pixbufs[6];
121 gboolean network_available;
122 gboolean connecting;
123 guint typing;
125 GtkTreeIter iter;
126 char *error;
129 * These widgets are made for renderin'
130 * That's just what they'll do
131 * One of these days these widgets
132 * Are gonna render all over you
134 GtkWidget *hbox;
135 GtkWidget *toggle_button;
136 GtkWidget *vsep;
137 GtkWidget *arrow;
139 GtkWidget *popup_window;
140 GtkWidget *popup_frame;
141 GtkWidget *scrolled_window;
142 GtkWidget *cell_view_frame;
143 GtkTreeViewColumn *column;
144 GtkWidget *tree_view;
145 gboolean popup_in_progress;
146 GtkTreeRowReference *active_row;
149 struct _PidginStatusBoxClass
151 GtkContainerClass parent_class;
153 /* signals */
154 void (* changed) (GtkComboBox *combo_box);
156 /*< private >*/
157 void (*_gtk_reserved0) (void);
158 void (*_gtk_reserved1) (void);
159 void (*_gtk_reserved2) (void);
160 void (*_gtk_reserved3) (void);
164 GType pidgin_status_box_get_type (void) G_GNUC_CONST;
165 GtkWidget *pidgin_status_box_new (void);
166 GtkWidget *pidgin_status_box_new_with_account (PurpleAccount *account);
168 void
169 pidgin_status_box_add(PidginStatusBox *status_box, PidginStatusBoxItemType type, GdkPixbuf *pixbuf, const char *text, const char *sec_text, gpointer data);
171 void
172 pidgin_status_box_add_separator(PidginStatusBox *status_box);
174 void
175 pidgin_status_box_set_network_available(PidginStatusBox *status_box, gboolean available);
177 void
178 pidgin_status_box_set_connecting(PidginStatusBox *status_box, gboolean connecting);
180 void
181 pidgin_status_box_pulse_connecting(PidginStatusBox *status_box);
183 void
184 pidgin_status_box_set_buddy_icon(PidginStatusBox *status_box, PurpleImage *img);
186 char *pidgin_status_box_get_message(PidginStatusBox *status_box);
188 G_END_DECLS
190 #endif /* __GTK_PIDGIN_STATUS_COMBO_BOX_H__ */