Class
GtkImage
Description [src]
final class Gtk.Image : Gtk.Widget
implements Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget {
/* No available fields */
}
Displays an image.
picture>
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.
Instance methods
gtk_image_get_storage_type
Gets the type of representation being used by the GtkImage
to store image data.
Methods inherited from GtkAccessible (20)
Methods inherited from GtkBuildable (1)
Properties
Gtk.Image:use-fallback
Whether the icon displayed in the GtkImage
will use
standard icon names fallback.