comparison src/gtkconv.h @ 4359:5fb47ec9bfe4

[gaim-migrate @ 4625] Wow, okay, where to begin with this one ;) I rewrote the whole conversation backend. It is now core/UI split. Here's how it works.. Every conversation is represented by a gaim_conversation structure. This branches out into gaim_im and gaim_chat structures. Every conversation lives in (well, normally, but it doesn't have to) a gaim_window structure. This is a _CORE_ representation of a window. There can be multiple gaim_window structures around. The gaim_window and gaim_conversation structures have UI-specific operation structures associated with them. At the moment, the only UI is GTK+, and this will be for some time. Don't start thinking you can write a QT UI now. It's just not going to happen. Everything that is done on a conversation is done through the core API. This API does core processing and then calls the UI operations for the rendering and anything else. Now, what does this give the user? - Multiple windows. - Multiple tabs per window. - Draggable tabs. - Send As menu is moved to the menubar. - Menubar for chats. - Some very cool stuff in the future, like replacing, say, IRC chat windows with an X-Chat interface, or whatever. - Later on, customizable window/conversation positioning. For developers: - Fully documented API - Core/UI split - Variable checking and mostly sane handling of incorrect variables. - Logical structure to conversations, both core and UI. - Some very cool stuff in the future, like replacing, say, IRC chat windows with an X-Chat interface, or whatever. - Later on, customizable window/conversation positioning. - Oh yeah, and the beginning of a stock icon system. Now, there are things that aren't there yet. You will see tabs even if you have them turned off. This will be fixed in time. Also, the preferences will change to work with the new structure. I'm starting school in 2 days, so it may not be done immediately, but hopefully in the next week. Enjoy! committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Mon, 20 Jan 2003 09:10:23 +0000
parents
children 8f633419c837
comparison
equal deleted inserted replaced
4358:2b8abf7f9cc1 4359:5fb47ec9bfe4
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 gboolean has_fg;
111 gboolean has_bg;
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;
137
138 GtkWidget *bold;
139 GtkWidget *italic;
140 GtkWidget *underline;
141
142 GtkWidget *normal_size;
143
144 GtkWidget *fgcolor;
145 GtkWidget *bgcolor;
146
147 GtkWidget *image;
148 GtkWidget *link;
149 GtkWidget *smiley;
150 GtkWidget *log;
151
152 } toolbar;
153
154 struct
155 {
156 GtkWidget *fg_color;
157 GtkWidget *bg_color;
158 GtkWidget *font;
159 GtkWidget *smiley;
160 GtkWidget *link;
161 GtkWidget *log;
162
163 } dialogs;
164
165 union
166 {
167 struct gaim_gtk_im_pane *im;
168 struct gaim_gtk_chat_pane *chat;
169
170 } u;
171 };
172
173 #define GAIM_GTK_WINDOW(win) \
174 ((struct gaim_gtk_window *)(win)->ui_data)
175
176 #define GAIM_GTK_CONVERSATION(conv) \
177 ((struct gaim_gtk_conversation *)(conv)->ui_data)
178
179
180 /**************************************************************************
181 * @name GTK+ Conversation API
182 **************************************************************************/
183 /**
184 * Returns the UI operations structure for GTK windows.
185 *
186 * @return The GTK window operations structure.
187 */
188 struct gaim_window_ops *gaim_get_gtk_window_ops(void);
189
190 /**
191 * Returns the UI operations structure for GTK conversations.
192 *
193 * @return The GTK conversation operations structure.
194 */
195 struct gaim_conversation_ops *gaim_get_gtk_conversation_ops(void);
196
197 /**
198 * Sets a lock on the update state.
199 *
200 * @param lock The lock state.
201 */
202 void gaim_gtk_set_state_lock(gboolean lock);
203
204 /**
205 * Returns the lock state.
206 *
207 * @return The lock state.
208 */
209 gboolean gaim_gtk_is_state_locked(void);
210
211 /**
212 * Toggles the display of smileys.
213 */
214 void gaim_gtkconv_toggle_smileys(void);
215
216 /**
217 * Toggles the display of timestamps.
218 */
219 void gaim_gtkconv_toggle_timestamps(void);
220
221 /**
222 * Toggles spell checking.
223 */
224 void gaim_gtkconv_toggle_spellchk(void);
225
226 /**
227 * Updates the buddy icon on a conversation.
228 *
229 * @param conv The conversation.
230 */
231 void gaim_gtkconv_update_buddy_icon(struct gaim_conversation *conv);
232
233 /**
234 * Hides buddy icons on all conversations.
235 */
236 void gaim_gtkconv_hide_buddy_icons(void);
237
238 /**
239 * Enables or disables animation on all conversations, based off
240 * preferences.
241 */
242 void gaim_gtkconv_set_anim(void);
243
244 /**
245 * Updates the font buttons on all conversations to reflect any changed
246 * preferences.
247 */
248 void gaim_gtkconv_update_font_buttons(void);
249
250 /**
251 * Updates the tab positions on all conversation windows to reflect any
252 * changed preferences.
253 */
254 void gaim_gtkconv_update_tabs(void);
255
256 /**
257 * Updates the button style on chat windows to reflect any
258 * changed preferences.
259 */
260 void gaim_gtkconv_update_chat_button_style();
261
262 /**
263 * Updates the button style on IM windows to reflect any
264 * changed preferences.
265 */
266 void gaim_gtkconv_update_im_button_style();
267
268 /**
269 * Updates conversation buttons by protocol.
270 *
271 * @param conv The conversation.
272 */
273 void gaim_gtkconv_update_buttons_by_protocol(struct gaim_conversation *conv);
274
275 /**
276 * Returns the window at the specified X, Y location.
277 *
278 * If the window is not a GTK+ window, @c NULL is returned.
279 *
280 * @param x The X coordinate.
281 * @param y The Y coordinate.
282 *
283 * @return The GTK+ window at the location, if it exists, or @c NULL otherwise.
284 */
285 struct gaim_window *gaim_gtkwin_get_at_xy(int x, int y);
286
287 /**
288 * Returns the index of the tab at the specified X, Y location in a notebook.
289 *
290 * @param win The GTK+ window containing the notebook.
291 * @param x The X coordinate.
292 * @param y The Y coordinate.
293 *
294 * @return The index of the tab at the location.
295 */
296 int gaim_gtkconv_get_tab_at_xy(struct gaim_window *win, int x, int y);
297
298 /**
299 * Returns the index of the destination tab at the
300 * specified X, Y location in a notebook.
301 *
302 * This is used for drag-and-drop functions when the tab at the index
303 * is a destination tab.
304 *
305 * @param win The GTK+ window containing the notebook.
306 * @param x The X coordinate.
307 * @param y The Y coordinate.
308 *
309 * @return The index of the tab at the location.
310 */
311 int gaim_gtkconv_get_dest_tab_at_xy(struct gaim_window *win, int x, int y);
312
313 #endif /* _GAIM_GTK_CONVERSATION_H_ */