StyleContextProtocol

public protocol StyleContextProtocol : ObjectProtocol

GtkStyleContext is an object that stores styling information affecting a widget defined by GtkWidgetPath.

In order to construct the final style information, GtkStyleContext queries information from all attached GtkStyleProviders. Style providers can be either attached explicitly to the context through gtk_style_context_add_provider(), or to the screen through gtk_style_context_add_provider_for_screen(). The resulting style is a combination of all providers’ information in priority order.

For GTK+ widgets, any GtkStyleContext returned by gtk_widget_get_style_context() will already have a GtkWidgetPath, a GdkScreen and RTL/LTR information set. The style context will also be updated automatically if any of these settings change on the widget.

If you are using the theming layer standalone, you will need to set a widget path and a screen yourself to the created style context through gtk_style_context_set_path() and possibly gtk_style_context_set_screen(). See the “Foreign drawing“ example in gtk3-demo.

Style Classes #

Widgets can add style classes to their context, which can be used to associate different styles by class. The documentation for individual widgets lists which style classes it uses itself, and which style classes may be added by applications to affect their appearance.

GTK+ defines macros for a number of style classes.

Style Regions

Widgets can also add regions with flags to their context. This feature is deprecated and will be removed in a future GTK+ update. Please use style classes instead.

GTK+ defines macros for a number of style regions.

Custom styling in UI libraries and applications

If you are developing a library with custom GtkWidgets that render differently than standard components, you may need to add a GtkStyleProvider yourself with the GTK_STYLE_PROVIDER_PRIORITY_FALLBACK priority, either a GtkCssProvider or a custom object implementing the GtkStyleProvider interface. This way themes may still attempt to style your UI elements in a different way if needed so.

If you are using custom styling on an applications, you probably want then to make your style information prevail to the theme’s, so you must use a GtkStyleProvider with the GTK_STYLE_PROVIDER_PRIORITY_APPLICATION priority, keep in mind that the user settings in XDG_CONFIG_HOME/gtk-3.0/gtk.css will still take precedence over your changes, as it uses the GTK_STYLE_PROVIDER_PRIORITY_USER priority.

The StyleContextProtocol protocol exposes the methods and properties of an underlying GtkStyleContext 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 StyleContext. Alternatively, use StyleContextRef as a lighweight, unowned reference if you already have an instance you just want to use.

  • ptr

    Untyped pointer to the underlying GtkStyleContext instance.

    Declaration

    Swift

    var ptr: UnsafeMutableRawPointer! { get }
  • style_context_ptr Default implementation

    Typed pointer to the underlying GtkStyleContext instance.

    Default Implementation

    Return the stored, untyped pointer as a typed pointer to the GtkStyleContext instance.

    Declaration

    Swift

    var style_context_ptr: UnsafeMutablePointer<GtkStyleContext>! { get }
  • Required Initialiser for types conforming to StyleContextProtocol

    Declaration

    Swift

    init(raw: UnsafeMutableRawPointer)

StyleContext Class

  • Bind a StyleContextPropertyName source property to a given target object.

    Declaration

    Swift

    @discardableResult
    @inlinable
    func bind<Q, T>(property source_property: StyleContextPropertyName, to target: T, _ target_property: Q, flags f: BindingFlags = .default, transformFrom transform_from: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }, transformTo transform_to: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }) -> BindingRef! where Q : PropertyNameProtocol, T : ObjectProtocol

    Parameters

    source_property

    the source property to bind

    target

    the target object to bind to

    target_property

    the target property to bind to

    flags

    the flags to pass to the Binding

    transform_from

    ValueTransformer to use for forward transformation

    transform_to

    ValueTransformer to use for backwards transformation

    Return Value

    binding reference or nil in case of an error

  • get(property:) Extension method

    Get the value of a StyleContext property

    Declaration

    Swift

    @inlinable
    func get(property: StyleContextPropertyName) -> GLibObject.Value

    Parameters

    property

    the property to get the value for

    Return Value

    the value of the named property

  • set(property:value:) Extension method

    Set the value of a StyleContext property. Note that this will only have an effect on properties that are writable and not construct-only!

    Declaration

    Swift

    @inlinable
    func set(property: StyleContextPropertyName, value v: GLibObject.Value)

    Parameters

    property

    the property to get the value for

    Return Value

    the value of the named property

