Gtk.Icon_Set

Entities

Tagged Types

Constants

Subprograms

Description

An icon set represents a single icon in various sizes and widget states. It can provide a Gdk_Pixbuf for a given size and state on request, and automatically caches some of the rendered Gdk_Pixbuf objects.

Normally you would use Gtk.Widget.Render_Icon instead of using icon sets directly. The one case where you'd use an icon set is to create application-specific icon sets to place in an icon factory.

Add_Source

procedure Add_Source
   (Self   : Gtk_Icon_Set;
    Source : Gtk.Icon_Source.Gtk_Icon_Source)

Icon sets have a list of Gtk.Icon_Source.Gtk_Icon_Source, which they use as base icons for rendering icons in different states and sizes. Icons are scaled, made to look insensitive, etc. in Gtk.Icon_Set.Render_Icon, but Gtk.Icon_Set.Gtk_Icon_Set needs base images to work with. The base images and when to use them are described by a Gtk.Icon_Source.Gtk_Icon_Source. This function copies Source, so you can reuse the same source immediately without affecting the icon set. An example of when you'd use this function: a web browser's "Back to Previous Page" icon might point in a different direction in Hebrew and in English; it might look different when insensitive; and it might change size depending on toolbar mode (small/large icons). So a single icon set would contain all those variants of the icon, and you might add a separate source for each one. You should nearly always add a "default" icon source with all fields wildcarded, which will be used as a fallback if no more specific source matches. Gtk.Icon_Set.Gtk_Icon_Set always prefers more specific icon sources to more generic icon sources. The order in which you add the sources to the icon set does not matter. gtk_icon_set_new_from_pixbuf creates a new icon set with a default icon source based on the given pixbuf. Deprecated since 3.10, 1

Parameters
Self
Source

a Gtk.Icon_Source.Gtk_Icon_Source

Copy

function Copy (Self : Gtk_Icon_Set) return Gtk_Icon_Set

Copies Icon_Set by value. Deprecated since 3.10, 1

Parameters
Self
Return Value

a new Gtk.Icon_Set.Gtk_Icon_Set identical to the first.

From_Object

function From_Object (Object : System.Address) return Gtk_Icon_Set
Parameters
Object
Return Value

From_Object_Free

