Mon, 24 Feb 2003 00:29:54 +0000
[gaim-migrate @ 4896]
just because an account signs off doesn't mean we can forget about it ;-)
| 4359 | 1 | /** |
| 2 | * @file gtkconv.h GTK+ Conversation API | |
| 3 | * | |
| 4 | * gaim | |
| 5 | * | |
| 6 | * Copyright (C) 2002-2003, Christian Hammond <chipx86@gnupdate.org> | |
| 7 | * | |
| 8 | * This program is free software; you can redistribute it and/or modify | |
| 9 | * it under the terms of the GNU General Public License as published by | |
| 10 | * the Free Software Foundation; either version 2 of the License, or | |
| 11 | * (at your option) any later version. | |
| 12 | * | |
| 13 | * This program is distributed in the hope that it will be useful, | |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 | * GNU General Public License for more details. | |
| 17 | * | |
| 18 | * You should have received a copy of the GNU General Public License | |
| 19 | * along with this program; if not, write to the Free Software | |
| 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 21 | * | |
| 22 | */ | |
| 23 | ||
| 24 | #ifndef _GAIM_GTK_CONVERSATION_H_ | |
| 25 | #define _GAIM_GTK_CONVERSATION_H_ | |
| 26 | ||
| 27 | /************************************************************************** | |
| 28 | * @name Structures | |
| 29 | **************************************************************************/ | |
| 30 | ||
| 31 | struct gaim_gtk_window; | |
| 32 | struct gaim_gtk_conversation; | |
| 33 | struct gaim_gtk_im_pane; | |
| 34 | struct gaim_gtk_chat_pane; | |
| 35 | ||
| 36 | /** | |
| 37 | * A GTK+ representation of a graphical window containing one or more | |
| 38 | * conversations. | |
| 39 | */ | |
| 40 | struct gaim_gtk_window | |
| 41 | { | |
| 42 | GtkWidget *window; /**< The window. */ | |
| 43 | GtkWidget *notebook; /**< The notebook of conversations. */ | |
| 44 | ||
| 45 | struct | |
| 46 | { | |
| 47 | GtkWidget *menubar; | |
| 48 | ||
| 49 | GtkWidget *view_history; | |
| 50 | GtkWidget *insert_link; | |
| 51 | GtkWidget *insert_image; | |
| 52 | GtkWidget *logging; | |
| 53 | GtkWidget *sounds; | |
| 54 | GtkWidget *send_as; | |
| 55 | ||
| 56 | } menu; | |
| 57 | ||
| 58 | /* Tab dragging stuff. */ | |
| 59 | gboolean in_drag; | |
| 60 | gboolean in_predrag; | |
| 61 | ||
| 62 | gint drag_min_x, drag_max_x, drag_min_y, drag_max_y; | |
| 63 | ||
| 64 | gint drag_motion_signal; | |
| 65 | gint drag_leave_signal; | |
| 66 | }; | |
| 67 | ||
| 68 | /** | |
| 69 | * GTK+ Instant Message panes. | |
| 70 | */ | |
| 71 | struct gaim_gtk_im_pane | |
| 72 | { | |
| 73 | GtkWidget *warn; | |
| 74 | GtkWidget *block; | |
| 75 | GtkWidget *add; | |
| 76 | GtkWidget *sep1; | |
| 77 | GtkWidget *sep2; | |
| 78 | GtkWidget *check; | |
| 79 | GtkWidget *progress; | |
| 80 | ||
| 81 | gboolean a_virgin; | |
| 82 | ||
| 83 | /* Buddy icon stuff */ | |
| 84 | GtkWidget *icon; | |
| 85 | GdkPixbufAnimation *anim; | |
| 86 | GdkPixbufAnimationIter *iter; | |
| 87 | guint32 icon_timer; | |
| 88 | GtkWidget *save_icon; | |
| 89 | }; | |
| 90 | ||
| 91 | /** | |
| 92 | * GTK+ Chat panes. | |
| 93 | */ | |
| 94 | struct gaim_gtk_chat_pane | |
| 95 | { | |
| 96 | GtkWidget *count; | |
| 97 | GtkWidget *list; | |
| 98 | GtkWidget *whisper; | |
| 99 | GtkWidget *invite; | |
| 100 | GtkWidget *topic_text; | |
| 101 | }; | |
| 102 | ||
| 103 | /** | |
| 104 | * A GTK+ conversation pane. | |
| 105 | */ | |
| 106 | struct gaim_gtk_conversation | |
| 107 | { | |
| 108 | gboolean make_sound; | |
| 109 | gboolean has_font; | |
| 110 | char fontface[128]; | |
| 111 | GdkColor fg_color; | |
| 112 | GdkColor bg_color; | |
| 113 | ||
| 114 | GtkTooltips *tooltips; | |
| 115 | ||
| 116 | GtkWidget *tab_cont; | |
| 117 | GtkWidget *tabby; | |
| 118 | ||
| 119 | GtkWidget *imhtml; | |
| 120 | GtkTextBuffer *entry_buffer; | |
| 121 | GtkWidget *entry; | |
| 122 | ||
| 123 | GtkWidget *send; | |
| 124 | GtkWidget *info; | |
| 125 | GtkWidget *close; | |
| 126 | GtkWidget *tab_label; | |
| 127 | GtkSizeGroup *sg; | |
| 128 | ||
| 129 | GtkWidget *bbox; | |
| 130 | GtkWidget *sw; | |
| 131 | ||
| 132 | struct | |
| 133 | { | |
| 134 | GtkWidget *toolbar; | |
| 135 | ||
| 136 | GtkWidget *bold; | |
| 137 | GtkWidget *italic; | |
| 138 | GtkWidget *underline; | |
| 139 | ||
| 140 | GtkWidget *normal_size; | |
| 141 | ||
| 142 | GtkWidget *fgcolor; | |
| 143 | GtkWidget *bgcolor; | |
| 144 | ||
| 145 | GtkWidget *image; | |
| 146 | GtkWidget *link; | |
| 147 | GtkWidget *smiley; | |
| 148 | GtkWidget *log; | |
| 149 | ||
| 150 | } toolbar; | |
| 151 | ||
| 152 | struct | |
| 153 | { | |
| 154 | GtkWidget *fg_color; | |
| 155 | GtkWidget *bg_color; | |
| 156 | GtkWidget *font; | |
| 157 | GtkWidget *smiley; | |
| 158 | GtkWidget *link; | |
| 159 | GtkWidget *log; | |
| 160 | ||
| 161 | } dialogs; | |
| 162 | ||
| 163 | union | |
| 164 | { | |
| 165 | struct gaim_gtk_im_pane *im; | |
| 166 | struct gaim_gtk_chat_pane *chat; | |
| 167 | ||
| 168 | } u; | |
| 169 | }; | |
| 170 | ||
| 171 | #define GAIM_GTK_WINDOW(win) \ | |
| 172 | ((struct gaim_gtk_window *)(win)->ui_data) | |
| 173 | ||
| 174 | #define GAIM_GTK_CONVERSATION(conv) \ | |
| 175 | ((struct gaim_gtk_conversation *)(conv)->ui_data) | |
| 176 | ||
|
4384
32592d368209
[gaim-migrate @ 4650]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
177 | #define GAIM_IS_GTK_WINDOW(win) \ |
|
4465
43184ae252ed
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4445
diff
changeset
|
178 | (gaim_window_get_ui_ops(win) == gaim_get_gtk_window_ui_ops()) |
|
4384
32592d368209
[gaim-migrate @ 4650]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
179 | |
|
32592d368209
[gaim-migrate @ 4650]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
180 | #define GAIM_IS_GTK_CONVERSATION(conv) \ |
|
4465
43184ae252ed
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4445
diff
changeset
|
181 | (gaim_conversation_get_ui_ops(conv) == gaim_get_gtk_conversation_ui_ops()) |
| 4359 | 182 | |
| 183 | /************************************************************************** | |
| 184 | * @name GTK+ Conversation API | |
| 185 | **************************************************************************/ | |
| 186 | /** | |
| 187 | * Returns the UI operations structure for GTK windows. | |
| 188 | * | |
| 189 | * @return The GTK window operations structure. | |
| 190 | */ | |
|
4465
43184ae252ed
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4445
diff
changeset
|
191 | struct gaim_window_ui_ops *gaim_get_gtk_window_ui_ops(void); |
| 4359 | 192 | |
| 193 | /** | |
| 194 | * Returns the UI operations structure for GTK conversations. | |
| 195 | * | |
| 196 | * @return The GTK conversation operations structure. | |
| 197 | */ | |
|
4465
43184ae252ed
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4445
diff
changeset
|
198 | struct gaim_conversation_ui_ops *gaim_get_gtk_conversation_ui_ops(void); |
| 4359 | 199 | |
| 200 | /** | |
| 201 | * Sets a lock on the update state. | |
| 202 | * | |
| 203 | * @param lock The lock state. | |
| 204 | */ | |
| 205 | void gaim_gtk_set_state_lock(gboolean lock); | |
| 206 | ||
| 207 | /** | |
| 208 | * Returns the lock state. | |
| 209 | * | |
| 210 | * @return The lock state. | |
| 211 | */ | |
| 212 | gboolean gaim_gtk_is_state_locked(void); | |
| 213 | ||
| 214 | /** | |
| 215 | * Toggles the display of smileys. | |
| 216 | */ | |
| 217 | void gaim_gtkconv_toggle_smileys(void); | |
| 218 | ||
| 219 | /** | |
| 220 | * Toggles the display of timestamps. | |
| 221 | */ | |
| 222 | void gaim_gtkconv_toggle_timestamps(void); | |
| 223 | ||
| 224 | /** | |
| 225 | * Toggles spell checking. | |
| 226 | */ | |
| 227 | void gaim_gtkconv_toggle_spellchk(void); | |
| 228 | ||
| 229 | /** | |
| 4445 | 230 | * Toggles the presence of close buttons on tabs |
| 231 | */ | |
| 232 | void gaim_gtkconv_toggle_close_buttons(void); | |
| 233 | ||
| 234 | /** | |
| 4359 | 235 | * Updates the buddy icon on a conversation. |
| 236 | * | |
| 237 | * @param conv The conversation. | |
| 238 | */ | |
| 239 | void gaim_gtkconv_update_buddy_icon(struct gaim_conversation *conv); | |
| 240 | ||
| 241 | /** | |
| 242 | * Hides buddy icons on all conversations. | |
| 243 | */ | |
| 244 | void gaim_gtkconv_hide_buddy_icons(void); | |
| 245 | ||
| 246 | /** | |
| 247 | * Enables or disables animation on all conversations, based off | |
| 248 | * preferences. | |
| 249 | */ | |
| 250 | void gaim_gtkconv_set_anim(void); | |
| 251 | ||
| 252 | /** | |
| 253 | * Updates the font buttons on all conversations to reflect any changed | |
| 254 | * preferences. | |
| 255 | */ | |
| 256 | void gaim_gtkconv_update_font_buttons(void); | |
| 257 | ||
| 258 | /** | |
| 4421 | 259 | * Updates the font colors of each conversation to the new colors |
| 260 | * chosen in the prefs dialog. | |
|
4438
9beaf48335fc
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
261 | * |
|
9beaf48335fc
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
262 | * @param conv The conversation to update. |
| 4421 | 263 | */ |
| 264 | void gaim_gtkconv_update_font_colors(struct gaim_conversation *conv); | |
| 265 | ||
| 266 | /** | |
|
4438
9beaf48335fc
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
267 | * Updates the font faces of each conversation to the new font |
|
9beaf48335fc
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
268 | * face chosen in the prefs dialog. |
|
9beaf48335fc
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
269 | * |
|
9beaf48335fc
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
270 | * @param conv The conversation to update. |
|
9beaf48335fc
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
271 | */ |
|
9beaf48335fc
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
272 | void gaim_gtkconv_update_font_face(struct gaim_conversation *conv); |
|
9beaf48335fc
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
273 | |
|
9beaf48335fc
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
274 | /** |
| 4359 | 275 | * Updates the tab positions on all conversation windows to reflect any |
| 276 | * changed preferences. | |
| 277 | */ | |
| 278 | void gaim_gtkconv_update_tabs(void); | |
| 279 | ||
| 280 | /** | |
| 281 | * Updates the button style on chat windows to reflect any | |
| 282 | * changed preferences. | |
| 283 | */ | |
| 284 | void gaim_gtkconv_update_chat_button_style(); | |
| 285 | ||
| 286 | /** | |
| 287 | * Updates the button style on IM windows to reflect any | |
| 288 | * changed preferences. | |
| 289 | */ | |
| 290 | void gaim_gtkconv_update_im_button_style(); | |
| 291 | ||
| 292 | /** | |
| 293 | * Updates conversation buttons by protocol. | |
| 294 | * | |
| 295 | * @param conv The conversation. | |
| 296 | */ | |
| 297 | void gaim_gtkconv_update_buttons_by_protocol(struct gaim_conversation *conv); | |
| 298 | ||
| 299 | /** | |
| 300 | * Returns the window at the specified X, Y location. | |
| 301 | * | |
| 302 | * If the window is not a GTK+ window, @c NULL is returned. | |
| 303 | * | |
| 304 | * @param x The X coordinate. | |
| 305 | * @param y The Y coordinate. | |
| 306 | * | |
| 307 | * @return The GTK+ window at the location, if it exists, or @c NULL otherwise. | |
| 308 | */ | |
| 309 | struct gaim_window *gaim_gtkwin_get_at_xy(int x, int y); | |
| 310 | ||
| 311 | /** | |
| 312 | * Returns the index of the tab at the specified X, Y location in a notebook. | |
| 313 | * | |
| 314 | * @param win The GTK+ window containing the notebook. | |
| 315 | * @param x The X coordinate. | |
| 316 | * @param y The Y coordinate. | |
| 317 | * | |
| 318 | * @return The index of the tab at the location. | |
| 319 | */ | |
| 320 | int gaim_gtkconv_get_tab_at_xy(struct gaim_window *win, int x, int y); | |
| 321 | ||
| 322 | /** | |
| 323 | * Returns the index of the destination tab at the | |
| 324 | * specified X, Y location in a notebook. | |
| 325 | * | |
| 326 | * This is used for drag-and-drop functions when the tab at the index | |
| 327 | * is a destination tab. | |
| 328 | * | |
| 329 | * @param win The GTK+ window containing the notebook. | |
| 330 | * @param x The X coordinate. | |
| 331 | * @param y The Y coordinate. | |
| 332 | * | |
| 333 | * @return The index of the tab at the location. | |
| 334 | */ | |
| 335 | int gaim_gtkconv_get_dest_tab_at_xy(struct gaim_window *win, int x, int y); | |
| 336 | ||
| 337 | #endif /* _GAIM_GTK_CONVERSATION_H_ */ |