StyleContext signals

  • Connect a Swift signal handler to the given, typed StyleContextSignalName signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func connect(signal s: StyleContextSignalName, flags f: ConnectFlags = ConnectFlags(0), handler h: @escaping SignalHandler) -> Int

    Parameters

    signal

    The signal to connect

    flags

    The connection flags to use

    data

    A pointer to user data to provide to the callback

    destroyData

    A GClosureNotify C function to destroy the data pointed to by userData

    handler

    The Swift signal handler (function or callback) to invoke on the given signal

    Return Value

    The signal handler ID (always greater than 0 for successful connections)

  • Connect a C signal handler to the given, typed StyleContextSignalName signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func connect(signal s: StyleContextSignalName, flags f: ConnectFlags = ConnectFlags(0), data userData: gpointer!, destroyData destructor: GClosureNotify? = nil, signalHandler h: @escaping GCallback) -> Int

    Parameters

    signal

    The signal to connect

    flags

    The connection flags to use

    data

    A pointer to user data to provide to the callback

    destroyData

    A GClosureNotify C function to destroy the data pointed to by userData

    signalHandler

    The C function to be called on the given signal

    Return Value

    The signal handler ID (always greater than 0 for successful connections)

  • onChanged(flags:handler:) Extension method

    The changed signal is emitted when there is a change in the GtkStyleContext.

    For a GtkStyleContext returned by gtk_widget_get_style_context(), the GtkWidget::style-updated signal/vfunc might be more convenient to use.

    This signal is useful when using the theming layer standalone.

    Note

    This represents the underlying changed signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onChanged(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: StyleContextRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    handler

    The signal handler to call Run the given callback whenever the changed signal is emitted

  • changedSignal Extension method

    Typed changed signal for using the connect(signal:) methods

    Declaration

    Swift

    static var changedSignal: StyleContextSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this:

    (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::direction signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyDirection(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: StyleContextRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

    The signal handler to call Run the given callback whenever the notifyDirection signal is emitted

  • notifyDirectionSignal Extension method

    Typed notify::direction signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyDirectionSignal: StyleContextSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this:

    (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::paint-clock signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyPaintClock(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: StyleContextRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

    The signal handler to call Run the given callback whenever the notifyPaintClock signal is emitted

  • notifyPaintClockSignal Extension method

    Typed notify::paint-clock signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyPaintClockSignal: StyleContextSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this:

    (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::parent signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyParent(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: StyleContextRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

    The signal handler to call Run the given callback whenever the notifyParent signal is emitted

  • notifyParentSignal Extension method

    Typed notify::parent signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyParentSignal: StyleContextSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this:

    (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::screen signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyScreen(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: StyleContextRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

    The signal handler to call Run the given callback whenever the notifyScreen signal is emitted

  • notifyScreenSignal Extension method

    Typed notify::screen signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyScreenSignal: StyleContextSignalName { get }

StyleContext Class: StyleContextProtocol extension (methods and fields)

  • addClass(className:) Extension method

    Adds a style class to context, so posterior calls to gtk_style_context_get() or any of the gtk_render_*() functions will make use of this new class for styling.

    In the CSS file format, a GtkEntry defining a “search” class, would be matched by:

    (CSS Language Example):

    entry.search { ... }
    

    While any widget defining a “search” class would be matched by: (CSS Language Example):

    .search { ... }
    

    Declaration

    Swift

    @inlinable
    func addClass(className: UnsafePointer<gchar>!)
  • add(provider:priority:) Extension method

    Adds a style provider to context, to be used in style construction. Note that a style provider added by this function only affects the style of the widget to which context belongs. If you want to affect the style of all widgets, use gtk_style_context_add_provider_for_screen().

    Note: If both priorities are the same, a GtkStyleProvider added through this function takes precedence over another added through gtk_style_context_add_provider_for_screen().

    Declaration

    Swift

    @inlinable
    func add<StyleProviderT>(provider: StyleProviderT, priority: Int) where StyleProviderT : StyleProviderProtocol
  • addRegion(regionName:flags:) Extension method

    Adds a region to context, so posterior calls to gtk_style_context_get() or any of the gtk_render_*() functions will make use of this new region for styling.

    In the CSS file format, a GtkTreeView defining a “row” region, would be matched by:

    (CSS Language Example):

    treeview row { ... }
    

    Pseudo-classes are used for matching flags, so the two following rules: (CSS Language Example):

    treeview row:nth-child(even) { ... }
    treeview row:nth-child(odd) { ... }
    

    would apply to even and odd rows, respectively.

    Region names must only contain lowercase letters and “-”, starting always with a lowercase letter.

    add_region is deprecated: This method is deprecated.

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func addRegion(regionName: UnsafePointer<gchar>!, flags: RegionFlags)
  • cancelAnimations(regionID:) Extension method

    Stops all running animations for region_id and all animatable regions underneath.

    A nil region_id will stop all ongoing animations in context, when dealing with a GtkStyleContext obtained through gtk_widget_get_style_context(), this is normally done for you in all circumstances you would expect all widget to be stopped, so this should be only used in complex widgets with different animatable regions.

    cancel_animations is deprecated: This function does nothing.

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func cancelAnimations(regionID: gpointer! = nil)
  • Gets the background color for a given state.

    This function is far less useful than it seems, and it should not be used in newly written code. CSS has no concept of “background color”, as a background can be an image, or a gradient, or any other pattern including solid colors.

    The only reason why you would call gtk_style_context_get_background_color() is to use the returned value to draw the background with it; the correct way to achieve this result is to use gtk_render_background() instead, along with CSS style classes to modify the color to be rendered.

    get_background_color is deprecated: Use gtk_render_background() instead.

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func getBackgroundColor<RGBAT>(state: StateFlags, color: RGBAT) where RGBAT : RGBAProtocol
  • getBorder(state:border:) Extension method

    Gets the border for a given state as a GtkBorder.

    See gtk_style_context_get_property() and GTK_STYLE_PROPERTY_BORDER_WIDTH for details.

    Declaration

    Swift

    @inlinable
    func getBorder<BorderT>(state: StateFlags, border: BorderT) where BorderT : BorderProtocol
  • getBorderColor(state:color:) Extension method

    Gets the border color for a given state.

    get_border_color is deprecated: Use gtk_render_frame() instead.

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func getBorderColor<RGBAT>(state: StateFlags, color: RGBAT) where RGBAT : RGBAProtocol
  • getColor(state:color:) Extension method

    Gets the foreground color for a given state.

    See gtk_style_context_get_property() and GTK_STYLE_PROPERTY_COLOR for details.

    Declaration

    Swift

    @inlinable
    func getColor<RGBAT>(state: StateFlags, color: RGBAT) where RGBAT : RGBAProtocol
  • getDirection() Extension method

    Returns the widget direction used for rendering.

    get_direction is deprecated: Use gtk_style_context_get_state() and check for #GTK_STATE_FLAG_DIR_LTR and #GTK_STATE_FLAG_DIR_RTL instead.

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func getDirection() -> GtkTextDirection
  • getFont(state:) Extension method

    Returns the font description for a given state. The returned object is const and will remain valid until the GtkStyleContext::changed signal happens.

    get_font is deprecated: Use gtk_style_context_get() for “font” or subproperties instead.

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func getFont(state: StateFlags) -> Pango.FontDescriptionRef!
  • getFrameClock() Extension method

    Returns the GdkFrameClock to which context is attached.

    Declaration

    Swift

    @inlinable
    func getFrameClock() -> Gdk.FrameClockRef!
  • getJunctionSides() Extension method

    Returns the sides where rendered elements connect visually with others.

    Declaration

    Swift

    @inlinable
    func getJunctionSides() -> JunctionSides
  • getMargin(state:margin:) Extension method

    Gets the margin for a given state as a GtkBorder. See gtk_style_property_get() and GTK_STYLE_PROPERTY_MARGIN for details.

    Declaration

    Swift

    @inlinable
    func getMargin<BorderT>(state: StateFlags, margin: BorderT) where BorderT : BorderProtocol
  • getPadding(state:padding:) Extension method

    Gets the padding for a given state as a GtkBorder. See gtk_style_context_get() and GTK_STYLE_PROPERTY_PADDING for details.

    Declaration

    Swift

    @inlinable
    func getPadding<BorderT>(state: StateFlags, padding: BorderT) where BorderT : BorderProtocol
  • getParent() Extension method

    Gets the parent context set via gtk_style_context_set_parent(). See that function for details.

    Declaration

    Swift

    @inlinable
    func getParent() -> StyleContextRef!
  • getPath() Extension method

    Returns the widget path used for style matching.

    Declaration

    Swift

    @inlinable
    func getPath() -> WidgetPathRef!
  • get(property:state:value:) Extension method

    Gets a style property from context for the given state.

    Note that not all CSS properties that are supported by GTK+ can be retrieved in this way, since they may not be representable as GValue. GTK+ defines macros for a number of properties that can be used with this function.

    Note that passing a state other than the current state of context is not recommended unless the style context has been saved with gtk_style_context_save().

    When value is no longer needed, g_value_unset() must be called to free any allocated memory.

    Declaration

    Swift

    @inlinable
    func get<ValueT>(property: UnsafePointer<gchar>!, state: StateFlags, value: ValueT) where ValueT : ValueProtocol
  • getScale() Extension method

    Returns the scale used for assets.

    Declaration

    Swift

    @inlinable
    func getScale() -> Int
  • getScreen() Extension method

    Returns the GdkScreen to which context is attached.

    Declaration

    Swift

    @inlinable
    func getScreen() -> Gdk.ScreenRef!
  • getSection(property:) Extension method

    Queries the location in the CSS where property was defined for the current context. Note that the state to be queried is taken from gtk_style_context_get_state().

    If the location is not available, nil will be returned. The location might not be available for various reasons, such as the property being overridden, property not naming a supported CSS property or tracking of definitions being disabled for performance reasons.

    Shorthand CSS properties cannot be queried for a location and will always return nil.

    Declaration

    Swift

    @inlinable
    func getSection(property: UnsafePointer<gchar>!) -> CssSectionRef!
  • getState() Extension method

    Returns the state used for style matching.

    This method should only be used to retrieve the GtkStateFlags to pass to GtkStyleContext methods, like gtk_style_context_get_padding(). If you need to retrieve the current state of a GtkWidget, use gtk_widget_get_state_flags().

    Declaration

    Swift

    @inlinable
    func getState() -> StateFlags
  • Gets the value for a widget style property.

    When value is no longer needed, g_value_unset() must be called to free any allocated memory.

    Declaration

    Swift

    @inlinable
    func getStyleProperty<ValueT>(propertyName: UnsafePointer<gchar>!, value: ValueT) where ValueT : ValueProtocol
  • getStyleValist(args:) Extension method

    Retrieves several widget style properties from context according to the current style.

    Declaration

    Swift

    @inlinable
    func getStyleValist(args: CVaListPointer)
  • getValist(state:args:) Extension method

    Retrieves several style property values from context for a given state.

    See gtk_style_context_get_property() for details.

    Declaration

    Swift

    @inlinable
    func getValist(state: StateFlags, args: CVaListPointer)
  • hasClass(className:) Extension method

    Returns true if context currently has defined the given class name.

    Declaration

    Swift

    @inlinable
    func hasClass(className: UnsafePointer<gchar>!) -> Bool
  • Returns true if context has the region defined. If flags_return is not nil, it is set to the flags affecting the region.

    has_region is deprecated: This method is deprecated.

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func hasRegion(regionName: UnsafePointer<gchar>!, flagsReturn: UnsafeMutablePointer<GtkRegionFlags>! = nil) -> Bool
  • invalidate() Extension method

    Invalidates context style information, so it will be reconstructed again. It is useful if you modify the context and need the new information immediately.

    invalidate is deprecated: Style contexts are invalidated automatically.

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func invalidate()
  • listClasses() Extension method

    Returns the list of classes currently defined in context.

    Declaration

    Swift

    @inlinable
    func listClasses() -> GLib.ListRef!
  • listRegions() Extension method

    Returns the list of regions currently defined in context.

    list_regions is deprecated: This method is deprecated.

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func listRegions() -> GLib.ListRef!
  • Looks up and resolves a color name in the context color map.

    Declaration

    Swift

    @inlinable
    func lookupColor<RGBAT>(colorName: UnsafePointer<gchar>!, color: RGBAT) -> Bool where RGBAT : RGBAProtocol
  • lookupIconSet(stockID:) Extension method

    Looks up stock_id in the icon factories associated to context and the default icon factory, returning an icon set if found, otherwise nil.

    lookup_icon_set is deprecated: Use gtk_icon_theme_lookup_icon() instead.

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func lookupIconSet(stockID: UnsafePointer<gchar>!) -> IconSetRef!
  • Notifies a state change on context, so if the current style makes use of transition animations, one will be started so all rendered elements under region_id are animated for state state being set to value state_value.

    The window parameter is used in order to invalidate the rendered area as the animation runs, so make sure it is the same window that is being rendered on by the gtk_render_*() functions.

    If region_id is nil, all rendered elements using context will be affected by this state transition.

    As a practical example, a GtkButton notifying a state transition on the prelight state: (C Language Example):

    gtk_style_context_notify_state_change (context,
                                           gtk_widget_get_window (widget),
                                           NULL,
                                           GTK_STATE_PRELIGHT,
                                           button->in_button);
    

    Can be handled in the CSS file like this: (CSS Language Example):

    button {
        background-color: #f00
    }
    
    button:hover {
        background-color: #fff;
        transition: 200ms linear
    }
    

    This combination will animate the button background from red to white if a pointer enters the button, and back to red if the pointer leaves the button.

    Note that state is used when finding the transition parameters, which is why the style places the transition under the :hover pseudo-class.

    notify_state_change is deprecated: This function does nothing.

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func notifyStateChange<WindowT>(window: WindowT, regionID: gpointer! = nil, state: GtkStateType, stateValue: Bool) where WindowT : WindowProtocol
  • popAnimatableRegion() Extension method

    Pops an animatable region from context. See gtk_style_context_push_animatable_region().

    pop_animatable_region is deprecated: This function does nothing.

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func popAnimatableRegion()
  • Pushes an animatable region, so all further gtk_render_*() calls between this call and the following gtk_style_context_pop_animatable_region() will potentially show transition animations for this region if gtk_style_context_notify_state_change() is called for a given state, and the current theme/style defines transition animations for state changes.

    The region_id used must be unique in context so the themes can uniquely identify rendered elements subject to a state transition.

    push_animatable_region is deprecated: This function does nothing.

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func pushAnimatableRegion(regionID: gpointer! = nil)
  • removeClass(className:) Extension method

    Removes class_name from context.

    Declaration

    Swift

    @inlinable
    func removeClass(className: UnsafePointer<gchar>!)
  • remove(provider:) Extension method

    Removes provider from the style providers list in context.

    Declaration

    Swift

    @inlinable
    func remove<StyleProviderT>(provider: StyleProviderT) where StyleProviderT : StyleProviderProtocol
  • removeRegion(regionName:) Extension method

    Removes a region from context.

    remove_region is deprecated: This method is deprecated.

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func removeRegion(regionName: UnsafePointer<gchar>!)
  • restore() Extension method

    Restores context state to a previous stage. See gtk_style_context_save().

    Declaration

    Swift

    @inlinable
    func restore()
  • save() Extension method

    Saves the context state, so temporary modifications done through gtk_style_context_add_class(), gtk_style_context_remove_class(), gtk_style_context_set_state(), etc. can quickly be reverted in one go through gtk_style_context_restore().

    The matching call to gtk_style_context_restore() must be done before GTK returns to the main loop.

    Declaration

    Swift

    @inlinable
    func save()
  • This function is analogous to gdk_window_scroll(), and should be called together with it so the invalidation areas for any ongoing animation are scrolled together with it.

    scroll_animations is deprecated: This function does nothing.

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func scrollAnimations<WindowT>(window: WindowT, dx: Int, dy: Int) where WindowT : WindowProtocol
  • setBackground(window:) Extension method

    Sets the background of window to the background pattern or color specified in context for its current state.

    set_background is deprecated: Use gtk_render_background() instead. Note that clients still using this function are now responsible for calling this function again whenever @context is invalidated.

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func setBackground<WindowT>(window: WindowT) where WindowT : WindowProtocol
  • set(direction:) Extension method

    Sets the reading direction for rendering purposes.

    If you are using a GtkStyleContext returned from gtk_widget_get_style_context(), you do not need to call this yourself.

    set_direction is deprecated: Use gtk_style_context_set_state() with #GTK_STATE_FLAG_DIR_LTR and #GTK_STATE_FLAG_DIR_RTL instead.

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func set(direction: GtkTextDirection)
  • set(frameClock:) Extension method

    Attaches context to the given frame clock.

    The frame clock is used for the timing of animations.

    If you are using a GtkStyleContext returned from gtk_widget_get_style_context(), you do not need to call this yourself.

    Declaration

    Swift

    @inlinable
    func set<FrameClockT>(frameClock: FrameClockT) where FrameClockT : FrameClockProtocol
  • setJunction(sides:) Extension method

    Sets the sides where rendered elements (mostly through gtk_render_frame()) will visually connect with other visual elements.

    This is merely a hint that may or may not be honored by themes.

    Container widgets are expected to set junction hints as appropriate for their children, so it should not normally be necessary to call this function manually.

    Declaration

    Swift

    @inlinable
    func setJunction(sides: JunctionSides)
  • set(parent:) Extension method

    Sets the parent style context for context. The parent style context is used to implement inheritance of properties.

    If you are using a GtkStyleContext returned from gtk_widget_get_style_context(), the parent will be set for you.

    Declaration

    Swift

    @inlinable
    func set(parent: StyleContextRef? = nil)
  • set(parent:) Extension method

    Sets the parent style context for context. The parent style context is used to implement inheritance of properties.

    If you are using a GtkStyleContext returned from gtk_widget_get_style_context(), the parent will be set for you.

    Declaration

    Swift

    @inlinable
    func set<StyleContextT>(parent: StyleContextT?) where StyleContextT : StyleContextProtocol
  • set(path:) Extension method

    Sets the GtkWidgetPath used for style matching. As a consequence, the style will be regenerated to match the new given path.

    If you are using a GtkStyleContext returned from gtk_widget_get_style_context(), you do not need to call this yourself.

    Declaration

    Swift

    @inlinable
    func set<WidgetPathT>(path: WidgetPathT) where WidgetPathT : WidgetPathProtocol
  • set(scale:) Extension method

    Sets the scale to use when getting image assets for the style.

    Declaration

    Swift

    @inlinable
    func set(scale: Int)
  • set(screen:) Extension method

    Attaches context to the given screen.

    The screen is used to add style information from “global” style providers, such as the screen’s GtkSettings instance.

    If you are using a GtkStyleContext returned from gtk_widget_get_style_context(), you do not need to call this yourself.

    Declaration

    Swift

    @inlinable
    func set<ScreenT>(screen: ScreenT) where ScreenT : ScreenProtocol
  • setState(flags:) Extension method

    Sets the state to be used for style matching.

    Declaration

    Swift

    @inlinable
    func setState(flags: StateFlags)
  • Returns true if there is a transition animation running for the current region (see gtk_style_context_push_animatable_region()).

    If progress is not nil, the animation progress will be returned there, 0.0 means the state is closest to being unset, while 1.0 means it’s closest to being set. This means transition animation will run from 0 to 1 when state is being set and from 1 to 0 when it’s being unset.

    state_is_running is deprecated: This function always returns %FALSE

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func stateIsRunning(state: GtkStateType, progress: UnsafeMutablePointer<gdouble>!) -> Bool
  • toString(flags:) Extension method

    Converts the style context into a string representation.

    The string representation always includes information about the name, state, id, visibility and style classes of the CSS node that is backing context. Depending on the flags, more information may be included.

    This function is intended for testing and debugging of the CSS implementation in GTK+. There are no guarantees about the format of the returned string, it may change.

    Declaration

    Swift

    @inlinable
    func toString(flags: StyleContextPrintFlags) -> String!
  • Renders an activity indicator (such as in GtkSpinner). The state GTK_STATE_FLAG_CHECKED determines whether there is activity going on.

    Declaration

    Swift

    @inlinable
    func renderActivity<ContextT>(cr: ContextT, x: Double, y: Double, width: Double, height: Double) where ContextT : ContextProtocol
  • Renders an arrow pointing to angle.

    Typical arrow rendering at 0, 1⁄2 π;, π; and 3⁄2 π:

    Declaration

    Swift

    @inlinable
    func renderArrow<ContextT>(cr: ContextT, angle: Double, x: Double, y: Double, size: Double) where ContextT : ContextProtocol
  • Renders the background of an element.

    Typical background rendering, showing the effect of background-image, border-width and border-radius:

    Declaration

    Swift

    @inlinable
    func renderBackground<ContextT>(cr: ContextT, x: Double, y: Double, width: Double, height: Double) where ContextT : ContextProtocol
  • Returns the area that will be affected (i.e. drawn to) when calling gtk_render_background() for the given context and rectangle.

    Declaration

    Swift

    @inlinable
    func renderBackgroundGetClip<RectangleT>(x: Double, y: Double, width: Double, height: Double, outClip: RectangleT) where RectangleT : RectangleProtocol
  • Renders a checkmark (as in a GtkCheckButton).

    The GTK_STATE_FLAG_CHECKED state determines whether the check is on or off, and GTK_STATE_FLAG_INCONSISTENT determines whether it should be marked as undefined.

    Typical checkmark rendering:

    Declaration

    Swift

    @inlinable
    func renderCheck<ContextT>(cr: ContextT, x: Double, y: Double, width: Double, height: Double) where ContextT : ContextProtocol
  • Renders an expander (as used in GtkTreeView and GtkExpander) in the area defined by x, y, width, height. The state GTK_STATE_FLAG_CHECKED determines whether the expander is collapsed or expanded.

    Typical expander rendering:

    Declaration

    Swift

    @inlinable
    func renderExpander<ContextT>(cr: ContextT, x: Double, y: Double, width: Double, height: Double) where ContextT : ContextProtocol
  • Renders a extension (as in a GtkNotebook tab) in the rectangle defined by x, y, width, height. The side where the extension connects to is defined by gap_side.

    Typical extension rendering:

    Declaration

    Swift

    @inlinable
    func renderExtension<ContextT>(cr: ContextT, x: Double, y: Double, width: Double, height: Double, gapSide: GtkPositionType) where ContextT : ContextProtocol
  • Renders a focus indicator on the rectangle determined by x, y, width, height.

    Typical focus rendering:

    Declaration

    Swift

    @inlinable
    func renderFocus<ContextT>(cr: ContextT, x: Double, y: Double, width: Double, height: Double) where ContextT : ContextProtocol
  • Renders a frame around the rectangle defined by x, y, width, height.

    Examples of frame rendering, showing the effect of border-image, border-color, border-width, border-radius and junctions:

    Declaration

    Swift

    @inlinable
    func renderFrame<ContextT>(cr: ContextT, x: Double, y: Double, width: Double, height: Double) where ContextT : ContextProtocol
  • Renders a frame around the rectangle defined by (x, y, width, height), leaving a gap on one side. xy0_gap and xy1_gap will mean X coordinates for GTK_POS_TOP and GTK_POS_BOTTOM gap sides, and Y coordinates for GTK_POS_LEFT and GTK_POS_RIGHT.

    Typical rendering of a frame with a gap:

    render_frame_gap is deprecated: Use gtk_render_frame() instead. Themes can create gaps by omitting borders via CSS.

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func renderFrameGap<ContextT>(cr: ContextT, x: Double, y: Double, width: Double, height: Double, gapSide: GtkPositionType, xy0Gap: Double, xy1Gap: Double) where ContextT : ContextProtocol
  • Renders a handle (as in GtkHandleBox, GtkPaned and GtkWindow’s resize grip), in the rectangle determined by x, y, width, height.

    Handles rendered for the paned and grip classes:

    Declaration

    Swift

    @inlinable
    func renderHandle<ContextT>(cr: ContextT, x: Double, y: Double, width: Double, height: Double) where ContextT : ContextProtocol
  • renderIcon(cr:pixbuf:x:y:) Extension method

    Renders the icon in pixbuf at the specified x and y coordinates.

    This function will render the icon in pixbuf at exactly its size, regardless of scaling factors, which may not be appropriate when drawing on displays with high pixel densities.

    You probably want to use gtk_render_icon_surface() instead, if you already have a Cairo surface.

    Declaration

    Swift

    @inlinable
    func renderIcon<ContextT, PixbufT>(cr: ContextT, pixbuf: PixbufT, x: Double, y: Double) where ContextT : ContextProtocol, PixbufT : PixbufProtocol
  • Renders the icon specified by source at the given size, returning the result in a pixbuf.

    render_icon_pixbuf is deprecated: Use gtk_icon_theme_load_icon() instead.

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    func renderIconPixbuf<IconSourceT>(source: IconSourceT, size: GtkIconSize) -> PixbufRef! where IconSourceT : IconSourceProtocol
  • Renders the icon in surface at the specified x and y coordinates.

    Declaration

    Swift

    @inlinable
    func renderIconSurface<ContextT, SurfaceT>(cr: ContextT, surface: SurfaceT, x: Double, y: Double) where ContextT : ContextProtocol, SurfaceT : SurfaceProtocol
  • Draws a text caret on cr at the specified index of layout.

    Declaration

    Swift

    @inlinable
    func renderInsertionCursor<ContextT, LayoutT>(cr: ContextT, x: Double, y: Double, layout: LayoutT, index: Int, direction: PangoDirection) where ContextT : ContextProtocol, LayoutT : LayoutProtocol
  • renderLayout(cr:x:y:layout:) Extension method

    Renders layout on the coordinates x, y

    Declaration

    Swift

    @inlinable
    func renderLayout<ContextT, LayoutT>(cr: ContextT, x: Double, y: Double, layout: LayoutT) where ContextT : ContextProtocol, LayoutT : LayoutProtocol
  • renderLine(cr:x0:y0:x1:y1:) Extension method

    Renders a line from (x0, y0) to (x1, y1).

    Declaration

    Swift

    @inlinable
    func renderLine<ContextT>(cr: ContextT, x0: Double, y0: Double, x1: Double, y1: Double) where ContextT : ContextProtocol
  • Renders an option mark (as in a GtkRadioButton), the GTK_STATE_FLAG_CHECKED state will determine whether the option is on or off, and GTK_STATE_FLAG_INCONSISTENT whether it should be marked as undefined.

    Typical option mark rendering:

    Declaration

    Swift

    @inlinable
    func renderOption<ContextT>(cr: ContextT, x: Double, y: Double, width: Double, height: Double) where ContextT : ContextProtocol
  • Renders a slider (as in GtkScale) in the rectangle defined by x, y, width, height. orientation defines whether the slider is vertical or horizontal.

    Typical slider rendering:

    Declaration

    Swift

    @inlinable
    func renderSlider<ContextT>(cr: ContextT, x: Double, y: Double, width: Double, height: Double, orientation: GtkOrientation) where ContextT : ContextProtocol
  • direction Extension method

    Undocumented

    Declaration

    Swift

    @inlinable
    var direction: GtkTextDirection { get nonmutating set }
  • frameClock Extension method

    Returns the GdkFrameClock to which context is attached.

    Declaration

    Swift

    @inlinable
    var frameClock: Gdk.FrameClockRef! { get nonmutating set }
  • junctionSides Extension method

    Returns the sides where rendered elements connect visually with others.

    Declaration

    Swift

    @inlinable
    var junctionSides: JunctionSides { get nonmutating set }
  • parent Extension method

    Sets or gets the style context’s parent. See gtk_style_context_set_parent() for details.

    Declaration

    Swift

    @inlinable
    var parent: StyleContextRef! { get nonmutating set }
  • path Extension method

    Returns the widget path used for style matching.

    Declaration

    Swift

    @inlinable
    var path: WidgetPathRef! { get nonmutating set }
  • scale Extension method

    Returns the scale used for assets.

    Declaration

    Swift

    @inlinable
    var scale: Int { get nonmutating set }
  • screen Extension method

    Undocumented

    Declaration

    Swift

    @inlinable
    var screen: Gdk.ScreenRef! { get nonmutating set }
  • state Extension method

    Returns the state used for style matching.

    This method should only be used to retrieve the GtkStateFlags to pass to GtkStyleContext methods, like gtk_style_context_get_padding(). If you need to retrieve the current state of a GtkWidget, use gtk_widget_get_state_flags().

    Declaration

    Swift

    @inlinable
    var state: StateFlags { get nonmutating set }
  • parentObject Extension method

    Undocumented

    Declaration

    Swift

    @inlinable
    var parentObject: GObject { get }