WidgetPath

open class WidgetPath : WidgetPathProtocol

GtkWidgetPath is a boxed type that represents a widget hierarchy from the topmost widget, typically a toplevel, to any child. This widget path abstraction is used in GtkStyleContext on behalf of the real widget in order to query style information.

If you are using GTK+ widgets, you probably will not need to use this API directly, as there is gtk_widget_get_path(), and the style context returned by gtk_widget_get_style_context() will be automatically updated on widget hierarchy changes.

The widget path generation is generally simple:

Defining a button within a window

(C Language Example):

{
  GtkWidgetPath *path;

  path = gtk_widget_path_new ();
  gtk_widget_path_append_type (path, GTK_TYPE_WINDOW);
  gtk_widget_path_append_type (path, GTK_TYPE_BUTTON);
}

Although more complex information, such as widget names, or different classes (property that may be used by other widget types) and intermediate regions may be included:

Defining the first tab widget in a notebook

(C Language Example):

{
  GtkWidgetPath *path;
  guint pos;

  path = gtk_widget_path_new ();

  pos = gtk_widget_path_append_type (path, GTK_TYPE_NOTEBOOK);
  gtk_widget_path_iter_add_region (path, pos, "tab", GTK_REGION_EVEN | GTK_REGION_FIRST);

  pos = gtk_widget_path_append_type (path, GTK_TYPE_LABEL);
  gtk_widget_path_iter_set_name (path, pos, "first tab label");
}

All this information will be used to match the style information that applies to the described widget.

The WidgetPath type acts as a reference-counted owner of an underlying GtkWidgetPath instance. It provides the methods that can operate on this data type through WidgetPathProtocol conformance. Use WidgetPath as a strong reference or owner of a GtkWidgetPath instance.

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

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

    Declaration

    Swift

    public let ptr: UnsafeMutableRawPointer!
  • Designated initialiser from the underlying C data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the WidgetPath instance.

    Declaration

    Swift

    @inlinable
    public init(_ op: UnsafeMutablePointer<GtkWidgetPath>)

    Parameters

    op

    pointer to the underlying object

  • Designated initialiser from a constant pointer to the underlying C data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the WidgetPath instance.

    Declaration

    Swift

    @inlinable
    public init(_ op: UnsafePointer<GtkWidgetPath>)

    Parameters

    op

    pointer to the underlying object

  • Optional initialiser from a non-mutating gpointer to the underlying C data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the WidgetPath instance.

    Declaration

    Swift

    @inlinable
    public init!(gpointer op: gpointer?)

    Parameters

    op

    gpointer to the underlying object

  • Optional initialiser from a non-mutating gconstpointer to the underlying C data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the WidgetPath instance.

    Declaration

    Swift

    @inlinable
    public init!(gconstpointer op: gconstpointer?)

    Parameters

    op

    pointer to the underlying object

  • Optional initialiser from a constant pointer to the underlying C data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the WidgetPath instance.

    Declaration

    Swift

    @inlinable
    public init!(_ op: UnsafePointer<GtkWidgetPath>?)

    Parameters

    op

    pointer to the underlying object

  • Optional initialiser from the underlying C data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the WidgetPath instance.

    Declaration

    Swift

    @inlinable
    public init!(_ op: UnsafeMutablePointer<GtkWidgetPath>?)

    Parameters

    op

    pointer to the underlying object

  • Designated initialiser from the underlying C data type. Will retain GtkWidgetPath. i.e., ownership is transferred to the WidgetPath instance.

    Declaration

    Swift

    @inlinable
    public init(retaining op: UnsafeMutablePointer<GtkWidgetPath>)

    Parameters

    op

    pointer to the underlying object

  • Reference intialiser for a related type that implements WidgetPathProtocol Will retain GtkWidgetPath.

    Declaration

    Swift

    @inlinable
    public init<T>(_ other: T) where T : WidgetPathProtocol

    Parameters

    other

    an instance of a related type that implements WidgetPathProtocol

  • Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to WidgetPathProtocol.

    Declaration

    Swift

    @inlinable
    public init<T>(cPointer p: UnsafeMutablePointer<T>)

    Parameters

    cPointer

    pointer to the underlying object

  • Unsafe typed, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to WidgetPathProtocol.

    Declaration

    Swift

    @inlinable
    public init<T>(retainingCPointer cPointer: UnsafeMutablePointer<T>)

    Parameters

    cPointer

    pointer to the underlying object

  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to WidgetPathProtocol.

    Declaration

    Swift

    @inlinable
    public init(raw p: UnsafeRawPointer)

    Parameters

    p

    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 WidgetPathProtocol.

    Declaration

    Swift

    @inlinable
    public init(retainingRaw raw: UnsafeRawPointer)
  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to WidgetPathProtocol.

    Declaration

    Swift

    @inlinable
    public required init(raw p: UnsafeMutableRawPointer)

    Parameters

    p

    mutable 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 WidgetPathProtocol.

    Declaration

    Swift

    @inlinable
    public init(retainingRaw raw: UnsafeMutableRawPointer)

    Parameters

    raw

    mutable 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 WidgetPathProtocol.

    Declaration

    Swift

    @inlinable
    public init(opaquePointer p: OpaquePointer)

    Parameters

    p

    opaque 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 WidgetPathProtocol.

    Declaration

    Swift

    @inlinable
    public init(retainingOpaquePointer p: OpaquePointer)

    Parameters

    p

    opaque pointer to the underlying object

  • Returns an empty widget path.

    Declaration

    Swift

    @inlinable
    public init()