gtk/gtkconv.h

branch
gaim
changeset 20470
77693555855f
parent 12832
e5eb305a240d
parent 15416
2b1b922f804a
child 20471
1966704b3e42
equal deleted inserted replaced
13071:b98e72d4089a 20470:77693555855f
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_ALIAS_KEY_COLUMN,
48 CHAT_USERS_NAME_COLUMN,
49 CHAT_USERS_FLAGS_COLUMN,
50 CHAT_USERS_COLOR_COLUMN,
51 CHAT_USERS_WEIGHT_COLUMN,
52 CHAT_USERS_COLUMNS
53 };
54
55 #define GAIM_GTK_CONVERSATION(conv) \
56 ((GaimGtkConversation *)(conv)->ui_data)
57
58 #define GAIM_IS_GTK_CONVERSATION(conv) \
59 (gaim_conversation_get_ui_ops(conv) == \
60 gaim_gtk_conversations_get_conv_ui_ops())
61
62 #include "gtkgaim.h"
63 #include "conversation.h"
64 #include "gtkconvwin.h"
65
66 /**************************************************************************
67 * @name Structures
68 **************************************************************************/
69 /*@{*/
70
71 /**
72 * A GTK+ representation of a graphical window containing one or more
73 * conversations.
74 */
75
76 /**
77 * A GTK+ Instant Message pane.
78 */
79 struct _GaimGtkImPane
80 {
81 GtkWidget *block;
82 GtkWidget *send_file;
83 GtkWidget *sep1;
84 GtkWidget *sep2;
85 GtkWidget *check;
86 GtkWidget *progress;
87
88 /* Buddy icon stuff */
89 GtkWidget *icon_container;
90 GtkWidget *icon;
91 gboolean show_icon;
92 gboolean animate;
93 GdkPixbufAnimation *anim;
94 GdkPixbufAnimationIter *iter;
95 guint32 icon_timer;
96 };
97
98 /**
99 * GTK+ Chat panes.
100 */
101 struct _GaimGtkChatPane
102 {
103 GtkWidget *count;
104 GtkWidget *list;
105 GtkWidget *topic_text;
106 };
107
108 /**
109 * A GTK+ conversation pane.
110 */
111 struct _GaimGtkConversation
112 {
113 GaimConversation *active_conv;
114 GList *convs;
115 GList *send_history;
116
117 GaimGtkWindow *win;
118
119 gboolean make_sound;
120
121 GtkTooltips *tooltips;
122
123 GtkWidget *tab_cont;
124 GtkWidget *tabby;
125 GtkWidget *menu_tabby;
126
127 GtkWidget *imhtml;
128 GtkTextBuffer *entry_buffer;
129 GtkWidget *entry;
130 gboolean auto_resize; /* this is set to TRUE if the conversation
131 * is being resized by a non-user-initiated
132 * event, such as the buddy icon appearing
133 */
134 gboolean entry_growing; /* True if the size of the entry was set
135 * automatically by typing too much to fit
136 * in one line */
137
138 GtkWidget *close; /* "x" on the tab */
139 GtkWidget *icon;
140 GtkWidget *tab_label;
141 GtkWidget *menu_icon;
142 GtkWidget *menu_label;
143 GtkSizeGroup *sg;
144
145 GtkWidget *lower_hbox;
146
147 GtkWidget *toolbar;
148
149 GaimUnseenState unseen_state;
150 guint unseen_count;
151
152 union
153 {
154 GaimGtkImPane *im;
155 GaimGtkChatPane *chat;
156
157 } u;
158 };
159
160 /*@}*/
161
162 /**************************************************************************
163 * @name GTK+ Conversation API
164 **************************************************************************/
165 /*@{*/
166
167 /**
168 * Returns the UI operations structure for GTK+ conversations.
169 *
170 * @return The GTK+ conversation operations structure.
171 */
172 GaimConversationUiOps *gaim_gtk_conversations_get_conv_ui_ops(void);
173
174 /**
175 * Updates the buddy icon on a conversation.
176 *
177 * @param conv The conversation.
178 */
179 void gaim_gtkconv_update_buddy_icon(GaimConversation *conv);
180
181 /**
182 * Sets the active conversation within a GTK-conversation.
183 *
184 * @param conv The conversation
185 */
186 void gaim_gtkconv_switch_active_conversation(GaimConversation *conv);
187
188 /**
189 * Updates conversation buttons by protocol.
190 *
191 * @param conv The conversation.
192 */
193 void gaim_gtkconv_update_buttons_by_protocol(GaimConversation *conv);
194
195 /**
196 * Returns a list of conversations of the given type which have an unseen
197 * state greater than or equal to the specified minimum state. Using the
198 * hidden_only parameter, this search can be limited to hidden
199 * conversations. The max_count parameter will limit the total number of
200 * converations returned if greater than zero. The returned list should
201 * be freed by the caller.
202 *
203 * @param type The type of conversation.
204 * @param min_state The minimum unseen state.
205 * @param hidden_only If TRUE, only consider hidden conversations.
206 * @param max_count Maximum number of conversations to return, or 0 for
207 * no maximum.
208 * @return List of GaimConversation matching criteria, or NULL.
209 */
210 GList *
211 gaim_gtk_conversations_find_unseen_list(GaimConversationType type,
212 GaimUnseenState min_state,
213 gboolean hidden_only,
214 guint max_count);
215
216 /**
217 * Fill a menu with a list of conversations. Clicking the conversation
218 * menu item will present that conversation to the user.
219 *
220 * @param menu Menu widget to add items to.
221 * @param convs List of GaimConversation to add to menu.
222 * @return Number of conversations added to menu.
223 */
224 guint
225 gaim_gtk_conversations_fill_menu(GtkWidget *menu, GList *convs);
226
227 /**
228 * Presents a gaim conversation to the user.
229 *
230 * @param conv The conversation.
231 */
232 void gaim_gtkconv_present_conversation(GaimConversation *conv);
233
234 GaimGtkWindow *gaim_gtkconv_get_window(GaimGtkConversation *gtkconv);
235 GdkPixbuf *gaim_gtkconv_get_tab_icon(GaimConversation *conv, gboolean small_icon);
236 void gaim_gtkconv_new(GaimConversation *conv);
237 int gaim_gtkconv_get_tab_at_xy(GaimGtkWindow *win, int x, int y, gboolean *to_right);
238 gboolean gaim_gtkconv_is_hidden(GaimGtkConversation *gtkconv);
239 /*@}*/
240
241 /**************************************************************************/
242 /** @name GTK+ Conversations Subsystem */
243 /**************************************************************************/
244 /*@{*/
245
246 /**
247 * Returns the gtk conversations subsystem handle.
248 *
249 * @return The conversations subsystem handle.
250 */
251 void *gaim_gtk_conversations_get_handle(void);
252
253 /**
254 * Initializes the GTK+ conversations subsystem.
255 */
256 void gaim_gtk_conversations_init(void);
257
258 /**
259 * Uninitialized the GTK+ conversation subsystem.
260 */
261 void gaim_gtk_conversations_uninit(void);
262
263 /*@}*/
264
265 #endif /* _GAIM_GTKCONVERSATION_H_ */

mercurial