| 1 /** |
|
| 2 * @file gtkconv.h GTK+ Conversation API |
|
| 3 * @ingroup gtkui |
|
| 4 * |
|
| 5 * gaim |
|
| 6 * |
|
| 7 * Gaim is the legal property of its developers, whose names are too numerous |
|
| 8 * to list here. Please refer to the COPYRIGHT file distributed with this |
|
| 9 * source distribution. |
|
| 10 * |
|
| 11 * This program is free software; you can redistribute it and/or modify |
|
| 12 * it under the terms of the GNU General Public License as published by |
|
| 13 * the Free Software Foundation; either version 2 of the License, or |
|
| 14 * (at your option) any later version. |
|
| 15 * |
|
| 16 * This program is distributed in the hope that it will be useful, |
|
| 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 19 * GNU General Public License for more details. |
|
| 20 * |
|
| 21 * You should have received a copy of the GNU General Public License |
|
| 22 * along with this program; if not, write to the Free Software |
|
| 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
| 24 */ |
|
| 25 #ifndef _GAIM_GTKCONVERSATION_H_ |
|
| 26 #define _GAIM_GTKCONVERSATION_H_ |
|
| 27 |
|
| 28 typedef struct _GaimGtkImPane GaimGtkImPane; |
|
| 29 typedef struct _GaimGtkChatPane GaimGtkChatPane; |
|
| 30 typedef struct _GaimGtkConversation GaimGtkConversation; |
|
| 31 |
|
| 32 /** |
|
| 33 * Unseen text states. |
|
| 34 */ |
|
| 35 typedef enum |
|
| 36 { |
|
| 37 GAIM_UNSEEN_NONE, /**< No unseen text in the conversation. */ |
|
| 38 GAIM_UNSEEN_EVENT, /**< Unseen events in the conversation. */ |
|
| 39 GAIM_UNSEEN_NO_LOG, /**< Unseen text with NO_LOG flag. */ |
|
| 40 GAIM_UNSEEN_TEXT, /**< Unseen text in the conversation. */ |
|
| 41 GAIM_UNSEEN_NICK /**< Unseen text and the nick was said. */ |
|
| 42 } GaimUnseenState; |
|
| 43 |
|
| 44 enum { |
|
| 45 CHAT_USERS_ICON_COLUMN, |
|
| 46 CHAT_USERS_ALIAS_COLUMN, |
|
| 47 CHAT_USERS_NAME_COLUMN, |
|
| 48 CHAT_USERS_FLAGS_COLUMN, |
|
| 49 CHAT_USERS_COLOR_COLUMN, |
|
| 50 CHAT_USERS_BUDDY_COLUMN, |
|
| 51 CHAT_USERS_COLUMNS |
|
| 52 }; |
|
| 53 |
|
| 54 #define GAIM_GTK_CONVERSATION(conv) \ |
|
| 55 ((GaimGtkConversation *)(conv)->ui_data) |
|
| 56 |
|
| 57 #define GAIM_IS_GTK_CONVERSATION(conv) \ |
|
| 58 (gaim_conversation_get_ui_ops(conv) == \ |
|
| 59 gaim_gtk_conversations_get_conv_ui_ops()) |
|
| 60 |
|
| 61 #include "gtkgaim.h" |
|
| 62 #include "conversation.h" |
|
| 63 #include "gtkconvwin.h" |
|
| 64 |
|
| 65 /************************************************************************** |
|
| 66 * @name Structures |
|
| 67 **************************************************************************/ |
|
| 68 /*@{*/ |
|
| 69 |
|
| 70 /** |
|
| 71 * A GTK+ representation of a graphical window containing one or more |
|
| 72 * conversations. |
|
| 73 */ |
|
| 74 |
|
| 75 /** |
|
| 76 * A GTK+ Instant Message pane. |
|
| 77 */ |
|
| 78 struct _GaimGtkImPane |
|
| 79 { |
|
| 80 GtkWidget *block; |
|
| 81 GtkWidget *send_file; |
|
| 82 GtkWidget *sep1; |
|
| 83 GtkWidget *sep2; |
|
| 84 GtkWidget *check; |
|
| 85 GtkWidget *progress; |
|
| 86 |
|
| 87 /* Buddy icon stuff */ |
|
| 88 GtkWidget *icon_container; |
|
| 89 GtkWidget *icon; |
|
| 90 gboolean show_icon; |
|
| 91 gboolean animate; |
|
| 92 GdkPixbufAnimation *anim; |
|
| 93 GdkPixbufAnimationIter *iter; |
|
| 94 guint32 icon_timer; |
|
| 95 }; |
|
| 96 |
|
| 97 /** |
|
| 98 * GTK+ Chat panes. |
|
| 99 */ |
|
| 100 struct _GaimGtkChatPane |
|
| 101 { |
|
| 102 GtkWidget *count; |
|
| 103 GtkWidget *list; |
|
| 104 GtkWidget *topic_text; |
|
| 105 GtkWidget *userlist_im; |
|
| 106 GtkWidget *userlist_ignore; |
|
| 107 GtkWidget *userlist_info; |
|
| 108 }; |
|
| 109 |
|
| 110 /** |
|
| 111 * A GTK+ conversation pane. |
|
| 112 */ |
|
| 113 struct _GaimGtkConversation |
|
| 114 { |
|
| 115 GaimConversation *active_conv; |
|
| 116 GList *convs; |
|
| 117 |
|
| 118 GaimGtkWindow *win; |
|
| 119 |
|
| 120 gboolean make_sound; |
|
| 121 |
|
| 122 GtkTooltips *tooltips; |
|
| 123 |
|
| 124 GtkWidget *tab_cont; |
|
| 125 GtkWidget *tabby; |
|
| 126 GtkWidget *menu_tabby; |
|
| 127 |
|
| 128 GtkWidget *imhtml; |
|
| 129 GtkTextBuffer *entry_buffer; |
|
| 130 GtkWidget *entry; |
|
| 131 |
|
| 132 GtkWidget *close; /* "x" on the tab */ |
|
| 133 GtkWidget *icon; |
|
| 134 GtkWidget *tab_label; |
|
| 135 GtkWidget *menu_icon; |
|
| 136 GtkWidget *menu_label; |
|
| 137 GtkSizeGroup *sg; |
|
| 138 |
|
| 139 GtkWidget *lower_hbox; |
|
| 140 |
|
| 141 GtkWidget *toolbar; |
|
| 142 |
|
| 143 GaimUnseenState unseen_state; |
|
| 144 guint unseen_count; |
|
| 145 |
|
| 146 struct |
|
| 147 { |
|
| 148 GtkWidget *image; |
|
| 149 GtkWidget *search; |
|
| 150 |
|
| 151 } dialogs; |
|
| 152 |
|
| 153 union |
|
| 154 { |
|
| 155 GaimGtkImPane *im; |
|
| 156 GaimGtkChatPane *chat; |
|
| 157 |
|
| 158 } u; |
|
| 159 }; |
|
| 160 |
|
| 161 /*@}*/ |
|
| 162 |
|
| 163 /************************************************************************** |
|
| 164 * @name GTK+ Conversation API |
|
| 165 **************************************************************************/ |
|
| 166 /*@{*/ |
|
| 167 |
|
| 168 /** |
|
| 169 * Returns the UI operations structure for GTK+ conversations. |
|
| 170 * |
|
| 171 * @return The GTK+ conversation operations structure. |
|
| 172 */ |
|
| 173 GaimConversationUiOps *gaim_gtk_conversations_get_conv_ui_ops(void); |
|
| 174 |
|
| 175 /** |
|
| 176 * Updates the buddy icon on a conversation. |
|
| 177 * |
|
| 178 * @param conv The conversation. |
|
| 179 */ |
|
| 180 void gaim_gtkconv_update_buddy_icon(GaimConversation *conv); |
|
| 181 |
|
| 182 /** |
|
| 183 * Sets the active conversation within a GTK-conversation. |
|
| 184 * |
|
| 185 * @param conv The conversation |
|
| 186 */ |
|
| 187 void gaim_gtkconv_switch_active_conversation(GaimConversation *conv); |
|
| 188 |
|
| 189 /** |
|
| 190 * Updates the tab positions on all conversation windows to reflect any |
|
| 191 * changed preferences. |
|
| 192 */ |
|
| 193 void gaim_gtkconv_update_tabs(void); |
|
| 194 |
|
| 195 /** |
|
| 196 * Updates conversation buttons by protocol. |
|
| 197 * |
|
| 198 * @param conv The conversation. |
|
| 199 */ |
|
| 200 void gaim_gtkconv_update_buttons_by_protocol(GaimConversation *conv); |
|
| 201 |
|
| 202 /** |
|
| 203 * Returns a list of conversations of the given type which have an unseen |
|
| 204 * state greater than or equal to the specified minimum state. Using the |
|
| 205 * hidden_only parameter, this search can be limited to hidden |
|
| 206 * conversations. The max_count parameter will limit the total number of |
|
| 207 * converations returned if greater than zero. The returned list should |
|
| 208 * be freed by the caller. |
|
| 209 * |
|
| 210 * @param type The type of conversation. |
|
| 211 * @param min_state The minimum unseen state. |
|
| 212 * @param hidden_only If TRUE, only consider hidden conversations. |
|
| 213 * @param max_count Maximum number of conversations to return, or 0 for |
|
| 214 * no maximum. |
|
| 215 * @return List of GaimConversation matching criteria, or NULL. |
|
| 216 */ |
|
| 217 GList * |
|
| 218 gaim_gtk_conversations_find_unseen_list(GaimConversationType type, |
|
| 219 GaimUnseenState min_state, |
|
| 220 gboolean hidden_only, |
|
| 221 guint max_count); |
|
| 222 |
|
| 223 /** |
|
| 224 * Fill a menu with a list of conversations. Clicking the conversation |
|
| 225 * menu item will present that conversation to the user. |
|
| 226 * |
|
| 227 * @param menu Menu widget to add items to. |
|
| 228 * @param convs List of GaimConversation to add to menu. |
|
| 229 * @return Number of conversations added to menu. |
|
| 230 */ |
|
| 231 guint |
|
| 232 gaim_gtk_conversations_fill_menu(GtkWidget *menu, GList *convs); |
|
| 233 |
|
| 234 /** |
|
| 235 * Presents a gaim conversation to the user. |
|
| 236 * |
|
| 237 * @param conv The conversation. |
|
| 238 */ |
|
| 239 void gaim_gtkconv_present_conversation(GaimConversation *conv); |
|
| 240 |
|
| 241 GaimGtkWindow *gaim_gtkconv_get_window(GaimGtkConversation *gtkconv); |
|
| 242 GdkPixbuf *gaim_gtkconv_get_tab_icon(GaimConversation *conv, gboolean small_icon); |
|
| 243 void gaim_gtkconv_new(GaimConversation *conv); |
|
| 244 int gaim_gtkconv_get_tab_at_xy(GaimGtkWindow *win, int x, int y, gboolean *to_right); |
|
| 245 gboolean gaim_gtkconv_is_hidden(GaimGtkConversation *gtkconv); |
|
| 246 /*@}*/ |
|
| 247 |
|
| 248 /**************************************************************************/ |
|
| 249 /** @name GTK+ Conversations Subsystem */ |
|
| 250 /**************************************************************************/ |
|
| 251 /*@{*/ |
|
| 252 |
|
| 253 /** |
|
| 254 * Returns the gtk conversations subsystem handle. |
|
| 255 * |
|
| 256 * @return The conversations subsystem handle. |
|
| 257 */ |
|
| 258 void *gaim_gtk_conversations_get_handle(void); |
|
| 259 |
|
| 260 /** |
|
| 261 * Initializes the GTK+ conversations subsystem. |
|
| 262 */ |
|
| 263 void gaim_gtk_conversations_init(void); |
|
| 264 |
|
| 265 /** |
|
| 266 * Uninitialized the GTK+ conversation subsystem. |
|
| 267 */ |
|
| 268 void gaim_gtk_conversations_uninit(void); |
|
| 269 |
|
| 270 /*@}*/ |
|
| 271 |
|
| 272 #endif /* _GAIM_GTKCONVERSATION_H_ */ |
|