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 
00038 G_BEGIN_DECLS
00039 
00040 #define PIDGIN_TYPE_STATUS_BOX             (pidgin_status_box_get_type ())
00041 #define PIDGIN_STATUS_BOX(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), PIDGIN_TYPE_STATUS_BOX, PidginStatusBox))
00042 #define PIDGIN_STATUS_BOX_CLASS(vtable)    (G_TYPE_CHECK_CLASS_CAST ((vtable), PIDGIN_TYPE_STATUS_BOX, PidginStatusBoxClass))
00043 #define PIDGIN_IS_STATUS_BOX(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PIDGIN_TYPE_STATUS_BOX))
00044 #define PIDGIN_IS_STATUS_BOX_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), PIDGIN_TYPE_STATUS_BOX))
00045 #define PIDGIN_STATUS_BOX_GET_CLASS(inst)  (G_TYPE_INSTANCE_GET_CLASS ((inst), PIDGIN_TYPE_STATUS_BOX, PidginStatusBoxClass))
00046 
00053 typedef enum
00054 {
00055     PIDGIN_STATUS_BOX_TYPE_SEPARATOR,
00056     PIDGIN_STATUS_BOX_TYPE_PRIMITIVE,
00057     PIDGIN_STATUS_BOX_TYPE_POPULAR,
00058     PIDGIN_STATUS_BOX_TYPE_SAVED_POPULAR,
00059     PIDGIN_STATUS_BOX_TYPE_CUSTOM,
00060     PIDGIN_STATUS_BOX_TYPE_SAVED,
00061     PIDGIN_STATUS_BOX_NUM_TYPES
00062 } PidginStatusBoxItemType;
00063 
00064 typedef struct _PidginStatusBox      PidginStatusBox;
00065 typedef struct _PidginStatusBoxClass PidginStatusBoxClass;
00066 
00067 struct _PidginStatusBox
00068 {
00069     GtkContainer parent_instance;
00070 
00074     GtkListStore *store;
00075 
00081     GtkListStore *dropdown_store;
00082 
00083     PurpleAccount *account;
00084 
00085     /* This will be non-NULL and contain a sample account
00086      * when all enabled accounts use the same statuses */
00087     PurpleAccount *token_status_account;
00088 
00089     GtkWidget *vbox, *sw;
00090     GtkWidget *imhtml;
00091 
00092     PurpleStoredImage *buddy_icon_img;
00093     GdkPixbuf *buddy_icon;
00094     GdkPixbuf *buddy_icon_hover;
00095     GtkWidget *buddy_icon_sel;
00096     GtkWidget *icon;
00097     GtkWidget *icon_box;
00098     GtkWidget *icon_box_menu;
00099     GdkCursor *hand_cursor;
00100     GdkCursor *arrow_cursor;
00101         int icon_size;
00102         gboolean icon_opaque;
00103 
00104     gboolean imhtml_visible;
00105 
00106     GtkWidget *cell_view;
00107     GtkCellRenderer *icon_rend;
00108     GtkCellRenderer *text_rend;
00109 
00110     GdkPixbuf *error_pixbuf;
00111     int connecting_index;
00112     GdkPixbuf *connecting_pixbufs[9];
00113     int typing_index;
00114     GdkPixbuf *typing_pixbufs[6];
00115 
00116     gboolean network_available;
00117     gboolean connecting;
00118     guint typing;
00119 
00120     GtkTreeIter iter;
00121     char *error;
00122 
00123     /*
00124      * These widgets are made for renderin'
00125      * That's just what they'll do
00126      * One of these days these widgets
00127      * Are gonna render all over you
00128      */
00129     GtkWidget *hbox;
00130     GtkWidget *toggle_button;
00131     GtkWidget *vsep;
00132     GtkWidget *arrow;
00133 
00134     GtkWidget *popup_window;
00135     GtkWidget *popup_frame;
00136     GtkWidget *scrolled_window;
00137     GtkWidget *cell_view_frame;
00138     GtkTreeViewColumn *column;
00139     GtkWidget *tree_view;
00140     gboolean popup_in_progress;
00141     GtkTreeRowReference *active_row;
00142 };
00143 
00144 struct _PidginStatusBoxClass
00145 {
00146     GtkContainerClass parent_class;
00147 
00148     /* signals */
00149     void     (* changed)          (GtkComboBox *combo_box);
00150 
00151     /* Padding for future expansion */
00152     void (*_gtk_reserved0) (void);
00153     void (*_gtk_reserved1) (void);
00154     void (*_gtk_reserved2) (void);
00155     void (*_gtk_reserved3) (void);
00156 };
00157 
00158 
00159 GType         pidgin_status_box_get_type         (void) G_GNUC_CONST;
00160 GtkWidget    *pidgin_status_box_new              (void);
00161 GtkWidget    *pidgin_status_box_new_with_account (PurpleAccount *);
00162 
00163 void
00164 pidgin_status_box_add(PidginStatusBox *status_box, PidginStatusBoxItemType type, GdkPixbuf *pixbuf, const char *text, const char *sec_text, gpointer data);
00165 
00166 void
00167 pidgin_status_box_add_separator(PidginStatusBox *status_box);
00168 
00169 void
00170 pidgin_status_box_set_network_available(PidginStatusBox *status_box, gboolean available);
00171 
00172 void
00173 pidgin_status_box_set_connecting(PidginStatusBox *status_box, gboolean connecting);
00174 
00175 void
00176 pidgin_status_box_pulse_connecting(PidginStatusBox *status_box);
00177 
00178 void
00179 pidgin_status_box_set_buddy_icon(PidginStatusBox *status_box, PurpleStoredImage *img);
00180 
00181 char *pidgin_status_box_get_message(PidginStatusBox *status_box);
00182 
00183 G_END_DECLS
00184 
00185 #endif /* __GTK_PIDGIN_STATUS_COMBO_BOX_H__ */