pidgin/gtkimhtml.h

changeset 18545
5af898e91ec2
parent 18151
97fd60f47229
child 19859
71d37b57eff2
equal deleted inserted replaced
17398:1edf059a4a26 18545:5af898e91ec2
25 25
26 #include <gdk/gdk.h> 26 #include <gdk/gdk.h>
27 #include <gtk/gtktextview.h> 27 #include <gtk/gtktextview.h>
28 #include <gtk/gtktooltips.h> 28 #include <gtk/gtktooltips.h>
29 #include <gtk/gtkimage.h> 29 #include <gtk/gtkimage.h>
30 #include "gtksourceundomanager.h"
31
32 #include "connection.h"
30 33
31 #ifdef __cplusplus 34 #ifdef __cplusplus
32 extern "C" { 35 extern "C" {
33 #endif 36 #endif
34 37
41 #define GTK_IMHTML(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_IMHTML, GtkIMHtml)) 44 #define GTK_IMHTML(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_IMHTML, GtkIMHtml))
42 #define GTK_IMHTML_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_IMHTML, GtkIMHtmlClass)) 45 #define GTK_IMHTML_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_IMHTML, GtkIMHtmlClass))
43 #define GTK_IS_IMHTML(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_IMHTML)) 46 #define GTK_IS_IMHTML(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_IMHTML))
44 #define GTK_IS_IMHTML_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_IMHTML)) 47 #define GTK_IS_IMHTML_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_IMHTML))
45 #define GTK_IMHTML_SCALABLE(obj) ((GtkIMHtmlScalable *)obj) 48 #define GTK_IMHTML_SCALABLE(obj) ((GtkIMHtmlScalable *)obj)
49 #define GTK_IMHTML_ANIMATION(obj) ((GtkIMHtmlAnimation *)obj)
46 50
47 typedef struct _GtkIMHtml GtkIMHtml; 51 typedef struct _GtkIMHtml GtkIMHtml;
48 typedef struct _GtkIMHtmlClass GtkIMHtmlClass; 52 typedef struct _GtkIMHtmlClass GtkIMHtmlClass;
49 typedef struct _GtkIMHtmlFontDetail GtkIMHtmlFontDetail; /* The five elements contained in a FONT tag */ 53 typedef struct _GtkIMHtmlFontDetail GtkIMHtmlFontDetail; /* The five elements contained in a FONT tag */
50 typedef struct _GtkSmileyTree GtkSmileyTree; 54 typedef struct _GtkSmileyTree GtkSmileyTree;
51 typedef struct _GtkIMHtmlSmiley GtkIMHtmlSmiley; 55 typedef struct _GtkIMHtmlSmiley GtkIMHtmlSmiley;
52 typedef struct _GtkIMHtmlScalable GtkIMHtmlScalable; 56 typedef struct _GtkIMHtmlScalable GtkIMHtmlScalable;
53 typedef struct _GtkIMHtmlImage GtkIMHtmlImage; 57 typedef struct _GtkIMHtmlImage GtkIMHtmlImage;
58 typedef struct _GtkIMHtmlAnimation GtkIMHtmlAnimation;
54 typedef struct _GtkIMHtmlHr GtkIMHtmlHr; 59 typedef struct _GtkIMHtmlHr GtkIMHtmlHr;
55 typedef struct _GtkIMHtmlFuncs GtkIMHtmlFuncs; 60 typedef struct _GtkIMHtmlFuncs GtkIMHtmlFuncs;
56 61
57 typedef enum { 62 typedef enum {
58 GTK_IMHTML_BOLD = 1 << 0, 63 GTK_IMHTML_BOLD = 1 << 0,
124 char *clipboard_text_string; 129 char *clipboard_text_string;
125 char *clipboard_html_string; 130 char *clipboard_html_string;
126 131
127 GSList *im_images; 132 GSList *im_images;
128 GtkIMHtmlFuncs *funcs; 133 GtkIMHtmlFuncs *funcs;
134 GtkSourceUndoManager *undo_manager;
129 }; 135 };
130 136
131 struct _GtkIMHtmlClass { 137 struct _GtkIMHtmlClass {
132 GtkTextViewClass parent_class; 138 GtkTextViewClass parent_class;
133 139
135 void (*buttons_update)(GtkIMHtml *, GtkIMHtmlButtons); 141 void (*buttons_update)(GtkIMHtml *, GtkIMHtmlButtons);
136 void (*toggle_format)(GtkIMHtml *, GtkIMHtmlButtons); 142 void (*toggle_format)(GtkIMHtml *, GtkIMHtmlButtons);
137 void (*clear_format)(GtkIMHtml *); 143 void (*clear_format)(GtkIMHtml *);
138 void (*update_format)(GtkIMHtml *); 144 void (*update_format)(GtkIMHtml *);
139 gboolean (*message_send)(GtkIMHtml *); 145 gboolean (*message_send)(GtkIMHtml *);
146 void (*undo)(GtkIMHtml *);
147 void (*redo)(GtkIMHtml *);
140 }; 148 };
141 149
142 struct _GtkIMHtmlFontDetail { 150 struct _GtkIMHtmlFontDetail {
143 gushort size; 151 gushort size;
144 gchar *face; 152 gchar *face;
173 void (*free)(struct _GtkIMHtmlScalable *); 181 void (*free)(struct _GtkIMHtmlScalable *);
174 }; 182 };
175 183
176 struct _GtkIMHtmlImage { 184 struct _GtkIMHtmlImage {
177 GtkIMHtmlScalable scalable; 185 GtkIMHtmlScalable scalable;
178 GtkImage *image; 186 GtkImage *image; /**< Contains the scaled version of this pixbuf. */
179 GdkPixbuf *pixbuf; 187 GdkPixbuf *pixbuf; /**< The original pixbuf, before any scaling. */
180 GtkTextMark *mark; 188 GtkTextMark *mark;
181 gchar *filename; 189 gchar *filename;
182 int width; 190 int width;
183 int height; 191 int height;
184 int id; 192 int id;
185 GtkWidget *filesel; 193 GtkWidget *filesel;
194 };
195
196 struct _GtkIMHtmlAnimation {
197 GtkIMHtmlImage imhtmlimage;
198 GdkPixbufAnimation *anim; /**< The original animation, before any scaling. */
199 GdkPixbufAnimationIter *iter;
200 guint timer;
186 }; 201 };
187 202
188 struct _GtkIMHtmlHr { 203 struct _GtkIMHtmlHr {
189 GtkIMHtmlScalable scalable; 204 GtkIMHtmlScalable scalable;
190 GtkWidget *sep; 205 GtkWidget *sep;
403 * @return A new IM/HTML Scalable object. 418 * @return A new IM/HTML Scalable object.
404 */ 419 */
405 GtkIMHtmlScalable *gtk_imhtml_scalable_new(void); 420 GtkIMHtmlScalable *gtk_imhtml_scalable_new(void);
406 421
407 /** 422 /**
408 * Creates and returns an new GTK+ IM/HTML scalable object with an image. 423 * Creates and returns a new GTK+ IM/HTML scalable object with an image.
409 * 424 *
410 * @param img A GdkPixbuf of the image to add. 425 * @param img A GdkPixbuf of the image to add.
411 * @param filename The filename to associate with the image. 426 * @param filename The filename to associate with the image.
412 * @param id The id to associate with the image. 427 * @param id The id to associate with the image.
413 * 428 *
414 * @return A new IM/HTML Scalable object with an image. 429 * @return A new IM/HTML Scalable object with an image.
415 */ 430 */
416 GtkIMHtmlScalable *gtk_imhtml_image_new(GdkPixbuf *img, const gchar *filename, int id); 431 GtkIMHtmlScalable *gtk_imhtml_image_new(GdkPixbuf *img, const gchar *filename, int id);
417 432
418 /** 433 /**
434 * Creates and returns a new GTK+ IM/HTML scalable object with an
435 * animated image.
436 *
437 * @param img A GdkPixbufAnimation of the image to add.
438 * @param filename The filename to associate with the image.
439 * @param id The id to associate with the image.
440 *
441 * @return A new IM/HTML Scalable object with an image.
442 */
443 /*
444 * TODO: All this animation code could be combined much better with
445 * the image code. It couldn't be done when it was written
446 * because it requires breaking backward compatibility. It
447 * would be good to do it for 3.0.0.
448 */
449 GtkIMHtmlScalable *gtk_imhtml_animation_new(GdkPixbufAnimation *img, const gchar *filename, int id);
450
451 /**
419 * Destroys and frees a GTK+ IM/HTML scalable image. 452 * Destroys and frees a GTK+ IM/HTML scalable image.
420 * 453 *
421 * @param scale The GTK+ IM/HTML scalable. 454 * @param scale The GTK+ IM/HTML scalable.
422 */ 455 */
456 /* TODO: Is there any reason this isn't private? */
423 void gtk_imhtml_image_free(GtkIMHtmlScalable *scale); 457 void gtk_imhtml_image_free(GtkIMHtmlScalable *scale);
458
459 /**
460 * Destroys and frees a GTK+ IM/HTML scalable animation.
461 *
462 * @param scale The GTK+ IM/HTML scalable.
463 */
464 /* TODO: Is there any reason this isn't private? */
465 void gtk_imhtml_animation_free(GtkIMHtmlScalable *scale);
424 466
425 /** 467 /**
426 * Rescales a GTK+ IM/HTML scalable image to a given size. 468 * Rescales a GTK+ IM/HTML scalable image to a given size.
427 * 469 *
428 * @param scale The GTK+ IM/HTML scalable. 470 * @param scale The GTK+ IM/HTML scalable.
429 * @param width The new width. 471 * @param width The new width.
430 * @param height The new height. 472 * @param height The new height.
431 */ 473 */
474 /* TODO: Is there any reason this isn't private? */
432 void gtk_imhtml_image_scale(GtkIMHtmlScalable *scale, int width, int height); 475 void gtk_imhtml_image_scale(GtkIMHtmlScalable *scale, int width, int height);
433 476
434 /** 477 /**
435 * Adds a GTK+ IM/HTML scalable image to a given GTK+ IM/HTML at a given iter. 478 * Adds a GTK+ IM/HTML scalable image to a given GTK+ IM/HTML at a given iter.
436 * 479 *
437 * @param scale The GTK+ IM/HTML scalable. 480 * @param scale The GTK+ IM/HTML scalable.
438 * @param imhtml The GTK+ IM/HTML. 481 * @param imhtml The GTK+ IM/HTML.
439 * @param iter The GtkTextIter at which to add the scalable. 482 * @param iter The GtkTextIter at which to add the scalable.
440 */ 483 */
484 /* TODO: Is there any reason this isn't private? */
441 void gtk_imhtml_image_add_to(GtkIMHtmlScalable *scale, GtkIMHtml *imhtml, GtkTextIter *iter); 485 void gtk_imhtml_image_add_to(GtkIMHtmlScalable *scale, GtkIMHtml *imhtml, GtkTextIter *iter);
442 486
443 /** 487 /**
444 * Creates and returns an new GTK+ IM/HTML scalable with a horizontal rule. 488 * Creates and returns an new GTK+ IM/HTML scalable with a horizontal rule.
445 * 489 *
784 * 828 *
785 * @return A string containing the unformatted text. 829 * @return A string containing the unformatted text.
786 */ 830 */
787 char *gtk_imhtml_get_text(GtkIMHtml *imhtml, GtkTextIter *start, GtkTextIter *stop); 831 char *gtk_imhtml_get_text(GtkIMHtml *imhtml, GtkTextIter *start, GtkTextIter *stop);
788 832
833 /**
834 * Setup formatting for an imhtml depending on the flags specified.
835 *
836 * @param imhtml The GTK+ IM/HTML.
837 * @param flags The connection flag which describes the allowed types of formatting.
838 */
839 void gtk_imhtml_setup_entry(GtkIMHtml *imhtml, PurpleConnectionFlags flags);
840
789 /*@}*/ 841 /*@}*/
790 842
791 #ifdef __cplusplus 843 #ifdef __cplusplus
792 } 844 }
793 #endif 845 #endif

mercurial