Class

GtkImage

[]

Description [src]

final class Gtk.Image : Gtk.Widget
  implements Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget {
  /* No available fields */
}

Displays an image.

picture> An example GtkImage

Various kinds of object can be displayed as an image; most typically, you would load a GdkTexture from a file, using the convenience function gtk_image_new_from_file(), for instance:

GtkWidget *image = gtk_image_new_from_file ("myfile.png");

If the file isn’t loaded successfully, the image will contain a “broken image” icon similar to that used in many web browsers.

If you want to handle errors in loading the file yourself, for example by displaying an error message, then load the image with gdk_texture_new_from_file(), then create the GtkImage with gtk_image_new_from_paintable().

Sometimes an application will want to avoid depending on external data files, such as image files. See the documentation of GResource inside GIO, for details. In this case, GtkImage:resource, gtk_image_new_from_resource(), and gtk_image_set_from_resource() should be used.

GtkImage displays its image as an icon, with a size that is determined by the application. See GtkPicture if you want to show an image at is actual size.

CSS nodes

GtkImage has a single CSS node with the name image. The style classes .normal-icons or .large-icons may appear, depending on the GtkImage:icon-size property.

Accessibility

GtkImage uses the GTK_ACCESSIBLE_ROLE_IMG role.

[]

Hierarchy

hierarchy this GtkImage implements_0 GtkAccessible this--implements_0 implements_1 GtkBuildable this--implements_1 implements_2 GtkConstraintTarget this--implements_2 ancestor_0 GtkWidget ancestor_0--this ancestor_1 GInitiallyUnowned ancestor_1--ancestor_0 ancestor_2 GObject ancestor_2--ancestor_1
[]

Constructors

gtk_image_new

Creates a new empty GtkImage widget.

gtk_image_new_from_file

Creates a new GtkImage displaying the file filename.

gtk_image_new_from_gicon

Creates a GtkImage displaying an icon from the current icon theme.

gtk_image_new_from_icon_name

Creates a GtkImage displaying an icon from the current icon theme.

gtk_image_new_from_paintable

Creates a new GtkImage displaying paintable.

gtk_image_new_from_pixbuf

Creates a new GtkImage displaying pixbuf.

deprecated: 4.12 

gtk_image_new_from_resource

Creates a new GtkImage displaying the resource file resource_path.

[]

Instance methods

gtk_image_clear

Resets the image to be empty.

gtk_image_get_gicon

Gets the GIcon being displayed by the GtkImage.

gtk_image_get_icon_name

Gets the icon name and size being displayed by the GtkImage.

gtk_image_get_icon_size

Gets the icon size used by the image when rendering icons.

gtk_image_get_paintable

Gets the image GdkPaintable being displayed by the GtkImage.

gtk_image_get_pixel_size

Gets the pixel size used for named icons.

gtk_image_get_storage_type

Gets the type of representation being used by the GtkImage to store image data.

gtk_image_set_from_file

Sets a GtkImage to show a file.

gtk_image_set_from_gicon

Sets a GtkImage to show a GIcon.

gtk_image_set_from_icon_name

Sets a GtkImage to show a named icon.

gtk_image_set_from_paintable

Sets a GtkImage to show a GdkPaintable.

gtk_image_set_from_pixbuf

Sets a GtkImage to show a GdkPixbuf.

deprecated: 4.12 

gtk_image_set_from_resource

Sets a GtkImage to show a resource.

gtk_image_set_icon_size

Suggests an icon size to the theme for named icons.

gtk_image_set_pixel_size

Sets the pixel size to use for named icons.

Methods inherited from GtkWidget (164)
Methods inherited from GObject (43)
Methods inherited from GtkAccessible (20)
Methods inherited from GtkBuildable (1)
[]

Properties

Gtk.Image:file

A path to the file to display.

Gtk.Image:gicon

The GIcon displayed in the GtkImage.

Gtk.Image:icon-name

The name of the icon in the icon theme.

Gtk.Image:icon-size

The symbolic size to display icons at.

Gtk.Image:paintable

The GdkPaintable to display.

Gtk.Image:pixel-size

The size in pixels to display icons at.

Gtk.Image:resource

A path to a resource file to display.

Gtk.Image:storage-type

The representation being used for image data.

Gtk.Image:use-fallback

Whether the icon displayed in the GtkImage will use standard icon names fallback.

Properties inherited from GtkWidget (35)
Properties inherited from GtkAccessible (1)
[]

Signals

Signals inherited from GtkWidget (13)
Signals inherited from GObject (1)