diff pidgin/gtkwebview.h @ 32450:0d50155445fd

Copy some editing functions from GtkIMHtml. These are incomplete. They are mostly just stubs that change private variables, but don't actually modify the WebView.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Wed, 04 Jan 2012 09:20:44 +0000
parents 8436fb68930e
children c5e5938bb89a
line wrap: on
line diff
--- a/pidgin/gtkwebview.h	Wed Jan 04 06:30:51 2012 +0000
+++ b/pidgin/gtkwebview.h	Wed Jan 04 09:20:44 2012 +0000
@@ -39,6 +39,26 @@
 #define GTK_IS_WEBVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_WEBVIEW))
 #define GTK_WEBVIEW_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_WEBVIEW, GtkWebViewClass))
 
+typedef enum {
+	GTK_WEBVIEW_BOLD          = 1 << 0,
+	GTK_WEBVIEW_ITALIC        = 1 << 1,
+	GTK_WEBVIEW_UNDERLINE     = 1 << 2,
+	GTK_WEBVIEW_GROW          = 1 << 3,
+	GTK_WEBVIEW_SHRINK        = 1 << 4,
+	GTK_WEBVIEW_FACE          = 1 << 5,
+	GTK_WEBVIEW_FORECOLOR     = 1 << 6,
+	GTK_WEBVIEW_BACKCOLOR     = 1 << 7,
+	GTK_WEBVIEW_BACKGROUND    = 1 << 8,
+	GTK_WEBVIEW_LINK          = 1 << 9,
+	GTK_WEBVIEW_IMAGE         = 1 << 10,
+	GTK_WEBVIEW_SMILEY        = 1 << 11,
+	GTK_WEBVIEW_LINKDESC      = 1 << 12,
+	GTK_WEBVIEW_STRIKE        = 1 << 13,
+	/** Show custom smileys when appropriate. */
+	GTK_WEBVIEW_CUSTOM_SMILEY = 1 << 14,
+	GTK_WEBVIEW_ALL           = -1
+} GtkWebViewButtons;
+
 typedef struct _GtkWebView GtkWebView;
 typedef struct _GtkWebViewClass GtkWebViewClass;
 
@@ -150,6 +170,218 @@
  */
 void gtk_webview_page_down(GtkWebView *webview);
 
