pidgin/gtkimhtml.h

branch
imhtml.customlinks
changeset 24698
f9dd7117ade0
parent 24674
36bf974a7d78
child 25007
ef8bc1f4a6ba
equal deleted inserted replaced
24697:0e771f0ae1c5 24698:f9dd7117ade0
58 typedef struct _GtkIMHtmlScalable GtkIMHtmlScalable; 58 typedef struct _GtkIMHtmlScalable GtkIMHtmlScalable;
59 typedef struct _GtkIMHtmlImage GtkIMHtmlImage; 59 typedef struct _GtkIMHtmlImage GtkIMHtmlImage;
60 typedef struct _GtkIMHtmlAnimation GtkIMHtmlAnimation; 60 typedef struct _GtkIMHtmlAnimation GtkIMHtmlAnimation;
61 typedef struct _GtkIMHtmlHr GtkIMHtmlHr; 61 typedef struct _GtkIMHtmlHr GtkIMHtmlHr;
62 typedef struct _GtkIMHtmlFuncs GtkIMHtmlFuncs; 62 typedef struct _GtkIMHtmlFuncs GtkIMHtmlFuncs;
63 typedef struct _GtkIMHtmlLink GtkIMHtmlLink;
63 64
64 typedef enum { 65 typedef enum {
65 GTK_IMHTML_BOLD = 1 << 0, 66 GTK_IMHTML_BOLD = 1 << 0,
66 GTK_IMHTML_ITALIC = 1 << 1, 67 GTK_IMHTML_ITALIC = 1 << 1,
67 GTK_IMHTML_UNDERLINE = 1 << 2, 68 GTK_IMHTML_UNDERLINE = 1 << 2,
886 * @since 2.5.0 887 * @since 2.5.0
887 */ 888 */
888 void gtk_imhtml_smiley_destroy(GtkIMHtmlSmiley *smiley); 889 void gtk_imhtml_smiley_destroy(GtkIMHtmlSmiley *smiley);
889 890
890 /** 891 /**
891 * Register a protocol with the GtkIMHtml widget. Registering a protocol would allow 892 * Register a protocol with the GtkIMHtml widget. Registering a protocol would
892 * certain text to be clickable. 893 * allow certain text to be clickable.
893 * 894 *
894 * @param name The name of the protocol (e.g. http://) 895 * @param name The name of the protocol (e.g. http://)
895 * @param activate The callback to trigger when the protocol text is clicked. 896 * @param activate The callback to trigger when the protocol text is clicked.
896 * Removes any current protocol definition if @c NULL. 897 * Removes any current protocol definition if @c NULL. The
897 * @param context_menu The callback totrigger when the context menu is popped up on 898 * callback should return @c TRUE if the link was activated
898 * the protocol text. 899 * properly, @c FALSE otherwise.
900 * @param context_menu The callback to trigger when the context menu is popped
901 * up on the protocol text. The callback should return
902 * @c TRUE if the request for context menu was processed
903 * successfully, @c FALSE otherwise.
899 * 904 *
900 * @return @c TRUE if the protocol was successfully registered (or unregistered, when #activate is @c NULL) 905 * @return @c TRUE if the protocol was successfully registered (or unregistered, when #activate is @c NULL)
901 * @since 2.6.0 906 * @since 2.6.0
902 */ 907 */
903 gboolean gtk_imhtml_class_register_protocol(const char *name, 908 gboolean gtk_imhtml_class_register_protocol(const char *name,
904 gboolean (*activate)(GtkIMHtml *imhtml, const char *text), 909 gboolean (*activate)(GtkIMHtml *imhtml, GtkIMHtmlLink *link),
905 gboolean (*context_menu)(GtkIMHtml *imhtml, const char *text, GtkWidget *menu)); 910 gboolean (*context_menu)(GtkIMHtml *imhtml, GtkIMHtmlLink *link, GtkWidget *menu));
911
912 /**
913 * Get the URL associated with a link. This should be used by the IMHtml protocol-callbacks.
914 *
915 * @param link The GtkIMHtmlLink object sent to the callback functions
916 *
917 * @return The URL
918 * @since 2.6.0
919 */
920 const char *gtk_imhtml_link_get_url(GtkIMHtmlLink *link);
921
922 /**
923 * Get the GtkTextTag object (if any) associated with a particular link.
924 *
925 * @param link The GtkIMHtmlLink object sent to the callback functions
926 *
927 * @return The GtkTextTag object, or @c NULL
928 * @since 2.6.0
929 */
930 const GtkTextTag * gtk_imhtml_link_get_text_tag(GtkIMHtmlLink *link);
931
932 /**
933 * Activates a GtkIMHtmlLink object. This triggers the 'url-clicked' signal, marks the
934 * link as visited (when possible).
935 *
936 * @param link The GtkIMHtmlLink object sent to the callback functions
937 *
938 * @return @c TRUE if 'url-clicked' signal was emitted, @c FALSE otherwise.
939 * @since 2.6.0
940 */
941 gboolean gtk_imhtml_link_activate(GtkIMHtmlLink *link);
942
906 /*@}*/ 943 /*@}*/
907 944
908 #ifdef __cplusplus 945 #ifdef __cplusplus
909 } 946 }
910 #endif 947 #endif

mercurial