pidgin/gtkutils.h

changeset 41144
910bdda75c74
parent 41137
3c1574216aed
child 41266
64805b295a5c
equal deleted inserted replaced
41143:8fa1f37d32f2 41144:910bdda75c74
420 * Returns: (transfer full): A GtkBox already added to the GtkBox containing the GtkLabel and the GtkWidget. 420 * Returns: (transfer full): A GtkBox already added to the GtkBox containing the GtkLabel and the GtkWidget.
421 */ 421 */
422 GtkWidget *pidgin_add_widget_to_vbox(GtkBox *vbox, const char *widget_label, GtkSizeGroup *sg, GtkWidget *widget, gboolean expand, GtkWidget **p_label); 422 GtkWidget *pidgin_add_widget_to_vbox(GtkBox *vbox, const char *widget_label, GtkSizeGroup *sg, GtkWidget *widget, gboolean expand, GtkWidget **p_label);
423 423
424 /** 424 /**
425 * pidgin_pixbuf_from_data:
426 * @buf: The raw binary image data.
427 * @count: The length of buf in bytes.
428 *
429 * Create a GdkPixbuf from a chunk of image data.
430 *
431 * Returns: (transfer full): A GdkPixbuf created from the image data, or NULL if
432 * there was an error parsing the data.
433 */
434 GdkPixbuf *pidgin_pixbuf_from_data(const guchar *buf, gsize count);
435
436 /**
437 * pidgin_pixbuf_anim_from_data:
438 * @buf: The raw binary image data.
439 * @count: The length of buf in bytes.
440 *
441 * Create a GdkPixbufAnimation from a chunk of image data.
442 *
443 * Returns: (transfer full): A GdkPixbufAnimation created from the image data, or NULL if
444 * there was an error parsing the data.
445 */
446 GdkPixbufAnimation *pidgin_pixbuf_anim_from_data(const guchar *buf, gsize count);
447
448 /**
449 * pidgin_pixbuf_from_image:
450 * @image: a PurpleImage.
451 *
452 * Create a GdkPixbuf from a PurpleImage.
453 *
454 * Returns: (transfer full): a GdkPixbuf created from the @image.
455 */
456 GdkPixbuf *
457 pidgin_pixbuf_from_image(PurpleImage *image);
458
459 /**
460 * pidgin_pixbuf_new_from_file:
461 * @filename: Name of file to load, in the GLib file name encoding
462 *
463 * Helper function that calls gdk_pixbuf_new_from_file() and checks both
464 * the return code and the GError and returns NULL if either one failed.
465 *
466 * The gdk-pixbuf documentation implies that it is sufficient to check
467 * the return value of gdk_pixbuf_new_from_file() to determine
468 * whether the image was able to be loaded. However, this is not the case
469 * with gdk-pixbuf 2.23.3 and probably many earlier versions. In some
470 * cases a GdkPixbuf object is returned that will cause some operations
471 * (like gdk_pixbuf_scale_simple()) to rapidly consume memory in an
472 * infinite loop.
473 *
474 * This function shouldn't be necessary once Pidgin requires a version of
475 * gdk-pixbuf where the aforementioned bug is fixed. However, it might be
476 * nice to keep this function around for the debug message that it logs.
477 *
478 * Returns: (transfer full): The GdkPixbuf if successful. Otherwise NULL is returned and
479 * a warning is logged.
480 */
481 GdkPixbuf *pidgin_pixbuf_new_from_file(const char *filename);
482
483 /**
484 * pidgin_pixbuf_new_from_file_at_size:
485 * @filename: Name of file to load, in the GLib file name encoding
486 * @width: The width the image should have or -1 to not constrain the width
487 * @height: The height the image should have or -1 to not constrain the height
488 *
489 * Helper function that calls gdk_pixbuf_new_from_file_at_size() and checks
490 * both the return code and the GError and returns NULL if either one failed.
491 *
492 * The gdk-pixbuf documentation implies that it is sufficient to check
493 * the return value of gdk_pixbuf_new_from_file_at_size() to determine
494 * whether the image was able to be loaded. However, this is not the case
495 * with gdk-pixbuf 2.23.3 and probably many earlier versions. In some
496 * cases a GdkPixbuf object is returned that will cause some operations
497 * (like gdk_pixbuf_scale_simple()) to rapidly consume memory in an
498 * infinite loop.
499 *
500 * This function shouldn't be necessary once Pidgin requires a version of
501 * gdk-pixbuf where the aforementioned bug is fixed. However, it might be
502 * nice to keep this function around for the debug message that it logs.
503 *
504 * Returns: (transfer full): The GdkPixbuf if successful. Otherwise NULL is returned and
505 * a warning is logged.
506 */
507 GdkPixbuf *pidgin_pixbuf_new_from_file_at_size(const char *filename, int width, int height);
508
509 /**
510 * pidgin_pixbuf_new_from_file_at_scale:
511 * @filename: Name of file to load, in the GLib file name encoding
512 * @width: The width the image should have or -1 to not constrain the width
513 * @height: The height the image should have or -1 to not constrain the height
514 * @preserve_aspect_ratio: TRUE to preserve the image's aspect ratio
515 *
516 * Helper function that calls gdk_pixbuf_new_from_file_at_scale() and checks
517 * both the return code and the GError and returns NULL if either one failed.
518 *
519 * The gdk-pixbuf documentation implies that it is sufficient to check
520 * the return value of gdk_pixbuf_new_from_file_at_scale() to determine
521 * whether the image was able to be loaded. However, this is not the case
522 * with gdk-pixbuf 2.23.3 and probably many earlier versions. In some
523 * cases a GdkPixbuf object is returned that will cause some operations
524 * (like gdk_pixbuf_scale_simple()) to rapidly consume memory in an
525 * infinite loop.
526 *
527 * This function shouldn't be necessary once Pidgin requires a version of
528 * gdk-pixbuf where the aforementioned bug is fixed. However, it might be
529 * nice to keep this function around for the debug message that it logs.
530 *
531 * Returns: (transfer full): The GdkPixbuf if successful. Otherwise NULL is returned and
532 * a warning is logged.
533 */
534 GdkPixbuf *pidgin_pixbuf_new_from_file_at_scale(const char *filename, int width, int height, gboolean preserve_aspect_ratio);
535
536 /**
537 * pidgin_pixbuf_scale_down:
538 * @src: The source image.
539 * @max_width: Maximum width in px.
540 * @max_height: Maximum height in px.
541 * @interp_type: Interpolation method.
542 * @preserve_ratio: %TRUE to preserve image's aspect ratio.
543 *
544 * Scales the image to the desired dimensions. If image is smaller, it will be
545 * returned without modifications.
546 *
547 * If new image is created, @src reference count will be decreased and new image
548 * with a ref count of 1 will be returned.
549 *
550 * Returns: (transfer full): The image with proper sizing. %NULL in case of error.
551 */
552 GdkPixbuf *
553 pidgin_pixbuf_scale_down(GdkPixbuf *src, guint max_width, guint max_height,
554 GdkInterpType interp_type, gboolean preserve_ratio);
555
556 /**
557 * pidgin_make_scrollable: 425 * pidgin_make_scrollable:
558 * @child: The child widget 426 * @child: The child widget
559 * @hscrollbar_policy: Horizontal scrolling policy 427 * @hscrollbar_policy: Horizontal scrolling policy
560 * @vscrollbar_policy: Vertical scrolling policy 428 * @vscrollbar_policy: Vertical scrolling policy
561 * @shadow_type: Shadow type 429 * @shadow_type: Shadow type

mercurial