gtkstatusbox.h

00001 /*
00002  * @file gtkstatusbox.c GTK+ Status Selection Widget
00003  * @ingroup pidgin
00004  */
00005 
00006 /* pidgin
00007  *
00008  * Pidgin is the legal property of its developers, whose names are too numerous
00009  * to list here.  Please refer to the COPYRIGHT file distributed with this
00010  * source distribution.
00011  *
00012  * This program is free software; you can redistribute it and/or modify
00013  * it under the terms of the GNU General Public License as published by
00014  * the Free Software Foundation; either version 2 of the License, or
00015  * (at your option) any later version.
00016  *
00017  * This program is distributed in the hope that it will be useful,
00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  * GNU General Public License for more details.
00021  *
00022  * You should have received a copy of the GNU General Public License
00023  * along with this program; if not, write to the Free Software
00024  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
00025  */
00026 
00027 
00028 #ifndef __PIDGIN_STATUS_BOX_H__
00029 #define __PIDGIN_STATUS_BOX_H__
00030 
00031 #include <gtk/gtk.h>
00032 #include "gtkimhtml.h"
00033 #include "account.h"
00034 #include "imgstore.h"
00035 #include "savedstatuses.h"
00036 #include "status.h"
00037 #include <gtk/gtktreemodel.h>
00038 #include <gtk/gtktreeview.h>
00039 
00040 G_BEGIN_DECLS
00041 
00042 #define PIDGIN_TYPE_STATUS_BOX             (pidgin_status_box_get_type ())
00043 #define PIDGIN_STATUS_BOX(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), PIDGIN_TYPE_STATUS_BOX, PidginStatusBox))
00044 #define PIDGIN_STATUS_BOX_CLASS(vtable)    (G_TYPE_CHECK_CLASS_CAST ((vtable), PIDGIN_TYPE_STATUS_BOX, PidginStatusBoxClass))
00045 #define PIDGIN_IS_STATUS_BOX(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PIDGIN_TYPE_STATUS_BOX))
00046 #define PIDGIN_IS_STATUS_BOX_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), PIDGIN_TYPE_STATUS_BOX))
00047 #define PIDGIN_STATUS_BOX_GET_CLASS(inst)  (G_TYPE_INSTANCE_GET_CLASS ((inst), PIDGIN_TYPE_STATUS_BOX, PidginStatusBoxClass))
00048 
00055 typedef enum
00056 {
00057     PIDGIN_STATUS_BOX_TYPE_SEPARATOR,
00058     PIDGIN_STATUS_BOX_TYPE_PRIMITIVE,
00059     PIDGIN_STATUS_BOX_TYPE_POPULAR,
00060     PIDGIN_STATUS_BOX_TYPE_SAVED_POPULAR,
00061     PIDGIN_STATUS_BOX_TYPE_CUSTOM,
00062     PIDGIN_STATUS_BOX_TYPE_SAVED,
00063     PIDGIN_STATUS_BOX_NUM_TYPES
00064 } PidginStatusBoxItemType;
00065 
00066 typedef struct _PidginStatusBox      PidginStatusBox;
00067 typedef struct _PidginStatusBoxClass PidginStatusBoxClass;
00068 
00069 struct _PidginStatusBox
00070 {
00071     GtkContainer parent_instance;
00072 
00076     GtkListStore *store;
00077 
00083     GtkListStore *dropdown_store;
00084 
00085     PurpleAccount *account;
00086 
00087     /* This will be non-NULL and contain a sample account
00088      * when all enabled accounts use the same statuses */
00089     PurpleAccount *token_status_account;
00090 
00091     GtkWidget *vbox, *sw;
00092     GtkWidget *imhtml;
00093 
00094     PurpleStoredImage *buddy_icon_img;
00095     GdkPixbuf *buddy_icon;
00096     GdkPixbuf *buddy_icon_hover;
00097     GtkWidget *buddy_icon_sel;
00098     GtkWidget *icon;
00099     GtkWidget *icon_box;
00100     GtkWidget *icon_box_menu;
00101     GdkCursor *hand_cursor;
00102     GdkCursor *arrow_cursor;
00103         int icon_size;
00104         gboolean icon_opaque;
00105 
00106     gboolean imhtml_visible;
00107 
00108     GtkWidget *cell_view;
00109     GtkCellRenderer *icon_rend;
00110     GtkCellRenderer *text_rend;
00111 
00112     GdkPixbuf *error_pixbuf;
00113     int connecting_index;
00114     GdkPixbuf *connecting_pixbufs[9];
00115     int typing_index;
00116     GdkPixbuf *typing_pixbufs[6];
00117 
00118     gboolean network_available;
00119     gboolean connecting;
00120     guint typing;
00121 
00122     GtkTreeIter iter;
00123     char *error;
00124 
00125     /*
00126      * These widgets are made for renderin'
00127      * That's just what they'll do
00128      * One of these days these widgets
00129      * Are gonna render all over you
00130      */
00131     GtkWidget *hbox;
00132     GtkWidget *toggle_button;
00133     GtkWidget *vsep;
00134     GtkWidget *arrow;
00135 
00136     GtkWidget *popup_window;
00137     GtkWidget *popup_frame;
00138     GtkWidget *scrolled_window;
00139     GtkWidget *cell_view_frame;
00140     GtkTreeViewColumn *column;
00141     GtkWidget *tree_view;
00142     gboolean popup_in_progress;
00143     GtkTreeRowReference *active_row;
00144 };
00145 
00146 struct _PidginStatusBoxClass
00147 {
00148     GtkContainerClass parent_class;
00149 
00150     /* signals */
00151     void     (* changed)          (GtkComboBox *combo_box);
00152 
00153     /* Padding for future expansion */
00154     void (*_gtk_reserved0) (void);
00155     void (*_gtk_reserved1) (void);
00156     void (*_gtk_reserved2) (void);
00157     void (*_gtk_reserved3) (void);
00158 };
00159 
00160 
00161 GType         pidgin_status_box_get_type         (void) G_GNUC_CONST;
00162 GtkWidget    *pidgin_status_box_new              (void);
00163 GtkWidget    *pidgin_status_box_new_with_account (PurpleAccount *);
00164 
00165 void
00166 pidgin_status_box_add(PidginStatusBox *status_box, PidginStatusBoxItemType type, GdkPixbuf *pixbuf, const char *text, const char *sec_text, gpointer data);
00167 
00168 void
00169 pidgin_status_box_add_separator(PidginStatusBox *status_box);
00170 
00171 void
00172 pidgin_status_box_set_network_available(PidginStatusBox *status_box, gboolean available);
00173 
00174 void
00175 pidgin_status_box_set_connecting(PidginStatusBox *status_box, gboolean connecting);
00176 
00177 void
00178 pidgin_status_box_pulse_connecting(PidginStatusBox *status_box);
00179 
00180 void
00181 pidgin_status_box_set_buddy_icon(PidginStatusBox *status_box, PurpleStoredImage *img);
00182 
00183 char *pidgin_status_box_get_message(PidginStatusBox *status_box);
00184 
00185 G_END_DECLS
00186 
00187 #endif /* __GTK_PIDGIN_STATUS_COMBO_BOX_H__ */