package ocgtk

  1. Overview
  2. Docs
OCaml bindings for GTK 4

Install

dune-project
 Dependency

Authors

Maintainers

Sources

v0.1-preview2.tar.gz
sha256=4e50fdb5093136a10fc8ffbe388e44cbcb70d52f8afdd48863ec7e22580ff054

doc/ocgtk.gtk/Ocgtk_gtk/Gtk/Wrappers/Picture/index.html

Module Wrappers.Picture

type t = [ `picture | `widget | `initially_unowned | `object_ ] Gobject.obj
val new_ : unit -> t

Create a new Picture

val new_for_file : Ocgtk_gio.Gio.Wrappers.File.t option -> t

Create a new Picture

val new_for_filename : string option -> t

Create a new Picture

val new_for_paintable : Ocgtk_gdk.Gdk.Wrappers.Paintable.t option -> t

Create a new Picture

val new_for_pixbuf : Ocgtk_gdkpixbuf.GdkPixbuf.Wrappers.Pixbuf.t option -> t

Create a new Picture

val new_for_resource : string option -> t

Create a new Picture

val set_resource : t -> string option -> unit

Makes @self load and display the resource at the given @resource_path.

This is a utility function that calls method@Gtk.Picture.set_file.

val set_pixbuf : t -> Ocgtk_gdkpixbuf.GdkPixbuf.Wrappers.Pixbuf.t option -> unit

Sets a `GtkPicture` to show a `GdkPixbuf`.

See ctor@Gtk.Picture.new_for_pixbuf for details.

This is a utility function that calls method@Gtk.Picture.set_paintable.

val set_paintable : t -> Ocgtk_gdk.Gdk.Wrappers.Paintable.t option -> unit

Makes @self display the given @paintable.

If @paintable is %NULL, nothing will be displayed.

See ctor@Gtk.Picture.new_for_paintable for details.

val set_keep_aspect_ratio : t -> bool -> unit

If set to %TRUE, the @self will render its contents according to their aspect ratio.

That means that empty space may show up at the top/bottom or left/right of @self.

If set to %FALSE or if the contents provide no aspect ratio, the contents will be stretched over the picture's whole area.

val set_filename : t -> string option -> unit

Makes @self load and display the given @filename.

This is a utility function that calls method@Gtk.Picture.set_file.

val set_file : t -> Ocgtk_gio.Gio.Wrappers.File.t option -> unit

Makes @self load and display @file.

See ctor@Gtk.Picture.new_for_file for details.

val set_content_fit : t -> Gtk_enums.contentfit -> unit

Sets how the content should be resized to fit the `GtkPicture`.

See enum@Gtk.ContentFit for details.

val set_can_shrink : t -> bool -> unit

If set to %TRUE, the @self can be made smaller than its contents.

The contents will then be scaled down when rendering.

If you want to still force a minimum size manually, consider using method@Gtk.Widget.set_size_request.

Also of note is that a similar function for growing does not exist because the grow behavior can be controlled via method@Gtk.Widget.set_halign and method@Gtk.Widget.set_valign.

val set_alternative_text : t -> string option -> unit

Sets an alternative textual description for the picture contents.

It is equivalent to the "alt" attribute for images on websites.

This text will be made available to accessibility tools.

If the picture cannot be described textually, set this property to %NULL.

val get_paintable : t -> Ocgtk_gdk.Gdk.Wrappers.Paintable.t option

Gets the `GdkPaintable` being displayed by the `GtkPicture`.

val get_keep_aspect_ratio : t -> bool

Returns whether the `GtkPicture` preserves its contents aspect ratio.

val get_file : t -> Ocgtk_gio.Gio.Wrappers.File.t option

Gets the `GFile` currently displayed if @self is displaying a file.

If @self is not displaying a file, for example when method@Gtk.Picture.set_paintable was used, then %NULL is returned.

val get_content_fit : t -> Gtk_enums.contentfit

Returns the fit mode for the content of the `GtkPicture`.

See enum@Gtk.ContentFit for details.

val get_can_shrink : t -> bool

Returns whether the `GtkPicture` respects its contents size.

val get_alternative_text : t -> string option

Gets the alternative textual description of the picture.

The returned string will be %NULL if the picture cannot be described textually.