IconFactoryRef

public struct IconFactoryRef : IconFactoryProtocol, GWeakCapturing

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 GtkIconSize enum value. This attribute is optional.

  • direction

    Direction of the source, a GtkTextDirection enum value. This attribute is optional.

  • state

    State of the source, a GtkStateType enum 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 IconFactoryRef type acts as a lightweight Swift reference to an underlying GtkIconFactory instance. It exposes methods that can operate on this data type through IconFactoryProtocol conformance. Use IconFactoryRef only as an unowned reference to an existing GtkIconFactory instance.

  • ptr
    Untyped pointer to the underlying `GtkIconFactory` instance.
    

    For type-safe access, use the generated, typed pointer icon_factory_ptr property instead.

    Declaration

    Swift

    public let ptr: UnsafeMutableRawPointer!

IconFactory Class

  • Designated initialiser from the underlying C data type

    Declaration

    Swift

    @inlinable
    init(_ p: UnsafeMutablePointer<GtkIconFactory>)
  • Designated initialiser from a constant pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init(_ p: UnsafePointer<GtkIconFactory>)
  • Conditional initialiser from an optional pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init!(_ maybePointer: UnsafeMutablePointer<GtkIconFactory>?)
  • Conditional initialiser from an optional, non-mutable pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init!(_ maybePointer: UnsafePointer<GtkIconFactory>?)
  • Conditional initialiser from an optional gpointer

    Declaration

    Swift

    @inlinable
    init!(gpointer g: gpointer?)
  • Conditional initialiser from an optional, non-mutable gconstpointer

    Declaration

    Swift

    @inlinable
    init!(gconstpointer g: gconstpointer?)
  • Reference intialiser for a related type that implements IconFactoryProtocol

    Declaration

    Swift

    @inlinable
    init<T>(_ other: T) where T : IconFactoryProtocol
  • This factory is syntactic sugar for setting weak pointers wrapped in GWeak<T>

    Declaration

    Swift

    @inlinable
    static func unowned<T>(_ other: T) -> IconFactoryRef where T : IconFactoryProtocol
  • Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to IconFactoryProtocol.

    Declaration

    Swift

    @inlinable
    init<T>(cPointer: UnsafeMutablePointer<T>)
  • Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to IconFactoryProtocol.

    Declaration

    Swift

    @inlinable
    init<T>(constPointer: UnsafePointer<T>)
  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to IconFactoryProtocol.

    Declaration

    Swift

    @inlinable
    init(mutating 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
    init(raw: UnsafeMutableRawPointer)
  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to IconFactoryProtocol.

    Declaration

    Swift

    @inlinable
    init(opaquePointer: OpaquePointer)
  • Creates a new `GtkIconFactory`. An icon factory manages a collection
    

    of GtkIconSets; 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 GtkIconFactorys 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.

    new is deprecated: Use #GtkIconTheme instead.

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    init()