Class: Gtk::Image

Inherits:
Object
  • Object
show all
Defined in:
(unknown)

Instance Method Summary collapse

Instance Method Details

#animationGdkPixbuf::PixbufAnimation

Gets the Gdk::PixbufAnimation being displayed by the #GtkImage. The storage type of the image must be %GTK_IMAGE_EMPTY or %GTK_IMAGE_ANIMATION (see gtk_image_get_storage_type()). The caller of this function does not own a reference to the returned animation. the image is empty

Returns:

#clearnil

Resets the image to be empty.

Returns:

  • (nil)

#fileString

Returns file.

Returns:

  • (String)

    file

#file=(file) ⇒ String

Parameters:

  • file (String)

Returns:

  • (String)

    file

  • (String)

    file

#from_animation=(animation) ⇒ nil

Causes the Gtk::Image to display the given animation (or display nothing, if you set the animation to nil).

Parameters:

Returns:

  • (nil)

#from_file=(filename) ⇒ nil

See gtk_image_new_from_file() for details.

Parameters:

  • filename (Gtk::filename)

    a filename or nil

Returns:

  • (nil)

#from_pixbuf=(pixbuf) ⇒ nil

See gtk_image_new_from_pixbuf() for details.

Parameters:

Returns:

  • (nil)

#from_resource=(resource_path) ⇒ nil

See gtk_image_new_from_resource() for details.

Parameters:

  • resource_path (String)

    a resource path or nil

Returns:

  • (nil)

#from_surface=(surface) ⇒ nil

See gtk_image_new_from_surface() for details.

Parameters:

  • surface (cairo::Surface)

    a cairo_surface_t or nil

Returns:

  • (nil)

#get_gicon(gicon, size) ⇒ nil

Gets the #GIcon and size being displayed by the Gtk::Image. The storage type of the image must be %GTK_IMAGE_EMPTY or %GTK_IMAGE_GICON (see gtk_image_get_storage_type()). The caller of this function does not own a reference to the returned #GIcon.

Parameters:

  • gicon (Gio::Icon)

    place to store a #GIcon, or nil

  • size (Integer)

    place to store an icon size (Gtk::IconSize), or nil

Returns:

  • (nil)

#get_icon_name(icon_name, size) ⇒ nil

Gets the icon name and size being displayed by the Gtk::Image. The storage type of the image must be %GTK_IMAGE_EMPTY or %GTK_IMAGE_ICON_NAME (see gtk_image_get_storage_type()). The returned string is owned by the Gtk::Image and should not be freed.

Parameters:

  • icon_name (String)

    place to store an icon name, or nil

  • size (Integer)

    place to store an icon size (Gtk::IconSize), or nil

Returns:

  • (nil)

#get_icon_set(icon_set, size) ⇒ nil

Gets the icon set and size being displayed by the Gtk::Image. The storage type of the image must be %GTK_IMAGE_EMPTY or %GTK_IMAGE_ICON_SET (see gtk_image_get_storage_type()).

Parameters:

  • icon_set (Gtk::IconSet)

    location to store a Gtk::IconSet, or nil

  • size (Integer)

    location to store a stock icon size (Gtk::IconSize), or nil

Returns:

  • (nil)

#get_stock(stock_id, size) ⇒ nil

Gets the stock icon name and size being displayed by the Gtk::Image. The storage type of the image must be %GTK_IMAGE_EMPTY or %GTK_IMAGE_STOCK (see gtk_image_get_storage_type()). The returned string is owned by the Gtk::Image and should not be freed.

Parameters:

  • stock_id (String)

    place to store a stock icon name, or nil

  • size (Integer)

    place to store a stock icon size (Gtk::IconSize), or nil

Returns:

  • (nil)

#giconGio::Icon

The GIcon displayed in the GtkImage. For themed icons, If the icon theme is changed, the image will be updated automatically.

Returns:

#gicon=(gicon) ⇒ Gio::Icon

The GIcon displayed in the GtkImage. For themed icons, If the icon theme is changed, the image will be updated automatically.

Parameters:

Returns:

#icon_nameString

The name of the icon in the icon theme. If the icon theme is changed, the image will be updated automatically.

Returns:

  • (String)

    icon-name

#icon_name=(icon_name) ⇒ String

The name of the icon in the icon theme. If the icon theme is changed, the image will be updated automatically.

Parameters:

  • icon_name (String)

Returns:

  • (String)

    icon-name

  • (String)

    icon-name

#icon_setGtk::IconSet

Returns icon-set.

Returns:

  • (Gtk::IconSet)

    icon-set

#icon_set=(icon_set) ⇒ Gtk::IconSet

Parameters:

  • icon_set (Gtk::IconSet)

