diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gtkconv.h	Mon Jan 20 09:10:23 2003 +0000
@@ -0,0 +1,313 @@
+/**
+ * @file gtkconv.h GTK+ Conversation API
+ *
+ * gaim
+ *
+ * Copyright (C) 2002-2003, Christian Hammond <chipx86@gnupdate.org>
+ * 
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+#ifndef _GAIM_GTK_CONVERSATION_H_
+#define _GAIM_GTK_CONVERSATION_H_
+
+/**************************************************************************
+ * @name Structures
+ **************************************************************************/
+
+struct gaim_gtk_window;
+struct gaim_gtk_conversation;
+struct gaim_gtk_im_pane;
+struct gaim_gtk_chat_pane;
+
+/**
+ * A GTK+ representation of a graphical window containing one or more
+ * conversations.
+ */
+struct gaim_gtk_window
+{
+	GtkWidget *window;           /**< The window.                      */
+	GtkWidget *notebook;         /**< The notebook of conversations.   */
+
+	struct
+	{
+		GtkWidget *menubar;
+
+		GtkWidget *view_history;
+		GtkWidget *insert_link;
+		GtkWidget *insert_image;
+		GtkWidget *logging;
+		GtkWidget *sounds;
+		GtkWidget *send_as;
+
+	} menu;
+
+	/* Tab dragging stuff. */
+	gboolean in_drag;
+	gboolean in_predrag;
+
+	gint drag_min_x, drag_max_x, drag_min_y, drag_max_y;
+
+	gint drag_motion_signal;
+	gint drag_leave_signal;
+};
+
+/**
+ * GTK+ Instant Message panes.
+ */
+struct gaim_gtk_im_pane
+{
+	GtkWidget *warn;
+	GtkWidget *block;
+	GtkWidget *add;
+	GtkWidget *sep1;
+	GtkWidget *sep2;
+	GtkWidget *check;
+	GtkWidget *progress;
+
+	gboolean a_virgin;
+
+	/* Buddy icon stuff */
+	GtkWidget *icon;
+	GdkPixbufAnimation *anim;
+	GdkPixbufAnimationIter *iter;
+	guint32 icon_timer;
+	GtkWidget *save_icon;
+};
+
+/**
+ * GTK+ Chat panes.
+ */
+struct gaim_gtk_chat_pane
+{
+	GtkWidget *count;
+	GtkWidget *list;
+	GtkWidget *whisper;
+	GtkWidget *invite;
+	GtkWidget *topic_text;
+};
+
+/**
+ * A GTK+ conversation pane.
+ */
+struct gaim_gtk_conversation
+{
+	gboolean make_sound;
+	gboolean has_font;
+	gboolean has_fg;
+	gboolean has_bg;
+	char fontface[128];
+	GdkColor fg_color;
+	GdkColor bg_color;
+
+	GtkTooltips *tooltips;
+
+	GtkWidget *tab_cont;
+	GtkWidget *tabby;
+
+	GtkWidget *imhtml;
+	GtkTextBuffer *entry_buffer;
+	GtkWidget *entry;
+
+	GtkWidget *send;
+	GtkWidget *info;
+	GtkWidget *close;
+	GtkWidget *tab_label;
+	GtkSizeGroup *sg;
+
+	GtkWidget *bbox;
+	GtkWidget *sw;
+
+	struct
+	{
+		GtkWidget *toolbar;
+		
+		GtkWidget *bold;
+		GtkWidget *italic;
+		GtkWidget *underline;
+
+		GtkWidget *normal_size;
+
+		GtkWidget *fgcolor;
+		GtkWidget *bgcolor;
+
+		GtkWidget *image;
+		GtkWidget *link;
+		GtkWidget *smiley;
+		GtkWidget *log;
+	
+	} toolbar;
+
+	struct
+	{
+		GtkWidget *fg_color;
+		GtkWidget *bg_color;
+		GtkWidget *font;
+		GtkWidget *smiley;
+		GtkWidget *link;
+		GtkWidget *log;
+
+	} dialogs;
+
+	union
+	{
+		struct gaim_gtk_im_pane   *im;
+		struct gaim_gtk_chat_pane *chat;
+
+	} u;
+};
+
+#define GAIM_GTK_WINDOW(win) \
+	((struct gaim_gtk_window *)(win)->ui_data)
+
+#define GAIM_GTK_CONVERSATION(conv) \
+	((struct gaim_gtk_conversation *)(conv)->ui_data)
+
+
+/**************************************************************************
+ * @name GTK+ Conversation API
+ **************************************************************************/
+/**
+ * Returns the UI operations structure for GTK windows.
+ *
+ * @return The GTK window operations structure.
+ */
+struct gaim_window_ops *gaim_get_gtk_window_ops(void);
+
+/**
+ * Returns the UI operations structure for GTK conversations.
+ *
+ * @return The GTK conversation operations structure.
+ */
+struct gaim_conversation_ops *gaim_get_gtk_conversation_ops(void);
+
+/**
+ * Sets a lock on the update state.
+ *
+ * @param lock The lock state.
+ */
+void gaim_gtk_set_state_lock(gboolean lock);
+
+/**
+ * Returns the lock state.
+ *
+ * @return The lock state.
+ */
+gboolean gaim_gtk_is_state_locked(void);
+
+/**
+ * Toggles the display of smileys.
+ */
+void gaim_gtkconv_toggle_smileys(void);
+
+/**
+ * Toggles the display of timestamps.
+ */
+void gaim_gtkconv_toggle_timestamps(void);
+
+/**
+ * Toggles spell checking.
+ */
+void gaim_gtkconv_toggle_spellchk(void);
+
+/**
+ * Updates the buddy icon on a conversation.
+ *
+ * @param conv The conversation.
+ */
+void gaim_gtkconv_update_buddy_icon(struct gaim_conversation *conv);
+
+/**
+ * Hides buddy icons on all conversations.
+ */
+void gaim_gtkconv_hide_buddy_icons(void);
+
+/**
+ * Enables or disables animation on all conversations, based off
+ * preferences.
+ */
+void gaim_gtkconv_set_anim(void);
+
+/**
+ * Updates the font buttons on all conversations to reflect any changed
+ * preferences.
+ */
+void gaim_gtkconv_update_font_buttons(void);
+
+/**
+ * Updates the tab positions on all conversation windows to reflect any
+ * changed preferences.
+ */
+void gaim_gtkconv_update_tabs(void);
+
+/**
+ * Updates the button style on chat windows to reflect any
+ * changed preferences.
+ */
+void gaim_gtkconv_update_chat_button_style();
+
+/**
+ * Updates the button style on IM windows to reflect any
+ * changed preferences.
+ */
+void gaim_gtkconv_update_im_button_style();
+
+/**
+ * Updates conversation buttons by protocol.
+ *
+ * @param conv The conversation.
+ */
+void gaim_gtkconv_update_buttons_by_protocol(struct gaim_conversation *conv);
+
+/**
+ * Returns the window at the specified X, Y location.
+ *
+ * If the window is not a GTK+ window, @c NULL is returned.
+ *
+ * @param x The X coordinate.
+ * @param y The Y coordinate.
+ *
+ * @return The GTK+ window at the location, if it exists, or @c NULL otherwise.
+ */
+struct gaim_window *gaim_gtkwin_get_at_xy(int x, int y);
+
+/**
+ * Returns the index of the tab at the specified X, Y location in a notebook.
+ *
+ * @param win The GTK+ window containing the notebook.
+ * @param x   The X coordinate.
+ * @param y   The Y coordinate.
+ *
+ * @return The index of the tab at the location.
+ */
+int gaim_gtkconv_get_tab_at_xy(struct gaim_window *win, int x, int y);
+
+/**
+ * Returns the index of the destination tab at the
+ * specified X, Y location in a notebook.
+ *
+ * This is used for drag-and-drop functions when the tab at the index
+ * is a destination tab.
+ *
+ * @param win The GTK+ window containing the notebook.
+ * @param x   The X coordinate.
+ * @param y   The Y coordinate.
+ *
+ * @return The index of the tab at the location.
+ */
+int gaim_gtkconv_get_dest_tab_at_xy(struct gaim_window *win, int x, int y);
+
+#endif /* _GAIM_GTK_CONVERSATION_H_ */