IconSetProtocol
public protocol IconSetProtocol
The IconSetProtocol
protocol exposes the methods and properties of an underlying GtkIconSet
instance.
The default implementation of these can be found in the protocol extension below.
For a concrete class that implements these methods and properties, see IconSet
.
Alternatively, use IconSetRef
as a lighweight, unowned
reference if you already have an instance you just want to use.
-
Untyped pointer to the underlying
GtkIconSet
instance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get }
-
icon_set_ptr
Default implementationTyped pointer to the underlying
GtkIconSet
instance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkIconSet
instance.Declaration
Swift
var icon_set_ptr: UnsafeMutablePointer<GtkIconSet>! { get }
-
Required Initialiser for types conforming to
IconSetProtocol
Declaration
Swift
init(raw: UnsafeMutableRawPointer)
-
add(source:
Extension method) Icon sets have a list of
GtkIconSource
, which they use as base icons for rendering icons in different states and sizes. Icons are scaled, made to look insensitive, etc. ingtk_icon_set_render_icon()
, butGtkIconSet
needs base images to work with. The base images and when to use them are described by aGtkIconSource
.This function copies
source
, so you can reuse the same source immediately without affecting the icon set.An example of when you’d use this function: a web browser’s “Back to Previous Page” icon might point in a different direction in Hebrew and in English; it might look different when insensitive; and it might change size depending on toolbar mode (small/large icons). So a single icon set would contain all those variants of the icon, and you might add a separate source for each one.
You should nearly always add a “default” icon source with all fields wildcarded, which will be used as a fallback if no more specific source matches.
GtkIconSet
always prefers more specific icon sources to more generic icon sources. The order in which you add the sources to the icon set does not matter.gtk_icon_set_new_from_pixbuf()
creates a new icon set with a default icon source based on the given pixbuf.add_source is deprecated: Use #GtkIconTheme instead.
Declaration
Swift
@available(*, deprecated) @inlinable func add<IconSourceT>(source: IconSourceT) where IconSourceT : IconSourceProtocol
-
copy()
Extension methodCopies
icon_set
by value.copy is deprecated: Use #GtkIconTheme instead.
Declaration
Swift
@available(*, deprecated) @inlinable func copy() -> IconSetRef!
-
get(sizes:
Extension methodnSizes: ) Obtains a list of icon sizes this icon set can render. The returned array must be freed with
g_free()
.get_sizes is deprecated: Use #GtkIconTheme instead.
Declaration
Swift
@available(*, deprecated) @inlinable func get(sizes: UnsafeMutablePointer<UnsafeMutablePointer<GtkIconSize>?>!, nSizes: UnsafeMutablePointer<gint>!)
-
ref()
Extension methodIncrements the reference count on
icon_set
.ref is deprecated: Use #GtkIconTheme instead.
Declaration
Swift
@available(*, deprecated) @discardableResult @inlinable func ref() -> IconSetRef!
-
renderIcon(style:
Extension methoddirection: state: size: widget: detail: ) Renders an icon using
gtk_style_render_icon()
. In most cases,gtk_widget_render_icon()
is better, since it automatically provides most of the arguments from the current widget settings. This function never returnsnil
; if the icon can’t be rendered (perhaps because an image file fails to load), a default “missing image” icon will be returned instead.render_icon is deprecated: Use gtk_icon_set_render_icon_pixbuf() instead
Declaration
-
renderIcon(style:
Extension methoddirection: state: size: widget: detail: ) Renders an icon using
gtk_style_render_icon()
. In most cases,gtk_widget_render_icon()
is better, since it automatically provides most of the arguments from the current widget settings. This function never returnsnil
; if the icon can’t be rendered (perhaps because an image file fails to load), a default “missing image” icon will be returned instead.render_icon is deprecated: Use gtk_icon_set_render_icon_pixbuf() instead
Declaration
Swift
@available(*, deprecated) @inlinable func renderIcon<StyleT, WidgetT>(style: StyleT?, direction: GtkTextDirection, state: GtkStateType, size: GtkIconSize, widget: WidgetT?, detail: UnsafePointer<gchar>? = nil) -> PixbufRef! where StyleT : StyleProtocol, WidgetT : WidgetProtocol
-
renderIconPixbuf(context:
Extension methodsize: ) Renders an icon using
gtk_render_icon_pixbuf()
. In most cases,gtk_widget_render_icon_pixbuf()
is better, since it automatically provides most of the arguments from the current widget settings. This function never returnsnil
; if the icon can’t be rendered (perhaps because an image file fails to load), a default “missing image” icon will be returned instead.render_icon_pixbuf is deprecated: Use #GtkIconTheme instead.
Declaration
Swift
@available(*, deprecated) @inlinable func renderIconPixbuf<StyleContextT>(context: StyleContextT, size: GtkIconSize) -> PixbufRef! where StyleContextT : StyleContextProtocol
-
renderIconSurface(context:
Extension methodsize: scale: for: ) Renders an icon using
gtk_render_icon_pixbuf()
and converts it to a cairo surface.This function never returns
nil
; if the icon can’t be rendered (perhaps because an image file fails to load), a default “missing image” icon will be returned instead.render_icon_surface is deprecated: Use #GtkIconTheme instead.
Declaration
Swift
@available(*, deprecated) @inlinable func renderIconSurface<StyleContextT>(context: StyleContextT, size: GtkIconSize, scale: Int, for window: Gdk.WindowRef? = nil) -> Cairo.SurfaceRef! where StyleContextT : StyleContextProtocol
-
renderIconSurface(context:
Extension methodsize: scale: for: ) Renders an icon using
gtk_render_icon_pixbuf()
and converts it to a cairo surface.This function never returns
nil
; if the icon can’t be rendered (perhaps because an image file fails to load), a default “missing image” icon will be returned instead.render_icon_surface is deprecated: Use #GtkIconTheme instead.
Declaration
Swift
@available(*, deprecated) @inlinable func renderIconSurface<StyleContextT, WindowT>(context: StyleContextT, size: GtkIconSize, scale: Int, for window: WindowT?) -> Cairo.SurfaceRef! where StyleContextT : StyleContextProtocol, WindowT : WindowProtocol
-
unref()
Extension methodDecrements the reference count on
icon_set
, and frees memory if the reference count reaches 0.unref is deprecated: Use #GtkIconTheme instead.
Declaration
Swift
@available(*, deprecated) @inlinable func unref()