+/**
+ * Enables or disables editing in a GtkWebView.
+ *
+ * @param webview  The GtkWebView
+ * @param editable @c TRUE to make the widget editable, or @c FALSE otherwise.
+ */
+void gtk_webview_set_editable(GtkWebView *webview, gboolean editable);
+
+/**
+ * Enables or disables whole buffer formatting only (wbfo) in a GtkWebView.
+ * In this mode formatting options to the buffer take effect for the entire
+ * buffer instead of specific text.
+ *
+ * @param webview The GtkWebView
+ * @param wbfo    @c TRUE to enable the mode, or @c FALSE otherwise.
+ */
+void gtk_webview_set_whole_buffer_formatting_only(GtkWebView *webview,
+                                                  gboolean wbfo);
+
+/**
+ * Indicates which formatting functions to enable and disable in a GtkWebView.
+ *
+ * @param webview The GtkWebView
+ * @param buttons A GtkWebViewButtons bitmask indicating which functions to use
+ */
+void gtk_webview_set_format_functions(GtkWebView *webview,
+                                      GtkWebViewButtons buttons);
+
+/**
+ * Returns which formatting functions are enabled in a GtkWebView.
+ *
+ * @param webview The GtkWebView
+ *
+ * @return A GtkWebViewButtons bitmask indicating which functions to are enabled
+ */
+GtkWebViewButtons gtk_webview_get_format_functions(GtkWebView *webview);
+
+/**
+ * Sets each boolean to @c TRUE or @c FALSE to indicate if that formatting
+ * option is enabled at the current position in a GtkWebView.
+ *
+ * @param webview       The GtkWebView
+ * @param bold          The boolean to set for bold or @c NULL.
+ * @param italic        The boolean to set for italic or @c NULL.
+ * @param underline     The boolean to set for underline or @c NULL.
+ * @param strikethrough The boolean to set for strikethrough or @c NULL.
+ */
+void gtk_webview_get_current_format(GtkWebView *webview, gboolean *bold,
+                                    gboolean *italic, gboolean *underline,
+                                    gboolean *strike);
+
+/**
+ * Returns a string containing the selected font face at the current position
+ * in a GtkWebView.
+ *
+ * @param webview The GtkWebView
+ *
+ * @return A string containing the font face or @c NULL if none is set.
+ */
+const char *gtk_webview_get_current_fontface(GtkWebView *webview);
+
+/**
+ * Returns a string containing the selected foreground color at the current
+ * position in a GtkWebView.
+ *
+ * @param webview The GtkWebView
+ *
+ * @return A string containing the foreground color or @c NULL if none is set.
+ */
+const char *gtk_webview_get_current_forecolor(GtkWebView *webview);
+
+/**
+ * Returns a string containing the selected font background color at the current
+ * position in a GtkWebView.
+ *
+ * @param webview The GtkWebView
+ *
+ * @return A string containing the background color or @c NULL if none is set.
+ */
+const char *gtk_webview_get_current_backcolor(GtkWebView *webview);
+
+/**
+ * Returns a string containing the selected background color at the current
+ * position in a GtkWebView.
+ *
+ * @param webview The GtkWebView
+ *
+ * @return A string containg the background color or @c NULL if none is set.
+ */
+const char *gtk_webview_get_current_background(GtkWebView *webview);
+
+/**
+ * Returns a integer containing the selected HTML font size at the current
+ * position in a GtkWebView.
+ *
+ * @param webview The GtkWebView
+ *
+ * @return The HTML font size.
+ */
+gint gtk_webview_get_current_fontsize(GtkWebView *webview);
+
+/**
+ * Checks whether a GtkWebView is marked as editable.
+ *
+ * @param webview The GtkWebView
+ *
+ * @return @c TRUE if the IM/HTML is editable, or @c FALSE otherwise.
+ */
+gboolean gtk_webview_get_editable(GtkWebView *webview);
+
+/**
+ * Clear all the formatting on a GtkWebView.
+ *
+ * @param webview The GtkWebView
+ */
+void gtk_webview_clear_formatting(GtkWebView *webview);
+
+/**
+ * Toggles bold at the cursor location or selection in a GtkWebView.
+ *
+ * @param webview The GtkWebView
+ */
+void gtk_webview_toggle_bold(GtkWebView *webview);
+
+/**
+ * Toggles italic at the cursor location or selection in a GtkWebView.
+ *
+ * @param webview The GtkWebView
+ */
+void gtk_webview_toggle_italic(GtkWebView *webview);
+
+/**
+ * Toggles underline at the cursor location or selection in a GtkWebView.
+ *
+ * @param webview The GtkWebView
+ */
+void gtk_webview_toggle_underline(GtkWebView *webview);
+
+/**
+ * Toggles strikethrough at the cursor location or selection in a GtkWebView.
+ *
+ * @param webview The GtkWebView
+ */
+void gtk_webview_toggle_strike(GtkWebView *webview);
+
+/**
+ * Toggles a foreground color at the current location or selection in a
+ * GtkWebView.
+ *
+ * @param webview The GtkWebView
+ * @param color  The HTML-style color, or @c NULL or "" to clear the color.
+ *
+ * @return @c TRUE if a color was set, or @c FALSE if it was cleared.
+ */
+gboolean gtk_webview_toggle_forecolor(GtkWebView *webview, const char *color);
+
+/**
+ * Toggles a background color at the current location or selection in a
+ * GtkWebView.
+ *
+ * @param webview The GtkWebView
+ * @param color  The HTML-style color, or @c NULL or "" to clear the color.
+ *
+ * @return @c TRUE if a color was set, or @c FALSE if it was cleared.
+ */
+gboolean gtk_webview_toggle_backcolor(GtkWebView *webview, const char *color);
+
+/**
+ * Toggles a background color at the current location or selection in a 
+ * GtkWebView.
+ *
+ * @param webview The GtkWebView
+ * @param color  The HTML-style color, or @c NULL or "" to clear the color.
+ *
+ * @return @c TRUE if a color was set, or @c FALSE if it was cleared.
+ */
+gboolean gtk_webview_toggle_background(GtkWebView *webview, const char *color);
+
+/**
+ * Toggles a font face at the current location or selection in a GtkWebView.
+ *
+ * @param webview The GtkWebView
+ * @param face   The font face name, or @c NULL or "" to clear the font.
+ *
+ * @return @c TRUE if a font name was set, or @c FALSE if it was cleared.
+ */
+gboolean gtk_webview_toggle_fontface(GtkWebView *webview, const char *face);
+
+/**
+ * Sets the font size at the current location or selection in a GtkWebView.
+ *
+ * @param webview The GtkWebView
+ * @param size   The HTML font size to use.
+ */
+void gtk_webview_font_set_size(GtkWebView *webview, gint size);
+
+/**
+ * Decreases the font size by 1 at the current location or selection in a
+ * GtkWebView.
+ *
+ * @param webview The GtkWebView
+ */
+void gtk_webview_font_shrink(GtkWebView *webview);
+
+/**
+ * Increases the font size by 1 at the current location or selection in a
+ * GtkWebView.
+ *
+ * @param webview The GtkWebView
+ */
+void gtk_webview_font_grow(GtkWebView *webview);
+
 G_END_DECLS
 
 #endif /* _PIDGIN_WEBVIEW_H_ */