type Gtk_Icon_Theme_Record is new Glib.Object.GObject_Record with null record;
type Gtk_Icon_Theme is access all Gtk_Icon_Theme_Record'Class;
type Gtk_Icon_Lookup_Flags is mod Gint'Last;
type Gtk_Icon_Info is new Glib.C_Proxy;
Icon_Lookup_No_Svg : constant Gtk_Icon_Lookup_Flags := 2 ** 0;
Icon_Lookup_Force_Svg : constant Gtk_Icon_Lookup_Flags := 2 ** 1;
Icon_Lookup_Use_Builtin : constant Gtk_Icon_Lookup_Flags := 2 ** 2;
Signal_Changed : constant Glib.Signal_Name := "changed";
function Icon_Info_Get_Type return GType;
function New_For_Pixbuf
( | Icon_Theme | : access Gtk_Icon_Theme_Record; |
Pixbuf | : Gdk.Pixbuf.Gdk_Pixbuf) return Gtk_Icon_Info; |
function Get_Attach_Points
( | Icon_Info | : Gtk_Icon_Info) return Gdk.Types.Gdk_Points_Array; |
function Get_Base_Size
( | Icon_Info | : Gtk_Icon_Info) return Gint; |
function Get_Builtin_Pixbuf
( | Icon_Info | : Gtk_Icon_Info) return Gdk.Pixbuf.Gdk_Pixbuf; |
function Get_Display_Name
( | Icon_Info | : Gtk_Icon_Info) return String; |
procedure Get_Embedded_Rect
( | Icon_Info | : Gtk_Icon_Info; |
Rectangle | : in out Gdk.Rectangle.Gdk_Rectangle; | |
Has_Embedded_Rectangle | : out Boolean); |
function Get_Filename
( | Icon_Info | : Gtk_Icon_Info) return String; |
function Load_Icon
( | Icon_Info | : Gtk_Icon_Info; |
Error | : Glib.Error.GError_Access := null) return Gdk.Pixbuf.Gdk_Pixbuf; |
procedure Set_Raw_Coordinates
( | Icon_Info | : Gtk_Icon_Info; |
Raw_Coordinates | : Boolean); |
procedure Set_Search_Path
( | Icon_Theme | : access Gtk_Icon_Theme_Record; |
Path | : GNAT.Strings.String_List); |
procedure Append_Search_Path
( | Icon_Theme | : access Gtk_Icon_Theme_Record; |
Path | : String); |
procedure Prepend_Search_Path
( | Icon_Theme | : access Gtk_Icon_Theme_Record; |
Path | : String); |
function Get_Search_Path
( | Icon_Theme | : access Gtk_Icon_Theme_Record) return GNAT.Strings.String_List; |
procedure Gtk_New
( | Theme | : out Gtk_Icon_Theme); |
procedure Initialize
( | Theme | : access Gtk_Icon_Theme_Record'Class); |
procedure Add_Builtin_Icon
( | Icon_Name | : String; |
Size | : Gint; | |
Pixbuf | : Gdk.Pixbuf.Gdk_Pixbuf); |
function Choose_Icon
( | Icon_Theme | : access Gtk_Icon_Theme_Record; |
Icon_Names | : GNAT.Strings.String_List; | |
Size | : Gint; | |
Flags | : Gtk_Icon_Lookup_Flags) return Gtk_Icon_Info; |
function Get_Default return Gtk_Icon_Theme;
function Get_Example_Icon_Name
( | Icon_Theme | : access Gtk_Icon_Theme_Record) return String; |
function Get_Icon_Sizes
( | Icon_Theme | : access Gtk_Icon_Theme_Record; |
Icon_Name | : String) return Glib.Gint_Array; |
function Has_Icon
( | Icon_Theme | : access Gtk_Icon_Theme_Record; |
Icon_Name | : String) return Boolean; |
function List_Icons
( | Icon_Theme | : access Gtk_Icon_Theme_Record; |
Context | : String := "") return Gtk.Enums.String_List.Glist; |
function Load_Icon
( | Icon_Theme | : access Gtk_Icon_Theme_Record; |
Icon_Name | : String; | |
Size | : Glib.Gint; | |
Flags | : Gtk_Icon_Lookup_Flags) return Gdk.Pixbuf.Gdk_Pixbuf; |
function Lookup_By_Gicon
( | Icon_Theme | : access Gtk_Icon_Theme_Record; |
Icon | : Glib.G_Icon.G_Icon; | |
Size | : Gint; | |
Flags | : Gtk_Icon_Lookup_Flags) return Gtk_Icon_Info; |
function Lookup_Icon
( | Icon_Theme | : access Gtk_Icon_Theme_Record; |
Icon_Name | : String; | |
Size | : Glib.Gint; | |
Flags | : Gtk_Icon_Lookup_Flags) return Gtk_Icon_Info; |
function Rescan_If_Needed
( | Icon_Theme | : access Gtk_Icon_Theme_Record) return Boolean; |
procedure Set_Custom_Theme
( | Icon_Theme | : access Gtk_Icon_Theme_Record; |
Theme_Name | : String); |
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 selecetd by the user. The operation of icon themes on Linux and Unix follows the Icon Theme Specification. 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 Themeable Stock Images(3) 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 Stock Items(3)., such as STOCK_OK or 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_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; 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 or stock items, rather than directly, but looking up icons directly is also simple.
The Gtk_Icon_Theme object acts as a database of all the icons in the current theme. You can create new Gtk_Icon_Theme objects, but its much more efficient to use the standard icon theme for the 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: Theme := Get_Default; Pixbuf := Load_Icon (Theme, "my-icon-name", 48, 0, Error); if Pixbuf = null then Put_Line ("Error " & Get_Message (Error); Error_Free (Error); end if;
Binding from C File version 2.16.6
<see>Gtk.Icon_Factory</see>