function From_Object_Free (B : access Gtk_Icon_Set'Class) return Gtk_Icon_Set
Parameters
B
Return Value

Get_Sizes

function Get_Sizes (Self : Gtk_Icon_Set) return Gint_Array

Obtains a list of icon sizes this icon set can render. The returned array must be freed with g_free. Deprecated since 3.10, 1

Parameters
Self
Return Value

Get_Type

function Get_Type return Glib.GType
Return Value

Gtk_Icon_Set

type Gtk_Icon_Set is new Glib.C_Boxed with null record;

Gtk_Icon_Set_New

function Gtk_Icon_Set_New return Gtk_Icon_Set

Creates a new Gtk.Icon_Set.Gtk_Icon_Set. A Gtk.Icon_Set.Gtk_Icon_Set represents a single icon in various sizes and widget states. It can provide a Gdk.Pixbuf.Gdk_Pixbuf for a given size and state on request, and automatically caches some of the rendered Gdk.Pixbuf.Gdk_Pixbuf objects. Normally you would use Gtk.Widget.Render_Icon_Pixbuf instead of using Gtk.Icon_Set.Gtk_Icon_Set directly. The one case where you'd use Gtk.Icon_Set.Gtk_Icon_Set is to create application-specific icon sets to place in a Gtk.Icon_Factory.Gtk_Icon_Factory.

Return Value

Gtk_Icon_Set_New_From_Pixbuf

function Gtk_Icon_Set_New_From_Pixbuf
   (Pixbuf : not null access Gdk.Pixbuf.Gdk_Pixbuf_Record'Class)
    return Gtk_Icon_Set

Creates a new Gtk.Icon_Set.Gtk_Icon_Set with Pixbuf as the default/fallback source image. If you don't add any additional Gtk.Icon_Source.Gtk_Icon_Source to the icon set, all variants of the icon will be created from Pixbuf, using scaling, pixelation, etc. as required to adjust the icon size or make the icon look insensitive/prelighted.

Parameters
Pixbuf

a Gdk.Pixbuf.Gdk_Pixbuf

Return Value

Gtk_New

procedure Gtk_New (Self : out Gtk_Icon_Set)

Creates a new Gtk.Icon_Set.Gtk_Icon_Set. A Gtk.Icon_Set.Gtk_Icon_Set represents a single icon in various sizes and widget states. It can provide a Gdk.Pixbuf.Gdk_Pixbuf for a given size and state on request, and automatically caches some of the rendered Gdk.Pixbuf.Gdk_Pixbuf objects. Normally you would use Gtk.Widget.Render_Icon_Pixbuf instead of using Gtk.Icon_Set.Gtk_Icon_Set directly. The one case where you'd use Gtk.Icon_Set.Gtk_Icon_Set is to create application-specific icon sets to place in a Gtk.Icon_Factory.Gtk_Icon_Factory.

Parameters
Self

Gtk_New_From_Pixbuf

procedure Gtk_New_From_Pixbuf
   (Self   : out Gtk_Icon_Set;
    Pixbuf : not null access Gdk.Pixbuf.Gdk_Pixbuf_Record'Class)

Creates a new Gtk.Icon_Set.Gtk_Icon_Set with Pixbuf as the default/fallback source image. If you don't add any additional Gtk.Icon_Source.Gtk_Icon_Source to the icon set, all variants of the icon will be created from Pixbuf, using scaling, pixelation, etc. as required to adjust the icon size or make the icon look insensitive/prelighted.

Parameters
Self
Pixbuf

a Gdk.Pixbuf.Gdk_Pixbuf

Lookup_Icon_Set

function Lookup_Icon_Set
  (Style    : access Gtk.Style_Context.Gtk_Style_Context_Record'Class;
   Stock_Id : String)
return Gtk_Icon_Set

Retrieve an icon set by its name. The icon might exist in various sizes, that can be manipulated through the result set

Parameters
Style
Stock_Id
Return Value

Null_Gtk_Icon_Set

Null_Gtk_Icon_Set : constant Gtk_Icon_Set;

Ref

function Ref (Self : Gtk_Icon_Set) return Gtk_Icon_Set

Increments the reference count on Icon_Set. Deprecated since 3.10, 1

Parameters
Self
Return Value

Icon_Set.

Render_Icon

function Render_Icon
   (Self      : Gtk_Icon_Set;
    Style     : access Gtk.Style.Gtk_Style_Record'Class;
    Direction : Gtk.Enums.Gtk_Text_Direction;
    State     : Gtk.Enums.Gtk_State_Type;
    Size      : Gtk.Enums.Gtk_Icon_Size;
    Widget    : access Gtk.Widget.Gtk_Widget_Record'Class;
    Detail    : UTF8_String := "") return Gdk.Pixbuf.Gdk_Pixbuf

Renders an icon using gtk_style_render_icon. In most cases, Gtk.Widget.Render_Icon is better, since it automatically provides most of the arguments from the current widget settings. This function never returns null; if the icon can't be rendered (perhaps because an image file fails to load), a default "missing image" icon will be returned instead. Deprecated since 3.0, 1

Parameters
Self
Style

a Gtk.Style.Gtk_Style associated with Widget, or null

Direction

text direction

State

widget state

Size

icon size (Gtk.Enums.Gtk_Icon_Size). A size of (GtkIconSize)-1 means render at the size of the source and don't scale.

Widget

widget that will display the icon, or null. The only use that is typically made of this is to determine the appropriate Gdk.Screen.Gdk_Screen.

Detail

detail to pass to the theme engine, or null. Note that passing a detail of anything but null will disable caching.

Return Value

a Gdk.Pixbuf.Gdk_Pixbuf to be displayed

Render_Icon_Pixbuf

function Render_Icon_Pixbuf
   (Self    : Gtk_Icon_Set;
    Context : not null access Gtk.Style_Context.Gtk_Style_Context_Record'Class;
    Size    : Gtk.Enums.Gtk_Icon_Size) return Gdk.Pixbuf.Gdk_Pixbuf

Renders an icon using gtk_render_icon_pixbuf. In most cases, Gtk.Widget.Render_Icon_Pixbuf is better, since it automatically provides most of the arguments from the current widget settings. This function never returns null; if the icon can't be rendered (perhaps because an image file fails to load), a default "missing image" icon will be returned instead. Since: gtk+ 3.0 Deprecated since 3.10, 1

Parameters
Self
Context

a Gtk.Style_Context.Gtk_Style_Context

Size

icon size (Gtk.Enums.Gtk_Icon_Size). A size of (GtkIconSize)-1 means render at the size of the source and don't scale.

Return Value

a Gdk.Pixbuf.Gdk_Pixbuf to be displayed

Render_Icon_Surface

function Render_Icon_Surface
   (Self       : Gtk_Icon_Set;
    Context    : not null access Gtk.Style_Context.Gtk_Style_Context_Record'Class;
    Size       : Gtk.Enums.Gtk_Icon_Size;
    Scale      : Glib.Gint;
    For_Window : Gdk.Gdk_Window) return Cairo.Cairo_Surface

Renders an icon using gtk_render_icon_pixbuf and converts it to a cairo surface. This function never returns null; if the icon can't be rendered (perhaps because an image file fails to load), a default "missing image" icon will be returned instead. Since: gtk+ 3.10 Deprecated since 3.10, 1

Parameters
Self
Context

a Gtk.Style_Context.Gtk_Style_Context

Size

icon size (Gtk.Enums.Gtk_Icon_Size). A size of (GtkIconSize)-1 means render at the size of the source and don't scale.

Scale

the window scale to render for

For_Window

Gdk.Gdk_Window to optimize drawing for, or null

Return Value

a cairo_surface_t to be displayed

Unref

procedure Unref (Self : Gtk_Icon_Set)

Decrements the reference count on Icon_Set, and frees memory if the reference count reaches 0. Deprecated since 3.10, 1

Parameters
Self