Returns:

  • (Gtk::IconSet)

    icon-set

  • (Gtk::IconSet)

    icon-set

#icon_sizeInteger

Returns icon-size.

Returns:

  • (Integer)

    icon-size

#icon_size=(icon_size) ⇒ Integer

Parameters:

  • icon_size (Integer)

Returns:

  • (Integer)

    icon-size

  • (Integer)

    icon-size

#newGtk::Widget

Creates a new empty Gtk::Image widget.

Returns:

#new_from_animation(animation) ⇒ Gtk::Widget

Creates a Gtk::Image displaying the given animation. The Gtk::Image does not assume a reference to the animation; you still need to unref it if you own references. Gtk::Image will add its own reference rather than adopting yours.

Note that the animation frames are shown using a timeout with #G_PRIORITY_DEFAULT. When using animations to indicate busyness, keep in mind that the animation will only be shown if the main loop is not busy with something that has a higher priority.

Parameters:

Returns:

#new_from_file(filename) ⇒ Gtk::Widget

Creates a new Gtk::Image displaying the file filename. If the file isn’t found or can’t be loaded, the resulting Gtk::Image will display a “broken image” icon. This function never returns nil, it always returns a valid Gtk::Image widget.

If the file contains an animation, the image will contain an animation.

If you need to detect failures to load the file, use gdk_pixbuf_new_from_file() to load the file yourself, then create the Gtk::Image from the pixbuf. (Or for animations, use gdk_pixbuf_animation_new_from_file()).

The storage type (gtk_image_get_storage_type()) of the returned image is not defined, it will be whatever is appropriate for displaying the file.

Parameters:

  • filename (Gtk::filename)

    a filename

Returns:

#new_from_gicon(icon, size) ⇒ Gtk::Widget

Creates a Gtk::Image displaying an icon from the current icon theme. If the icon name isn’t known, a “broken image” icon will be displayed instead. If the current icon theme is changed, the icon will be updated appropriately.

Parameters:

  • icon (Gio::Icon)

    an icon

  • size (Integer)

    a stock icon size (Gtk::IconSize)

Returns:

  • (Gtk::Widget)

    a new Gtk::Image displaying the themed icon

#new_from_icon_name(icon_name, size) ⇒ Gtk::Widget

Creates a Gtk::Image displaying an icon from the current icon theme. If the icon name isn’t known, a “broken image” icon will be displayed instead. If the current icon theme is changed, the icon will be updated appropriately.

Parameters:

  • icon_name (String)

    an icon name or nil

  • size (Integer)

    a stock icon size (Gtk::IconSize)

Returns:

  • (Gtk::Widget)

    a new Gtk::Image displaying the themed icon

#new_from_icon_set(icon_set, size) ⇒ Gtk::Widget

Creates a Gtk::Image displaying an icon set. Sample stock sizes are #GTK_ICON_SIZE_MENU, #GTK_ICON_SIZE_SMALL_TOOLBAR. Instead of using this function, usually it’s better to create a Gtk::IconFactory, put your icon sets in the icon factory, add the icon factory to the list of default factories with gtk_icon_factory_add_default(), and then use gtk_image_new_from_stock(). This will allow themes to override the icon you ship with your application.

The Gtk::Image does not assume a reference to the icon set; you still need to unref it if you own references. Gtk::Image will add its own reference rather than adopting yours.

Parameters:

  • icon_set (Gtk::IconSet)

    a Gtk::IconSet

  • size (Integer)

    a stock icon size (Gtk::IconSize)

Returns:

#new_from_pixbuf(pixbuf) ⇒ Gtk::Widget

Creates a new Gtk::Image displaying pixbuf. The Gtk::Image does not assume a reference to the pixbuf; you still need to unref it if you own references. Gtk::Image will add its own reference rather than adopting yours.

Note that this function just creates an Gtk::Image from the pixbuf. The Gtk::Image created will not react to state changes. Should you want that, you should use gtk_image_new_from_icon_name().

Parameters:

Returns:

#new_from_resource(resource_path) ⇒ Gtk::Widget

Creates a new Gtk::Image displaying the resource file resource_path. If the file isn’t found or can’t be loaded, the resulting Gtk::Image will display a “broken image” icon. This function never returns nil, it always returns a valid Gtk::Image widget.

If the file contains an animation, the image will contain an animation.

If you need to detect failures to load the file, use gdk_pixbuf_new_from_file() to load the file yourself, then create the Gtk::Image from the pixbuf. (Or for animations, use gdk_pixbuf_animation_new_from_file()).

The storage type (gtk_image_get_storage_type()) of the returned image is not defined, it will be whatever is appropriate for displaying the file.

Parameters:

  • resource_path (String)

    a resource path

Returns:

#new_from_stock(stock_id, size) ⇒ Gtk::Widget

