gtkstatusbox.h

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