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