package Gtk_Icon_Lookup_Flags_Properties is new Generic_Internal_Discrete_Property (Gtk_Icon_Lookup_Flags);
type Gtk_Icon_Theme_Record is new GObject_Record with null record;
type Gtk_Icon_Info_Record is new GObject_Record with null record;
type Gtk_Icon_Theme is access all Gtk_Icon_Theme_Record'Class;
type Gtk_Icon_Lookup_Flags is mod 2 ** Integer'Size;
type Gtk_Icon_Info is access all Gtk_Icon_Info_Record'Class;
type Property_Gtk_Icon_Lookup_Flags is new Gtk_Icon_Lookup_Flags_Properties.Property;
type Cb_Gtk_Icon_Theme_Void is not null access procedure (Self : access Gtk_Icon_Theme_Record'Class);
type Cb_GObject_Void is not null access procedure (Self : access Glib.Object.GObject_Record'Class);
Icon_Lookup_No_Svg : constant Gtk_Icon_Lookup_Flags := 1;
Icon_Lookup_Force_Svg : constant Gtk_Icon_Lookup_Flags := 2;
Icon_Lookup_Use_Builtin : constant Gtk_Icon_Lookup_Flags := 4;
Icon_Lookup_Generic_Fallback : constant Gtk_Icon_Lookup_Flags := 8;
Icon_Lookup_Force_Size : constant Gtk_Icon_Lookup_Flags := 16;
Signal_Changed : constant Glib.Signal_Name := "changed";
procedure Gtk_New
( | Icon_Theme | : out Gtk_Icon_Theme); |
procedure Initialize
( | Icon_Theme | : not null access Gtk_Icon_Theme_Record'Class); |
function Gtk_Icon_Theme_New return Gtk_Icon_Theme;
function Get_Type return Glib.GType;
procedure Gtk_New_For_Pixbuf
( | Icon_Info | : out Gtk_Icon_Info; |
Icon_Theme | : not null access Gtk_Icon_Theme_Record'Class; | |
Pixbuf | : not null access Gdk.Pixbuf.Gdk_Pixbuf_Record'Class); |
procedure Initialize_For_Pixbuf
( | Icon_Info | : not null access Gtk_Icon_Info_Record'Class; |
Icon_Theme | : not null access Gtk_Icon_Theme_Record'Class; | |
Pixbuf | : not null access Gdk.Pixbuf.Gdk_Pixbuf_Record'Class); |
function Gtk_Icon_Info_New_For_Pixbuf
( | Icon_Theme | : not null access Gtk_Icon_Theme_Record'Class; |
Pixbuf | : not null access Gdk.Pixbuf.Gdk_Pixbuf_Record'Class) return Gtk_Icon_Info; |
function Icon_Info_Get_Type return Glib.GType;
procedure Append_Search_Path
( | Icon_Theme | : not null access Gtk_Icon_Theme_Record; |
Path | : UTF8_String); |
function Choose_Icon
( | Icon_Theme | : not null access Gtk_Icon_Theme_Record'Class; |
Icon_Names | : GNAT.Strings.String_List; | |
Size | : Gint; | |
Flags | : Gtk_Icon_Lookup_Flags) return Gtk_Icon_Info; |
function Get_Example_Icon_Name
( | Icon_Theme | : not null access Gtk_Icon_Theme_Record) return UTF8_String; |
function Get_Icon_Sizes
( | Icon_Theme | : not null access Gtk_Icon_Theme_Record; |
Icon_Name | : UTF8_String) return Gint_Array; |
function Get_Search_Path
( | Icon_Theme | : not null access Gtk_Icon_Theme_Record) return GNAT.Strings.String_List; |
procedure Set_Search_Path
( | Icon_Theme | : not null access Gtk_Icon_Theme_Record; |
Path | : GNAT.Strings.String_List); |
function Has_Icon
( | Icon_Theme | : not null access Gtk_Icon_Theme_Record; |
Icon_Name | : UTF8_String) return Boolean; |
function List_Contexts
( | Icon_Theme | : not null access Gtk_Icon_Theme_Record) return Gtk.Enums.String_List.Glist; |
function List_Icons
( | Icon_Theme | : not null access Gtk_Icon_Theme_Record; |
Context | : UTF8_String := "") return Gtk.Enums.String_List.Glist; |
function Load_Icon
( | Icon_Theme | : not null access Gtk_Icon_Theme_Record; |
Icon_Name | : UTF8_String; | |
Size | : Gint; | |
Flags | : Gtk_Icon_Lookup_Flags) return Gdk.Pixbuf.Gdk_Pixbuf; |
function Load_Icon
( | Icon_Info | : not null access Gtk_Icon_Info_Record) return Gdk.Pixbuf.Gdk_Pixbuf; |
function Lookup_By_Gicon
( | Icon_Theme | : not null access Gtk_Icon_Theme_Record'Class; |
Icon | : Glib.G_Icon.G_Icon; | |
Size | : Gint; | |
Flags | : Gtk_Icon_Lookup_Flags) return Gtk_Icon_Info; |
function Lookup_Icon
( | Icon_Theme | : not null access Gtk_Icon_Theme_Record'Class; |
Icon_Name | : UTF8_String; | |
Size | : Gint; | |
Flags | : Gtk_Icon_Lookup_Flags) return Gtk_Icon_Info; |
procedure Prepend_Search_Path
( | Icon_Theme | : not null access Gtk_Icon_Theme_Record; |
Path | : UTF8_String); |
function Rescan_If_Needed
( | Icon_Theme | : not null access Gtk_Icon_Theme_Record) return Boolean; |
procedure Set_Custom_Theme
( | Icon_Theme | : not null access Gtk_Icon_Theme_Record; |
Theme_Name | : UTF8_String := ""); |
procedure Set_Screen
( | Icon_Theme | : not null access Gtk_Icon_Theme_Record; |
Screen | : not null access Gdk.Screen.Gdk_Screen_Record'Class); |
function Copy
( | Icon_Info | : not null access Gtk_Icon_Info_Record) return Gtk_Icon_Info; |
procedure Free
( | Icon_Info | : not null access Gtk_Icon_Info_Record); |
function Get_Attach_Points
( | Icon_Info | : not null access Gtk_Icon_Info_Record) return Gdk.Types.Gdk_Points_Array; |
function Get_Base_Size
( | Icon_Info | : not null access Gtk_Icon_Info_Record) return Gint; |
function Get_Builtin_Pixbuf
( | Icon_Info | : not null access Gtk_Icon_Info_Record) return Gdk.Pixbuf.Gdk_Pixbuf; |
function Get_Display_Name
( | Icon_Info | : not null access Gtk_Icon_Info_Record) return UTF8_String; |
procedure Get_Embedded_Rect
( | Icon_Info | : not null access Gtk_Icon_Info_Record; |
Rectangle | : out Gdk.Rectangle.Gdk_Rectangle; | |
Has_Embedded_Rectangle | : out Boolean); |
function Get_Filename
( | Icon_Info | : not null access Gtk_Icon_Info_Record) return UTF8_String; |
function Load_Symbolic
( | Icon_Info | : not null access Gtk_Icon_Info_Record; |
Fg | : Gdk.RGBA.Gdk_RGBA; | |
Success_Color | : Gdk.RGBA.Gdk_RGBA; | |
Warning_Color | : Gdk.RGBA.Gdk_RGBA; | |
Error_Color | : Gdk.RGBA.Gdk_RGBA; | |
Was_Symbolic | : access Boolean) return Gdk.Pixbuf.Gdk_Pixbuf; |
function Load_Symbolic_For_Context
( | Icon_Info | : not null access Gtk_Icon_Info_Record; |
Context | : not null access Gtk.Style_Context.Gtk_Style_Context_Record'Class; | |
Was_Symbolic | : access Boolean) return Gdk.Pixbuf.Gdk_Pixbuf; |
function Load_Symbolic_For_Style
( | Icon_Info | : not null access Gtk_Icon_Info_Record; |
Style | : not null access Gtk.Style.Gtk_Style_Record'Class; | |
State | : Gtk.Enums.Gtk_State_Type; | |
Was_Symbolic | : access Boolean) return Gdk.Pixbuf.Gdk_Pixbuf; |
procedure Set_Raw_Coordinates
( | Icon_Info | : not null access Gtk_Icon_Info_Record; |
Raw_Coordinates | : Boolean); |
procedure Add_Builtin_Icon
( | Icon_Name | : UTF8_String; |
Size | : Gint; | |
Pixbuf | : not null access Gdk.Pixbuf.Gdk_Pixbuf_Record'Class); |
function Get_Default return Gtk_Icon_Theme;
function Get_For_Screen
( | Screen | : not null access Gdk.Screen.Gdk_Screen_Record'Class) return Gtk_Icon_Theme; |
procedure On_Changed
( | Self | : not null access Gtk_Icon_Theme_Record; |
Call | : Cb_Gtk_Icon_Theme_Void; | |
After | : Boolean := False); |
procedure On_Changed
( | Self | : not null access Gtk_Icon_Theme_Record; |
Call | : Cb_GObject_Void; | |
Slot | : not null access Glib.Object.GObject_Record'Class; | |
After | : Boolean := False); |
Gtk.Icon_Theme.Gtk_Icon_Theme provides a facility for looking up icons by name and size. The main reason for using a name rather than simply providing a filename is to allow different icons to be used depending on what 'icon theme' is selected by the user. The operation of icon themes on Linux and Unix follows the <ulink url="http://www.freedesktop.org/Standards/icon-theme-spec">Icon Theme Specification</ulink>. There is a default icon theme, named 'hicolor' where applications should install their icons, but more additional application themes can be installed as operating system vendors and users choose.
Named icons are similar to the <xref linkend="gtk3-Themeable-Stock-Images"/> facility, and the distinction between the two may be a bit confusing. A few things to keep in mind: * Stock images usually are used in conjunction with <xref linkend="gtk3-Stock-Items"/>, such as GTK_STOCK_OK or GTK_STOCK_OPEN. Named icons are easier to set up and therefore are more useful for new icons that an application wants to add, such as application icons or window icons. * Stock images can only be loaded at the symbolic sizes defined by the Gtk.Enums.Gtk_Icon_Size enumeration, or by custom sizes defined by Gtk.Icon_Factory.Icon_Size_Register, while named icons are more flexible and any pixel size can be specified. * Because stock images are closely tied to stock items, and thus to actions in the user interface, stock images may come in multiple variants for different widget states or writing directions.
A good rule of thumb is that if there is a stock image for what you want to use, use it, otherwise use a named icon. It turns out that internally stock images are generally defined in terms of one or more named icons. (An example of the more than one case is icons that depend on writing direction; GTK_STOCK_GO_FORWARD uses the two themed icons "gtk-stock-go-forward-ltr" and "gtk-stock-go-forward-rtl".) In many cases, named themes are used indirectly, via Gtk.Image.Gtk_Image or stock items, rather than directly, but looking up icons directly is also simple. The Gtk.Icon_Theme.Gtk_Icon_Theme object acts as a database of all the icons in the current theme. You can create new Gtk.Icon_Theme.Gtk_Icon_Theme objects, but it's much more efficient to use the standard icon theme for the Gdk.Screen.Gdk_Screen so that the icon information is shared with other people looking up icons. In the case where the default screen is being used, looking up an icon can be as simple as: GError *error = NULL; GtkIconTheme *icon_theme; GdkPixbuf *pixbuf; icon_theme = gtk_icon_theme_get_default (); pixbuf = gtk_icon_theme_load_icon (icon_theme, "my-icon-name", // icon name 48, // size 0, // flags &error); if (!pixbuf) { g_warning ("Couldn't load icon: %s", error->message); g_error_free (error); } else { // Use the pixbuf g_object_unref (pixbuf); }