package Implements_Gtk_Buildable is new Glib.Types.Implements (Gtk.Buildable.Gtk_Buildable, Gtk_Icon_Factory_Record, Gtk_Icon_Factory);
type Gtk_Icon_Factory_Record is new GObject_Record with null record;
type Gtk_Icon_Factory is access all Gtk_Icon_Factory_Record'Class;
procedure Gtk_New
( | Self | : out Gtk_Icon_Factory); |
procedure Initialize
( | Self | : not null access Gtk_Icon_Factory_Record'Class); |
function Gtk_Icon_Factory_New return Gtk_Icon_Factory;
function Get_Type return Glib.GType;
procedure Add
( | Self | : not null access Gtk_Icon_Factory_Record; |
Stock_Id | : UTF8_String; | |
Icon_Set | : Gtk.Icon_Set.Gtk_Icon_Set); |
procedure Add_Default
( | Self | : not null access Gtk_Icon_Factory_Record); |
function Lookup
( | Self | : not null access Gtk_Icon_Factory_Record; |
Stock_Id | : UTF8_String) return Gtk.Icon_Set.Gtk_Icon_Set; |
procedure Remove_Default
( | Self | : not null access Gtk_Icon_Factory_Record); |
function Get_Icon_Factory
( | Self | : Gtk.Style_Provider.Gtk_Style_Provider; |
Path | : Gtk.Widget.Gtk_Widget_Path) return Gtk_Icon_Factory; |
function Lookup_Default
( | Stock_Id | : UTF8_String) return Gtk.Icon_Set.Gtk_Icon_Set; |
procedure Icon_Size_Lookup
( | Size | : Gtk.Enums.Gtk_Icon_Size; |
Width | : out Gint; | |
Height | : out Gint; | |
Result | : out Boolean); |
procedure Icon_Size_Lookup_For_Settings
( | Settings | : not null access Gtk.Settings.Gtk_Settings_Record'Class; |
Size | : Gtk.Enums.Gtk_Icon_Size; | |
Width | : out Gint; | |
Height | : out Gint; | |
Result | : out Boolean); |
function Icon_Size_Register
( | Name | : UTF8_String; |
Width | : Gint; | |
Height | : Gint) return Gtk.Enums.Gtk_Icon_Size; |
procedure Icon_Size_Register_Alias
( | Alias | : UTF8_String; |
Target | : Gtk.Enums.Gtk_Icon_Size); |
function "+"
( | Widget | : access Gtk_Icon_Factory_Record'Class) return Gtk.Buildable.Gtk_Buildable renames Implements_Gtk_Buildable.To_Interface; |
function "-"
( | Interf | : Gtk.Buildable.Gtk_Buildable) return Gtk_Icon_Factory renames Implements_Gtk_Buildable.To_Object; |
Browse the available stock icons in the list of stock IDs found <link linkend="gtk-Stock-Items">here</link>. You can also use the <application>gtk-demo</application> application for this purpose.
An icon factory manages a collection of Gtk.Icon_Set.Gtk_Icon_Set; a Gtk.Icon_Set.Gtk_Icon_Set manages a set of variants of a particular icon (i.e. a Gtk.Icon_Set.Gtk_Icon_Set contains variants for different sizes and widget states). Icons in an icon factory are named by a stock ID, which is a simple string identifying the icon. Each Gtk.Style.Gtk_Style has a list of Gtk.Icon_Factory.Gtk_Icon_Factory derived from the current theme; those icon factories are consulted first when searching for an icon. If the theme doesn't set a particular icon, GTK+ looks for the icon in a list of default icon factories, maintained by Gtk.Icon_Factory.Add_Default and Gtk.Icon_Factory.Remove_Default. Applications with icons should add a default icon factory with their icons, which will allow themes to override the icons for the application.
To display an icon, always use gtk_style_lookup_icon_set on the widget that will display the icon, or the convenience function Gtk.Widget.Render_Icon. These functions take the theme into account when looking up the icon to use for a given stock ID. == GtkIconFactory as GtkBuildable == GtkIconFactory supports a custom <sources> element, which can contain multiple <source> elements. The following attributes are allowed: 'stock-id' * The stock id of the source, a string. This attribute is mandatory 'filename' * The filename of the source, a string. This attribute is optional 'icon-name' * The icon name for the source, a string. This attribute is optional. 'size' * Size of the icon, a Gtk.Enums.Gtk_Icon_Size enum value. This attribute is optional. 'direction' * Direction of the source, a Gtk.Enums.Gtk_Text_Direction enum value.
This attribute is optional. 'state' * State of the source, a Gtk.Enums.Gtk_State_Type enum value. This attribute is optional. == A Gtk.Icon_Factory.Gtk_Icon_Factory UI definition fragment. == <object class="GtkIconFactory" id="iconfactory1"> <sources> <source stock-id="apple-red" filename="apple-red.png"/> </sources> </object> <object class="GtkWindow" id="window1"> <child> <object class="GtkButton" id="apple_button"> <property name="label">apple-red</property> <property name="use-stock">True</property> </object> </child> </object>