Package: gtk

Class gtk:image

Superclasses

Documented Subclasses

None

Direct Slots

file
The file property of type :string (Read / Write)
The name of the file to load and display.
Default value: nil
gicon
The gicon property of type g:icon (Read / Write)
The icon displayed in the image. For themed icons, if the icon theme is changed, the image will be updated automatically.
icon-name
The icon-name property of type :string (Read / Write)
The name of the icon in the icon theme. If the icon theme is changed, the image will be updated automatically.
Default value: nil
icon-size
The icon-size property of type gtk:icon-size (Read / Write)
The symbolic size to display icons at.
Default value: :inherit
paintable
The paintable property of type gdk:paintable (Read / Write)
The paintable to display.
pixel-size
The pixel-size property of type :int (Read / Write)
Can be used to specify a fixed size overriding the icon-size property for images of :icon-name type.
Allowed values: >= -1
Default value: -1
resource
The resource property of type :string (Read / Write)
The path to a resource file to display.
Default value: nil
storage-type
The storage-type property of type gtk:image-type (Read)
The representation being used for image data.
Default value: :empty
use-fallback
The use-fallback property of type :boolean (Read / Write)
Whether the icon displayed in the image will use standard icon names fallback. The value of this property is only relevant for images of :icon-name and :gicon type.
Default value: false

Details

The gtk:image widget displays an image. Various kinds of objects can be displayed as an image. Most typically, you would load a gdk:texture object from a file, and then display that.

Figure: GtkImage

There is a convenience gtk:image-new-from-file function to do this, used as follows:
(let ((image (gtk:image-new-from-file "myfile.png")))
  ... )  
If the file is not 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 the gdk:texture-new-from-file function, then create the gtk:image widget with the gtk:image-new-from-paintable function.

Sometimes an application will want to avoid depending on external data files, such as image files. See the documentation of the g:resource API for details. In this case, the resource property, the gtk:image-new-from-resource and gtk:image-set-from-resource functions should be used.

The gtk:image widget displays its image as an icon, with a size that is determined by the application. See the gtk:picture widget if you want to show an image at is actual size.

CSS nodes

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

Accessibility

The gtk:image implementation uses the :img role of the gtk:accessible-role enumeration.
 

Returned by

Slot Access Functions

Inherited Slot Access Functions

See also

2024-10-29