I guess I'll release this later today. Is that ok with everyone?
[pidgin-git.git] / pidgin / gtkconv.h
bloba952e73b81aad1fb84e321652208f6b4ce4d4299
1 /**
2 * @file gtkconv.h GTK+ Conversation API
3 * @ingroup pidgin
4 * @see @ref gtkconv-signals
5 */
7 /* pidgin
9 * Pidgin is the legal property of its developers, whose names are too numerous
10 * to list here. Please refer to the COPYRIGHT file distributed with this
11 * source distribution.
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
27 #ifndef _PIDGIN_CONVERSATION_H_
28 #define _PIDGIN_CONVERSATION_H_
30 typedef struct _PidginImPane PidginImPane;
31 typedef struct _PidginChatPane PidginChatPane;
32 typedef struct _PidginConversation PidginConversation;
34 /**
35 * Unseen text states.
37 typedef enum
39 PIDGIN_UNSEEN_NONE, /**< No unseen text in the conversation. */
40 PIDGIN_UNSEEN_EVENT, /**< Unseen events in the conversation. */
41 PIDGIN_UNSEEN_NO_LOG, /**< Unseen text with NO_LOG flag. */
42 PIDGIN_UNSEEN_TEXT, /**< Unseen text in the conversation. */
43 PIDGIN_UNSEEN_NICK /**< Unseen text and the nick was said. */
44 } PidginUnseenState;
46 enum {
47 CHAT_USERS_ICON_COLUMN,
48 CHAT_USERS_ALIAS_COLUMN,
49 CHAT_USERS_ALIAS_KEY_COLUMN,
50 CHAT_USERS_NAME_COLUMN,
51 CHAT_USERS_FLAGS_COLUMN,
52 CHAT_USERS_COLOR_COLUMN,
53 CHAT_USERS_WEIGHT_COLUMN,
54 CHAT_USERS_ICON_STOCK_COLUMN, /** @since 2.6.0 */
55 CHAT_USERS_COLUMNS
58 #define PIDGIN_CONVERSATION(conv) \
59 ((PidginConversation *)(conv)->ui_data)
61 #define PIDGIN_IS_PIDGIN_CONVERSATION(conv) \
62 (purple_conversation_get_ui_ops(conv) == \
63 pidgin_conversations_get_conv_ui_ops())
65 #include "pidgin.h"
66 #include "conversation.h"
67 #include "gtkconvwin.h"
69 /**************************************************************************
70 * @name Structures
71 **************************************************************************/
72 /*@{*/
74 /**
75 * A GTK+ representation of a graphical window containing one or more
76 * conversations.
79 /**
80 * A GTK+ Instant Message pane.
82 struct _PidginImPane
84 GtkWidget *block;
85 GtkWidget *send_file;
86 GtkWidget *sep1;
87 GtkWidget *sep2;
88 GtkWidget *check;
89 GtkWidget *progress;
90 guint32 typing_timer;
92 /* Buddy icon stuff */
93 GtkWidget *icon_container;
94 GtkWidget *icon;
95 gboolean show_icon;
96 gboolean animate;
97 GdkPixbufAnimation *anim;
98 GdkPixbufAnimationIter *iter;
99 guint32 icon_timer;
103 * GTK+ Chat panes.
105 struct _PidginChatPane
107 GtkWidget *count;
108 GtkWidget *list;
109 GtkWidget *topic_text;
113 * A GTK+ conversation pane.
115 struct _PidginConversation
117 PurpleConversation *active_conv;
118 GList *convs;
119 GList *send_history;
121 PidginWindow *win;
123 gboolean make_sound;
125 GtkTooltips *tooltips;
127 GtkWidget *tab_cont;
128 GtkWidget *tabby;
129 GtkWidget *menu_tabby;
131 GtkWidget *imhtml;
132 GtkTextBuffer *entry_buffer;
133 GtkWidget *entry;
134 gboolean auto_resize; /* this is set to TRUE if the conversation
135 * is being resized by a non-user-initiated
136 * event, such as the buddy icon appearing
138 gboolean entry_growing; /* True if the size of the entry was set
139 * automatically by typing too much to fit
140 * in one line */
142 GtkWidget *close; /* "x" on the tab */
143 GtkWidget *icon;
144 GtkWidget *tab_label;
145 GtkWidget *menu_icon;
146 GtkWidget *menu_label;
147 #if !(defined PIDGIN_DISABLE_DEPRECATED) || (defined _PIDGIN_GTKCONV_C_)
148 /** @deprecated */
149 GtkSizeGroup *sg;
150 #else
151 gpointer depr1;
152 #endif
154 GtkWidget *lower_hbox;
156 GtkWidget *toolbar;
158 PidginUnseenState unseen_state;
159 guint unseen_count;
161 union
163 PidginImPane *im;
164 PidginChatPane *chat;
166 } u;
168 time_t newday;
169 GtkWidget *infopane_hbox;
170 GtkWidget *infopane;
171 GtkListStore *infopane_model;
172 GtkTreeIter infopane_iter;
174 /* Used when attaching a PidginConversation to a PurpleConversation
175 * with message history */
176 struct {
177 int timer;
178 GList *current;
179 } attach;
182 * Quick Find.
184 * @since 2.7.0
186 struct {
187 GtkWidget *entry;
188 GtkWidget *container;
189 } quickfind;
192 /*@}*/
194 /**************************************************************************
195 * @name GTK+ Conversation API
196 **************************************************************************/
197 /*@{*/
200 * Returns the UI operations structure for GTK+ conversations.
202 * @return The GTK+ conversation operations structure.
204 PurpleConversationUiOps *pidgin_conversations_get_conv_ui_ops(void);
207 * Updates the buddy icon on a conversation.
209 * @param conv The conversation.
211 void pidgin_conv_update_buddy_icon(PurpleConversation *conv);
214 * Sets the active conversation within a GTK-conversation.
216 * @param conv The conversation
218 void pidgin_conv_switch_active_conversation(PurpleConversation *conv);
221 * Updates conversation buttons by protocol.
223 * @param conv The conversation.
225 void pidgin_conv_update_buttons_by_protocol(PurpleConversation *conv);
228 * Returns a list of conversations of the given type which have an unseen
229 * state greater than or equal to the specified minimum state. Using the
230 * hidden_only parameter, this search can be limited to hidden
231 * conversations. The max_count parameter will limit the total number of
232 * converations returned if greater than zero. The returned list should
233 * be freed by the caller.
235 * @param type The type of conversation.
236 * @param min_state The minimum unseen state.
237 * @param hidden_only If TRUE, only consider hidden conversations.
238 * @param max_count Maximum number of conversations to return, or 0 for
239 * no maximum.
240 * @return List of PurpleConversation matching criteria, or NULL.
242 GList *
243 pidgin_conversations_find_unseen_list(PurpleConversationType type,
244 PidginUnseenState min_state,
245 gboolean hidden_only,
246 guint max_count);
249 * Fill a menu with a list of conversations. Clicking the conversation
250 * menu item will present that conversation to the user.
252 * @param menu Menu widget to add items to.
253 * @param convs List of PurpleConversation to add to menu.
254 * @return Number of conversations added to menu.
256 guint
257 pidgin_conversations_fill_menu(GtkWidget *menu, GList *convs);
260 * Presents a purple conversation to the user.
262 * @param conv The conversation.
264 void pidgin_conv_present_conversation(PurpleConversation *conv);
267 * Reattach Pidgin UI to a conversation.
269 * @param conv The conversation.
271 * @return Wheter Pidgin UI was successfully attached.
273 * @since 2.2.0
275 gboolean pidgin_conv_attach_to_conversation(PurpleConversation *conv);
277 PidginWindow *pidgin_conv_get_window(PidginConversation *gtkconv);
278 GdkPixbuf *pidgin_conv_get_tab_icon(PurpleConversation *conv, gboolean small_icon);
279 void pidgin_conv_new(PurpleConversation *conv);
280 int pidgin_conv_get_tab_at_xy(PidginWindow *win, int x, int y, gboolean *to_right);
281 gboolean pidgin_conv_is_hidden(PidginConversation *gtkconv);
282 /*@}*/
284 /**************************************************************************/
285 /** @name GTK+ Conversations Subsystem */
286 /**************************************************************************/
287 /*@{*/
290 * Returns the gtk conversations subsystem handle.
292 * @return The conversations subsystem handle.
294 void *pidgin_conversations_get_handle(void);
297 * Initializes the GTK+ conversations subsystem.
299 void pidgin_conversations_init(void);
302 * Uninitialized the GTK+ conversation subsystem.
304 void pidgin_conversations_uninit(void);
306 /*@}*/
308 #endif /* _PIDGIN_CONVERSATION_H_ */