IconFactory
open class IconFactory : GLibObject.Object, IconFactoryProtocol
An icon factory manages a collection of GtkIconSet; a GtkIconSet manages a
set of variants of a particular icon (i.e. a GtkIconSet 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 GtkStyle has a
list of GtkIconFactory 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
GtkIconSizeenum value. This attribute is optional.direction
Direction of the source, a
GtkTextDirectionenum value. This attribute is optional.state
State of the source, a
GtkStateTypeenum value. This attribute is optional.
A GtkIconFactory 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>
The IconFactory type acts as a reference-counted owner of an underlying GtkIconFactory instance.
It provides the methods that can operate on this data type through IconFactoryProtocol conformance.
Use IconFactory as a strong reference or owner of a GtkIconFactory instance.
-
Designated initialiser from the underlying `C` data type.This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the
IconFactoryinstance.Declaration
Swift
@inlinable public init(_ op: UnsafeMutablePointer<GtkIconFactory>)Parameters
oppointer to the underlying object
-
Designated initialiser from a constant pointer to the underlying
Cdata type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theIconFactoryinstance.Declaration
Swift
@inlinable public init(_ op: UnsafePointer<GtkIconFactory>)Parameters
oppointer to the underlying object
-
Optional initialiser from a non-mutating
gpointerto the underlyingCdata type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theIconFactoryinstance.Declaration
Swift
@inlinable override public init!(gpointer op: gpointer?)Parameters
opgpointer to the underlying object
-
Optional initialiser from a non-mutating
gconstpointerto the underlyingCdata type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theIconFactoryinstance.Declaration
Swift
@inlinable override public init!(gconstpointer op: gconstpointer?)Parameters
oppointer to the underlying object
-
Optional initialiser from a constant pointer to the underlying
Cdata type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theIconFactoryinstance.Declaration
Swift
@inlinable public init!(_ op: UnsafePointer<GtkIconFactory>?)Parameters
oppointer to the underlying object
-
Optional initialiser from the underlying
Cdata type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theIconFactoryinstance.Declaration
Swift
@inlinable public init!(_ op: UnsafeMutablePointer<GtkIconFactory>?)Parameters
oppointer to the underlying object
-
Designated initialiser from the underlying
Cdata type. Will retainGtkIconFactory. i.e., ownership is transferred to theIconFactoryinstance.Declaration
Swift
@inlinable public init(retaining op: UnsafeMutablePointer<GtkIconFactory>)Parameters
oppointer to the underlying object
-
Reference intialiser for a related type that implements
IconFactoryProtocolWill retainGtkIconFactory.Declaration
Swift
@inlinable public init<T>(iconFactory other: T) where T : IconFactoryProtocolParameters
otheran instance of a related type that implements
IconFactoryProtocol -
Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
IconFactoryProtocol.Declaration
Swift
@inlinable override public init<T>(cPointer p: UnsafeMutablePointer<T>)Parameters
cPointerpointer to the underlying object
-
Unsafe typed, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
IconFactoryProtocol.Declaration
Swift
@inlinable override public init<T>(retainingCPointer cPointer: UnsafeMutablePointer<T>)Parameters
cPointerpointer to the underlying object
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
IconFactoryProtocol.Declaration
Swift
@inlinable override public init(raw p: UnsafeRawPointer)Parameters
praw pointer to the underlying object
-
Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
IconFactoryProtocol.Declaration
Swift
@inlinable override public init(retainingRaw raw: UnsafeRawPointer) -
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
IconFactoryProtocol.Declaration
Swift
@inlinable public required init(raw p: UnsafeMutableRawPointer)Parameters
pmutable raw pointer to the underlying object
-
Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
IconFactoryProtocol.Declaration
Swift
@inlinable required public init(retainingRaw raw: UnsafeMutableRawPointer)Parameters
rawmutable raw pointer to the underlying object
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
IconFactoryProtocol.Declaration
Swift
@inlinable override public init(opaquePointer p: OpaquePointer)Parameters
popaque pointer to the underlying object
-
Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
IconFactoryProtocol.Declaration
Swift
@inlinable override public init(retainingOpaquePointer p: OpaquePointer)Parameters
popaque pointer to the underlying object
-
Creates a new
GtkIconFactory. An icon factory manages a collection ofGtkIconSets; aGtkIconSetmanages a set of variants of a particular icon (i.e. aGtkIconSetcontains 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. EachGtkStylehas a list ofGtkIconFactorysderived 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 bygtk_icon_factory_add_default()andgtk_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.new is deprecated: Use #GtkIconTheme instead.
Declaration
Swift
@available(*, deprecated) @inlinable public init()
View on GitHub
Install in Dash
IconFactory Class Reference