Mon, 10 Mar 2003 05:54:25 +0000
[gaim-migrate @ 5000]
create_prpl_icon()'s API changed. Fixed.
Also, added the beginnings of drag-and-dorp support. It's broken. It does
nothing. Enjoy. Make me toast.
| 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 | ||
| 4630 | 56 | GtkItemFactory *item_factory; |
| 57 | ||
| 4359 | 58 | } menu; |
| 59 | ||
| 60 | /* Tab dragging stuff. */ | |
| 61 | gboolean in_drag; | |
| 62 | gboolean in_predrag; | |
| 63 | ||
| 64 | gint drag_min_x, drag_max_x, drag_min_y, drag_max_y; | |
| 65 | ||
| 66 | gint drag_motion_signal; | |
| 67 | gint drag_leave_signal; | |
| 68 | }; | |
| 69 | ||
| 70 | /** | |
| 71 | * GTK+ Instant Message panes. | |
| 72 | */ | |
| 73 | struct gaim_gtk_im_pane | |
| 74 | { | |
| 75 | GtkWidget *warn; | |
| 76 | GtkWidget *block; | |
| 77 | GtkWidget *add; | |
| 78 | GtkWidget *sep1; | |
| 79 | GtkWidget *sep2; | |
| 80 | GtkWidget *check; | |
| 81 | GtkWidget *progress; | |
| 82 | ||
| 83 | gboolean a_virgin; | |
| 84 | ||
| 85 | /* Buddy icon stuff */ | |
| 86 | GtkWidget *icon; | |
| 87 | GdkPixbufAnimation *anim; | |
| 88 | GdkPixbufAnimationIter *iter; | |
| 89 | guint32 icon_timer; | |
| 90 | GtkWidget *save_icon; | |
| 91 | }; | |
| 92 | ||
| 93 | /** | |
| 94 | * GTK+ Chat panes. | |
| 95 | */ | |
| 96 | struct gaim_gtk_chat_pane | |
| 97 | { | |
| 98 | GtkWidget *count; | |
| 99 | GtkWidget *list; | |
| 100 | GtkWidget *whisper; | |
| 101 | GtkWidget *invite; | |
| 102 | GtkWidget *topic_text; | |
| 103 | }; | |
| 104 | ||
| 105 | /** | |
| 106 | * A GTK+ conversation pane. | |
| 107 | */ | |
| 108 | struct gaim_gtk_conversation | |
| 109 | { | |
| 110 | gboolean make_sound; | |
| 111 | gboolean has_font; | |
| 112 | char fontface[128]; | |
| 113 | GdkColor fg_color; | |
| 114 | GdkColor bg_color; | |
| 115 | ||
| 116 | GtkTooltips *tooltips; | |
| 117 | ||
| 118 | GtkWidget *tab_cont; | |
| 119 | GtkWidget *tabby; | |
| 120 | ||
| 121 | GtkWidget *imhtml; | |
| 122 | GtkTextBuffer *entry_buffer; | |
| 123 | GtkWidget *entry; | |
| 124 | ||
| 125 | GtkWidget *send; | |
| 126 | GtkWidget *info; | |
| 127 | GtkWidget *close; | |
| 128 | GtkWidget *tab_label; | |
| 129 | GtkSizeGroup *sg; | |
| 130 | ||
| 131 | GtkWidget *bbox; | |
| 132 | GtkWidget *sw; | |
| 133 | ||
| 134 | struct | |
| 135 | { | |
| 136 | GtkWidget *toolbar; | |
| 4685 | 137 | |
| 4359 | 138 | GtkWidget *bold; |
| 139 | GtkWidget *italic; | |
| 140 | GtkWidget *underline; | |
| 141 | ||
| 142 | GtkWidget *normal_size; | |
| 143 | ||
| 4685 | 144 | GtkWidget *font; |
| 4359 | 145 | GtkWidget *fgcolor; |
| 146 | GtkWidget *bgcolor; | |
| 147 | ||
| 148 | GtkWidget *image; | |
| 149 | GtkWidget *link; | |
| 150 | GtkWidget *smiley; | |
| 151 | GtkWidget *log; | |
| 4685 | 152 | |
| 4359 | 153 | } toolbar; |
| 154 | ||
| 155 | struct | |
| 156 | { | |
| 157 | GtkWidget *fg_color; | |
| 158 | GtkWidget *bg_color; | |
| 159 | GtkWidget *font; | |
| 160 | GtkWidget *smiley; | |
| 161 | GtkWidget *link; | |
| 162 | GtkWidget *log; | |
| 163 | ||
| 164 | } dialogs; | |
| 165 | ||
| 166 | union | |
| 167 | { | |
| 168 | struct gaim_gtk_im_pane *im; | |
| 169 | struct gaim_gtk_chat_pane *chat; | |
| 170 | ||
| 171 | } u; | |
| 172 | }; | |
| 173 | ||
| 174 | #define GAIM_GTK_WINDOW(win) \ | |
| 175 | ((struct gaim_gtk_window *)(win)->ui_data) | |
| 176 | ||
| 177 | #define GAIM_GTK_CONVERSATION(conv) \ | |
| 178 | ((struct gaim_gtk_conversation *)(conv)->ui_data) | |
| 179 | ||
|
4384
32592d368209
[gaim-migrate @ 4650]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
180 | #define GAIM_IS_GTK_WINDOW(win) \ |
|
4465
43184ae252ed
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4445
diff
changeset
|
181 | (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
|
182 | |
|
32592d368209
[gaim-migrate @ 4650]
Christian Hammond <chipx86@chipx86.com>
parents:
4359
diff
changeset
|
183 | #define GAIM_IS_GTK_CONVERSATION(conv) \ |
|
4465
43184ae252ed
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4445
diff
changeset
|
184 | (gaim_conversation_get_ui_ops(conv) == gaim_get_gtk_conversation_ui_ops()) |
| 4359 | 185 | |
| 186 | /************************************************************************** | |
| 187 | * @name GTK+ Conversation API | |
| 188 | **************************************************************************/ | |
| 189 | /** | |
| 190 | * Returns the UI operations structure for GTK windows. | |
| 191 | * | |
| 192 | * @return The GTK window operations structure. | |
| 193 | */ | |
|
4465
43184ae252ed
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4445
diff
changeset
|
194 | struct gaim_window_ui_ops *gaim_get_gtk_window_ui_ops(void); |
| 4359 | 195 | |
| 196 | /** | |
| 197 | * Returns the UI operations structure for GTK conversations. | |
| 198 | * | |
| 199 | * @return The GTK conversation operations structure. | |
| 200 | */ | |
|
4465
43184ae252ed
[gaim-migrate @ 4740]
Christian Hammond <chipx86@chipx86.com>
parents:
4445
diff
changeset
|
201 | struct gaim_conversation_ui_ops *gaim_get_gtk_conversation_ui_ops(void); |
| 4359 | 202 | |
| 203 | /** | |
| 204 | * Toggles the display of smileys. | |
| 205 | */ | |
| 206 | void gaim_gtkconv_toggle_smileys(void); | |
| 207 | ||
| 208 | /** | |
| 209 | * Toggles the display of timestamps. | |
| 210 | */ | |
| 211 | void gaim_gtkconv_toggle_timestamps(void); | |
| 212 | ||
| 213 | /** | |
| 214 | * Toggles spell checking. | |
| 215 | */ | |
| 216 | void gaim_gtkconv_toggle_spellchk(void); | |
| 217 | ||
| 218 | /** | |
| 4445 | 219 | * Toggles the presence of close buttons on tabs |
| 220 | */ | |
| 221 | void gaim_gtkconv_toggle_close_buttons(void); | |
| 222 | ||
| 223 | /** | |
| 4359 | 224 | * Updates the buddy icon on a conversation. |
| 225 | * | |
| 226 | * @param conv The conversation. | |
| 227 | */ | |
| 228 | void gaim_gtkconv_update_buddy_icon(struct gaim_conversation *conv); | |
| 229 | ||
| 230 | /** | |
| 231 | * Hides buddy icons on all conversations. | |
| 232 | */ | |
| 233 | void gaim_gtkconv_hide_buddy_icons(void); | |
| 234 | ||
| 235 | /** | |
| 236 | * Enables or disables animation on all conversations, based off | |
| 237 | * preferences. | |
| 238 | */ | |
| 239 | void gaim_gtkconv_set_anim(void); | |
| 240 | ||
| 241 | /** | |
| 242 | * Updates the font buttons on all conversations to reflect any changed | |
| 243 | * preferences. | |
| 244 | */ | |
| 245 | void gaim_gtkconv_update_font_buttons(void); | |
| 246 | ||
| 247 | /** | |
| 4421 | 248 | * Updates the font colors of each conversation to the new colors |
| 249 | * chosen in the prefs dialog. | |
|
4438
9beaf48335fc
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
250 | * |
|
9beaf48335fc
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
251 | * @param conv The conversation to update. |
| 4421 | 252 | */ |
| 253 | void gaim_gtkconv_update_font_colors(struct gaim_conversation *conv); | |
| 254 | ||
| 255 | /** | |
|
4438
9beaf48335fc
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
256 | * Updates the font faces of each conversation to the new font |
|
9beaf48335fc
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
257 | * face chosen in the prefs dialog. |
|
9beaf48335fc
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
258 | * |
|
9beaf48335fc
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
259 | * @param conv The conversation to update. |
|
9beaf48335fc
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
260 | */ |
|
9beaf48335fc
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
261 | void gaim_gtkconv_update_font_face(struct gaim_conversation *conv); |
|
9beaf48335fc
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
262 | |
|
9beaf48335fc
[gaim-migrate @ 4713]
Christian Hammond <chipx86@chipx86.com>
parents:
4421
diff
changeset
|
263 | /** |
| 4359 | 264 | * Updates the tab positions on all conversation windows to reflect any |
| 265 | * changed preferences. | |
| 266 | */ | |
| 267 | void gaim_gtkconv_update_tabs(void); | |
| 268 | ||
| 269 | /** | |
| 270 | * Updates the button style on chat windows to reflect any | |
| 271 | * changed preferences. | |
| 272 | */ | |
| 273 | void gaim_gtkconv_update_chat_button_style(); | |
| 274 | ||
| 275 | /** | |
| 276 | * Updates the button style on IM windows to reflect any | |
| 277 | * changed preferences. | |
| 278 | */ | |
| 279 | void gaim_gtkconv_update_im_button_style(); | |
| 280 | ||
| 281 | /** | |
| 282 | * Updates conversation buttons by protocol. | |
| 283 | * | |
| 284 | * @param conv The conversation. | |
| 285 | */ | |
| 286 | void gaim_gtkconv_update_buttons_by_protocol(struct gaim_conversation *conv); | |
| 287 | ||
| 288 | /** | |
| 289 | * Returns the window at the specified X, Y location. | |
| 290 | * | |
| 291 | * If the window is not a GTK+ window, @c NULL is returned. | |
| 292 | * | |
| 293 | * @param x The X coordinate. | |
| 294 | * @param y The Y coordinate. | |
| 295 | * | |
| 296 | * @return The GTK+ window at the location, if it exists, or @c NULL otherwise. | |
| 297 | */ | |
| 298 | struct gaim_window *gaim_gtkwin_get_at_xy(int x, int y); | |
| 299 | ||
| 300 | /** | |
| 301 | * Returns the index of the tab at the specified X, Y location in a notebook. | |
| 302 | * | |
| 303 | * @param win The GTK+ window containing the notebook. | |
| 304 | * @param x The X coordinate. | |
| 305 | * @param y The Y coordinate. | |
| 306 | * | |
| 307 | * @return The index of the tab at the location. | |
| 308 | */ | |
| 309 | int gaim_gtkconv_get_tab_at_xy(struct gaim_window *win, int x, int y); | |
| 310 | ||
| 311 | /** | |
| 312 | * Returns the index of the destination tab at the | |
| 313 | * specified X, Y location in a notebook. | |
| 314 | * | |
| 315 | * This is used for drag-and-drop functions when the tab at the index | |
| 316 | * is a destination tab. | |
| 317 | * | |
| 318 | * @param win The GTK+ window containing the notebook. | |
| 319 | * @param x The X coordinate. | |
| 320 | * @param y The Y coordinate. | |
| 321 | * | |
| 322 | * @return The index of the tab at the location. | |
| 323 | */ | |
| 324 | int gaim_gtkconv_get_dest_tab_at_xy(struct gaim_window *win, int x, int y); | |
| 325 | ||
| 326 | #endif /* _GAIM_GTK_CONVERSATION_H_ */ |