gtkstatusbox.h
1 /*
2  * @file gtkstatusbox.c GTK+ Status Selection 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 
28 #ifndef __PIDGIN_STATUS_BOX_H__
29 #define __PIDGIN_STATUS_BOX_H__
30 
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"
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 
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_SAVED_POPULAR,
59  PIDGIN_STATUS_BOX_TYPE_CUSTOM,
60  PIDGIN_STATUS_BOX_TYPE_SAVED,
61  PIDGIN_STATUS_BOX_NUM_TYPES
62 } PidginStatusBoxItemType;
63 
64 typedef struct _PidginStatusBox PidginStatusBox;
66 
68 {
69  GtkContainer parent_instance;
70 
74  GtkListStore *store;
75 
81  GtkListStore *dropdown_store;
82 
83  PurpleAccount *account;
84 
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;
88 
89  GtkWidget *vbox, *sw;
90  GtkWidget *imhtml;
91 
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;
103 
104  gboolean imhtml_visible;
105 
106  GtkWidget *cell_view;
107  GtkCellRenderer *icon_rend;
108  GtkCellRenderer *text_rend;
109 
110  GdkPixbuf *error_pixbuf;
111  int connecting_index;
112  GdkPixbuf *connecting_pixbufs[9];
113  int typing_index;
114  GdkPixbuf *typing_pixbufs[6];
115 
116  gboolean network_available;
117  gboolean connecting;
118  guint typing;
119 
120  GtkTreeIter iter;
121  char *error;
122 
123  /*
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
128  */
129  GtkWidget *hbox;
130  GtkWidget *toggle_button;
131  GtkWidget *vsep;
132  GtkWidget *arrow;
133 
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;
142 };
143 
145 {
146  GtkContainerClass parent_class;
147 
148  /* signals */
149  void (* changed) (GtkComboBox *combo_box);
150 
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);
156 };
157 
158 
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 *);
162 
163 void
164 pidgin_status_box_add(PidginStatusBox *status_box, PidginStatusBoxItemType type, GdkPixbuf *pixbuf, const char *text, const char *sec_text, gpointer data);
165 
166 void
167 pidgin_status_box_add_separator(PidginStatusBox *status_box);
168 
169 void
170 pidgin_status_box_set_network_available(PidginStatusBox *status_box, gboolean available);
171 
172 void
173 pidgin_status_box_set_connecting(PidginStatusBox *status_box, gboolean connecting);
174 
175 void
176 pidgin_status_box_pulse_connecting(PidginStatusBox *status_box);
177 
178 void
179 pidgin_status_box_set_buddy_icon(PidginStatusBox *status_box, PurpleStoredImage *img);
180 
181 char *pidgin_status_box_get_message(PidginStatusBox *status_box);
182 
183 G_END_DECLS
184 
185 #endif /* __GTK_PIDGIN_STATUS_COMBO_BOX_H__ */
GtkListStore * dropdown_store
This is the dropdown GtkListStore that contains the available statuses, plus some recently used statu...
Definition: gtkstatusbox.h:81
struct _PurpleStoredImage PurpleStoredImage
A set of utility functions that provide a reference-counted immutable wrapper around an image&#39;s data ...
Definition: imgstore.h:37
Structure representing an account.
Definition: account.h:126
Saved Status API.
GtkListStore * store
This GtkListStore contains only one row–the currently selected status.
Definition: gtkstatusbox.h:74
Account API.
Status APIA brief explanation of the status API:
IM Image Store API.
GTK+ IM/HTML rendering component.