gtkconv.h

Go to the documentation of this file.
00001 
00007 /* pidgin
00008  *
00009  * Pidgin is the legal property of its developers, whose names are too numerous
00010  * to list here.  Please refer to the COPYRIGHT file distributed with this
00011  * source distribution.
00012  *
00013  * This program is free software; you can redistribute it and/or modify
00014  * it under the terms of the GNU General Public License as published by
00015  * the Free Software Foundation; either version 2 of the License, or
00016  * (at your option) any later version.
00017  *
00018  * This program is distributed in the hope that it will be useful,
00019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021  * GNU General Public License for more details.
00022  *
00023  * You should have received a copy of the GNU General Public License
00024  * along with this program; if not, write to the Free Software
00025  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
00026  */
00027 #ifndef _PIDGIN_CONVERSATION_H_
00028 #define _PIDGIN_CONVERSATION_H_
00029 
00030 typedef struct _PidginImPane       PidginImPane;
00031 typedef struct _PidginChatPane     PidginChatPane;
00032 typedef struct _PidginConversation PidginConversation;
00033 
00037 typedef enum
00038 {
00039     PIDGIN_UNSEEN_NONE,   
00040     PIDGIN_UNSEEN_EVENT,  
00041     PIDGIN_UNSEEN_NO_LOG, 
00042     PIDGIN_UNSEEN_TEXT,   
00043     PIDGIN_UNSEEN_NICK    
00044 } PidginUnseenState;
00045 
00046 enum {
00047     CHAT_USERS_ICON_COLUMN,
00048     CHAT_USERS_ALIAS_COLUMN,
00049     CHAT_USERS_ALIAS_KEY_COLUMN,
00050     CHAT_USERS_NAME_COLUMN,
00051     CHAT_USERS_FLAGS_COLUMN,
00052     CHAT_USERS_COLOR_COLUMN,
00053     CHAT_USERS_WEIGHT_COLUMN,
00054     CHAT_USERS_COLUMNS
00055 };
00056 
00057 #define PIDGIN_CONVERSATION(conv) \
00058     ((PidginConversation *)(conv)->ui_data)
00059 
00060 #define PIDGIN_IS_PIDGIN_CONVERSATION(conv) \
00061     (purple_conversation_get_ui_ops(conv) == \
00062      pidgin_conversations_get_conv_ui_ops())
00063 
00064 #include "pidgin.h"
00065 #include "conversation.h"
00066 #include "gtkconvwin.h"
00067 
00068 /**************************************************************************
00069  * @name Structures
00070  **************************************************************************/
00081 struct _PidginImPane
00082 {
00083     GtkWidget *block;
00084     GtkWidget *send_file;
00085     GtkWidget *sep1;
00086     GtkWidget *sep2;
00087     GtkWidget *check;
00088     GtkWidget *progress;
00089     guint32 typing_timer;
00090 
00091     /* Buddy icon stuff */
00092     GtkWidget *icon_container;
00093     GtkWidget *icon;
00094     gboolean show_icon;
00095     gboolean animate;
00096     GdkPixbufAnimation *anim;
00097     GdkPixbufAnimationIter *iter;
00098     guint32 icon_timer;
00099 };
00100 
00104 struct _PidginChatPane
00105 {
00106     GtkWidget *count;
00107     GtkWidget *list;
00108     GtkWidget *topic_text;
00109 };
00110 
00114 struct _PidginConversation
00115 {
00116     PurpleConversation *active_conv;
00117     GList *convs;
00118     GList *send_history;
00119 
00120     PidginWindow *win;
00121 
00122     gboolean make_sound;
00123 
00124     GtkTooltips *tooltips;
00125 
00126     GtkWidget *tab_cont;
00127     GtkWidget *tabby;
00128     GtkWidget *menu_tabby;
00129 
00130     GtkWidget *imhtml;
00131     GtkTextBuffer *entry_buffer;
00132     GtkWidget *entry;
00133     gboolean auto_resize;   /* this is set to TRUE if the conversation
00134                  * is being resized by a non-user-initiated
00135                  * event, such as the buddy icon appearing
00136                  */
00137     gboolean entry_growing; /* True if the size of the entry was set
00138                  * automatically by typing too much to fit
00139                  * in one line */
00140 
00141     GtkWidget *close; /* "x" on the tab */
00142     GtkWidget *icon;
00143     GtkWidget *tab_label;
00144     GtkWidget *menu_icon;
00145     GtkWidget *menu_label;
00146 #if !(defined PIDGIN_DISABLE_DEPRECATED) || (defined _PIDGIN_GTKCONV_C_)
00147 
00148     GtkSizeGroup *sg;
00149 #else
00150     gpointer depr1;
00151 #endif
00152 
00153     GtkWidget *lower_hbox;
00154 
00155     GtkWidget *toolbar;
00156 
00157     PidginUnseenState unseen_state;
00158     guint unseen_count;
00159 
00160     union
00161     {
00162         PidginImPane   *im;
00163         PidginChatPane *chat;
00164 
00165     } u;
00166 
00167     time_t newday;
00168     GtkWidget *infopane_hbox;
00169     GtkWidget *infopane;
00170     GtkListStore *infopane_model;
00171     GtkTreeIter infopane_iter;
00172 
00173     /* Used when attaching a PidginConversation to a PurpleConversation
00174      * with message history */
00175     struct {
00176         int timer;
00177         GList *current;
00178     } attach;
00179 };
00180 
00183 /**************************************************************************
00184  * @name GTK+ Conversation API
00185  **************************************************************************/
00193 PurpleConversationUiOps *pidgin_conversations_get_conv_ui_ops(void);
00194 
00200 void pidgin_conv_update_buddy_icon(PurpleConversation *conv);
00201 
00207 void pidgin_conv_switch_active_conversation(PurpleConversation *conv);
00208 
00214 void pidgin_conv_update_buttons_by_protocol(PurpleConversation *conv);
00215 
00231 GList *
00232 pidgin_conversations_find_unseen_list(PurpleConversationType type,
00233                                         PidginUnseenState min_state,
00234                                         gboolean hidden_only,
00235                                         guint max_count);
00236 
00245 guint
00246 pidgin_conversations_fill_menu(GtkWidget *menu, GList *convs);
00247 
00253 void pidgin_conv_present_conversation(PurpleConversation *conv);
00254 
00264 gboolean pidgin_conv_attach_to_conversation(PurpleConversation *conv);
00265 
00266 PidginWindow *pidgin_conv_get_window(PidginConversation *gtkconv);
00267 GdkPixbuf *pidgin_conv_get_tab_icon(PurpleConversation *conv, gboolean small_icon);
00268 void pidgin_conv_new(PurpleConversation *conv);
00269 int pidgin_conv_get_tab_at_xy(PidginWindow *win, int x, int y, gboolean *to_right);
00270 gboolean pidgin_conv_is_hidden(PidginConversation *gtkconv);
00273 /**************************************************************************/
00275 /**************************************************************************/
00283 void *pidgin_conversations_get_handle(void);
00284 
00288 void pidgin_conversations_init(void);
00289 
00293 void pidgin_conversations_uninit(void);
00294 
00297 #endif /* _PIDGIN_CONVERSATION_H_ */