Creates a Gtk::Image displaying a stock icon. Sample stock icon names are #GTK_STOCK_OPEN, #GTK_STOCK_QUIT. Sample stock sizes are #GTK_ICON_SIZE_MENU, #GTK_ICON_SIZE_SMALL_TOOLBAR. If the stock icon name isn’t known, the image will be empty. You can register your own stock icon names, see gtk_icon_factory_add_default() and gtk_icon_factory_add().

Parameters:

  • stock_id (String)

    a stock icon name

  • size (Integer)

    a stock icon size (Gtk::IconSize)

Returns:

  • (Gtk::Widget)

    a new Gtk::Image displaying the stock icon

#new_from_surface(surface) ⇒ Gtk::Widget

Creates a new Gtk::Image displaying surface. The Gtk::Image does not assume a reference to the surface; you still need to unref it if you own references. Gtk::Image will add its own reference rather than adopting yours.

Parameters:

  • surface (cairo::Surface)

    a #cairo_surface_t, or nil

Returns:

#pixbufGdkPixbuf::Pixbuf

Returns pixbuf.

Returns:

#pixbuf=(pixbuf) ⇒ GdkPixbuf::Pixbuf

Parameters:

Returns:

#pixbuf_animationGdkPixbuf::PixbufAnimation

Returns pixbuf-animation.

Returns:

#pixbuf_animation=(pixbuf_animation) ⇒ GdkPixbuf::PixbufAnimation

Parameters:

Returns:

#pixel_sizeInteger

The “pixel-size” property can be used to specify a fixed size overriding the Gtk::Image:icon-size property for images of type %GTK_IMAGE_ICON_NAME.

Returns:

  • (Integer)

    pixel-size

#pixel_size=(pixel_size) ⇒ Integer

The “pixel-size” property can be used to specify a fixed size overriding the Gtk::Image:icon-size property for images of type %GTK_IMAGE_ICON_NAME.

Parameters:

  • pixel_size (Integer)

Returns:

  • (Integer)

    pixel-size

  • (Integer)

    pixel-size

#resourceString

A path to a resource file to display.

Returns:

  • (String)

    resource

#resource=(resource) ⇒ String

A path to a resource file to display.

Parameters:

  • resource (String)

Returns:

  • (String)

    resource

  • (String)

    resource

#set_from_gicon(icon, size) ⇒ nil

See gtk_image_new_from_gicon() for details.

Parameters:

  • icon (Gio::Icon)

    an icon

  • size (Integer)

    an icon size (Gtk::IconSize)

Returns:

  • (nil)

#set_from_icon_name(icon_name, size) ⇒ nil

See gtk_image_new_from_icon_name() for details.

Parameters:

  • icon_name (String)

    an icon name or nil

  • size (Integer)

    an icon size (Gtk::IconSize)

Returns:

  • (nil)

#set_from_icon_set(icon_set, size) ⇒ nil

See gtk_image_new_from_icon_set() for details.

Parameters:

  • icon_set (Gtk::IconSet)

    a Gtk::IconSet

  • size (Integer)

    a stock icon size (Gtk::IconSize)

Returns:

  • (nil)

#set_from_stock(stock_id, size) ⇒ nil

See gtk_image_new_from_stock() for details.

Parameters:

  • stock_id (String)

    a stock icon name

  • size (Integer)

    a stock icon size (Gtk::IconSize)

Returns:

  • (nil)

#stockString

Returns stock.

Returns:

  • (String)

    stock

#stock=(stock) ⇒ String

Parameters:

  • stock (String)

Returns:

  • (String)

    stock

  • (String)

    stock

#storage_typeGtk::ImageType

Returns storage-type.

Returns:

#storage_type=(storage_type) ⇒ Gtk::ImageType

Parameters:

Returns:

#surfacecairo::Surface

Returns surface.

Returns:

  • (cairo::Surface)

    surface

#surface=(surface) ⇒ cairo::Surface

Parameters:

  • surface (cairo::Surface)

Returns:

  • (cairo::Surface)

    surface

  • (cairo::Surface)

    surface

#use_fallback=(use_fallback) ⇒ TrueClass

Whether the icon displayed in the GtkImage will use standard icon names fallback. The value of this property is only relevant for images of type %GTK_IMAGE_ICON_NAME and %GTK_IMAGE_GICON.

Parameters:

  • use_fallback (TrueClass)

Returns:

  • (TrueClass)

    use-fallback

  • (TrueClass)

    use-fallback

#use_fallback?TrueClass

Whether the icon displayed in the GtkImage will use standard icon names fallback. The value of this property is only relevant for images of type %GTK_IMAGE_ICON_NAME and %GTK_IMAGE_GICON.

Returns:

  • (TrueClass)

    use-fallback