pidgin/gtkconv.h

branch
cpw.khc.msnp14
changeset 20478
46933dc62880
parent 20472
6a6d2ef151e6
parent 15931
716b5fac1895
child 20481
65485e2ed8a3
equal deleted inserted replaced
20476:198222e01a7d 20478:46933dc62880
1 /**
2 * @file gtkconv.h GTK+ Conversation API
3 * @ingroup gtkui
4 *
5 * pidgin
6 *
7 * Pidgin 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 _PIDGIN_CONVERSATION_H_
26 #define _PIDGIN_CONVERSATION_H_
27
28 typedef struct _PidginImPane PidginImPane;
29 typedef struct _PidginChatPane PidginChatPane;
30 typedef struct _PidginConversation PidginConversation;
31
32 /**
33 * Unseen text states.
34 */
35 typedef enum
36 {
37 PIDGIN_UNSEEN_NONE, /**< No unseen text in the conversation. */
38 PIDGIN_UNSEEN_EVENT, /**< Unseen events in the conversation. */
39 PIDGIN_UNSEEN_NO_LOG, /**< Unseen text with NO_LOG flag. */
40 PIDGIN_UNSEEN_TEXT, /**< Unseen text in the conversation. */
41 PIDGIN_UNSEEN_NICK /**< Unseen text and the nick was said. */
42 } PidginUnseenState;
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 PIDGIN_CONVERSATION(conv) \
56 ((PidginConversation *)(conv)->ui_data)
57
58 #define PIDGIN_IS_PIDGIN_CONVERSATION(conv) \
59 (purple_conversation_get_ui_ops(conv) == \
60 pidgin_conversations_get_conv_ui_ops())
61
62 #include "pidgin.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 _PidginImPane
80 {
81 GtkWidget *block;
82 GtkWidget *send_file;
83 GtkWidget *sep1;
84 GtkWidget *sep2;
85 GtkWidget *check;
86 GtkWidget *progress;
87 guint32 typing_timer;
88
89 /* Buddy icon stuff */
90 GtkWidget *icon_container;
91 GtkWidget *icon;
92 gboolean show_icon;
93 gboolean animate;
94 GdkPixbufAnimation *anim;
95 GdkPixbufAnimationIter *iter;
96 guint32 icon_timer;
97 };
98
99 /**
100 * GTK+ Chat panes.
101 */
102 struct _PidginChatPane
103 {
104 GtkWidget *count;
105 GtkWidget *list;
106 GtkWidget *topic_text;
107 };
108
109 /**
110 * A GTK+ conversation pane.
111 */
112 struct _PidginConversation
113 {
114 PurpleConversation *active_conv;
115 GList *convs;
116 GList *send_history;
117
118 PidginWindow *win;
119
120 gboolean make_sound;
121
122 GtkTooltips *tooltips;
123
124 GtkWidget *tab_cont;
125 GtkWidget *tabby;
126 GtkWidget *menu_tabby;
127
128 GtkWidget *imhtml;
129 GtkTextBuffer *entry_buffer;
130 GtkWidget *entry;
131 gboolean auto_resize; /* this is set to TRUE if the conversation
132 * is being resized by a non-user-initiated
133 * event, such as the buddy icon appearing
134 */
135 gboolean entry_growing; /* True if the size of the entry was set
136 * automatically by typing too much to fit
137 * in one line */
138
139 GtkWidget *close; /* "x" on the tab */
140 GtkWidget *icon;
141 GtkWidget *tab_label;
142 GtkWidget *menu_icon;
143 GtkWidget *menu_label;
144 GtkSizeGroup *sg;
145
146 GtkWidget *lower_hbox;
147
148 GtkWidget *toolbar;
149
150 PidginUnseenState unseen_state;
151 guint unseen_count;
152
153 union
154 {
155 PidginImPane *im;
156 PidginChatPane *chat;
157
158 } u;
159
160 time_t newday;
161 };
162
163 /*@}*/
164
165 /**************************************************************************
166 * @name GTK+ Conversation API
167 **************************************************************************/
168 /*@{*/
169
170 /**
171 * Returns the UI operations structure for GTK+ conversations.
172 *
173 * @return The GTK+ conversation operations structure.
174 */
175 PurpleConversationUiOps *pidgin_conversations_get_conv_ui_ops(void);
176
177 /**
178 * Updates the buddy icon on a conversation.
179 *
180 * @param conv The conversation.
181 */
182 void pidgin_conv_update_buddy_icon(PurpleConversation *conv);
183
184 /**
185 * Sets the active conversation within a GTK-conversation.
186 *
187 * @param conv The conversation
188 */
189 void pidgin_conv_switch_active_conversation(PurpleConversation *conv);
190
191 /**
192 * Updates conversation buttons by protocol.
193 *
194 * @param conv The conversation.
195 */
196 void pidgin_conv_update_buttons_by_protocol(PurpleConversation *conv);
197
198 /**
199 * Returns a list of conversations of the given type which have an unseen
200 * state greater than or equal to the specified minimum state. Using the
201 * hidden_only parameter, this search can be limited to hidden
202 * conversations. The max_count parameter will limit the total number of
203 * converations returned if greater than zero. The returned list should
204 * be freed by the caller.
205 *
206 * @param type The type of conversation.
207 * @param min_state The minimum unseen state.
208 * @param hidden_only If TRUE, only consider hidden conversations.
209 * @param max_count Maximum number of conversations to return, or 0 for
210 * no maximum.
211 * @return List of PurpleConversation matching criteria, or NULL.
212 */
213 GList *
214 pidgin_conversations_find_unseen_list(PurpleConversationType type,
215 PidginUnseenState min_state,
216 gboolean hidden_only,
217 guint max_count);
218
219 /**
220 * Fill a menu with a list of conversations. Clicking the conversation
221 * menu item will present that conversation to the user.
222 *
223 * @param menu Menu widget to add items to.
224 * @param convs List of PurpleConversation to add to menu.
225 * @return Number of conversations added to menu.
226 */
227 guint
228 pidgin_conversations_fill_menu(GtkWidget *menu, GList *convs);
229
230 /**
231 * Presents a purple conversation to the user.
232 *
233 * @param conv The conversation.
234 */
235 void pidgin_conv_present_conversation(PurpleConversation *conv);
236
237 PidginWindow *pidgin_conv_get_window(PidginConversation *gtkconv);
238 GdkPixbuf *pidgin_conv_get_tab_icon(PurpleConversation *conv, gboolean small_icon);
239 void pidgin_conv_new(PurpleConversation *conv);
240 int pidgin_conv_get_tab_at_xy(PidginWindow *win, int x, int y, gboolean *to_right);
241 gboolean pidgin_conv_is_hidden(PidginConversation *gtkconv);
242 /*@}*/
243
244 /**************************************************************************/
245 /** @name GTK+ Conversations Subsystem */
246 /**************************************************************************/
247 /*@{*/
248
249 /**
250 * Returns the gtk conversations subsystem handle.
251 *
252 * @return The conversations subsystem handle.
253 */
254 void *pidgin_conversations_get_handle(void);
255
256 /**
257 * Initializes the GTK+ conversations subsystem.
258 */
259 void pidgin_conversations_init(void);
260
261 /**
262 * Uninitialized the GTK+ conversation subsystem.
263 */
264 void pidgin_conversations_uninit(void);
265
266 /*@}*/
267
268 #endif /* _PIDGIN_CONVERSATION_H_ */

mercurial