CtkStyleProvider

CtkStyleProvider — Interface to provide style information to CtkStyleContext

Functions

Types and Values

Object Hierarchy

    GInterface
    ╰── CtkStyleProvider

Known Implementations

CtkStyleProvider is implemented by CtkCssProvider and CtkSettings.

Includes

#include <ctk/ctk.h>

Description

CtkStyleProvider is an interface used to provide style information to a CtkStyleContext. See ctk_style_context_add_provider() and ctk_style_context_add_provider_for_screen().

Functions

ctk_style_provider_get_icon_factory ()

CtkIconFactory *
ctk_style_provider_get_icon_factory (CtkStyleProvider *provider,
                                     CtkWidgetPath *path);

ctk_style_provider_get_icon_factory has been deprecated since version 3.8 and should not be used in newly-written code.

Will always return NULL for all CTK-provided style providers.

Returns the CtkIconFactory defined to be in use for path , or NULL if none is defined.

Parameters

provider

a CtkStyleProvider

 

path

CtkWidgetPath to query

 

Returns

The icon factory to use for path , or NULL.

[nullable][transfer none]

Since: 3.0


ctk_style_provider_get_style ()

CtkStyleProperties *
ctk_style_provider_get_style (CtkStyleProvider *provider,
                              CtkWidgetPath *path);

ctk_style_provider_get_style has been deprecated since version 3.8 and should not be used in newly-written code.

Will always return NULL for all CTK-provided style providers as the interface cannot correctly work the way CSS is specified.

Returns the style settings affecting a widget defined by path , or NULL if provider doesn’t contemplate styling path .

Parameters

provider

a CtkStyleProvider

 

path

CtkWidgetPath to query

 

Returns

a CtkStyleProperties containing the style settings affecting path .

[nullable][transfer full]

Since: 3.0


ctk_style_provider_get_style_property ()

gboolean
ctk_style_provider_get_style_property (CtkStyleProvider *provider,
                                       CtkWidgetPath *path,
                                       CtkStateFlags state,
                                       GParamSpec *pspec,
                                       GValue *value);

Looks up a widget style property as defined by provider for the widget represented by path .

Parameters

provider

a CtkStyleProvider

 

path

CtkWidgetPath to query

 

state

state to query the style property for

 

pspec

The GParamSpec to query

 

value

return location for the property value.

[out]

Returns

TRUE if the property was found and has a value, FALSE otherwise

Since: 3.0

Types and Values

struct CtkStyleProviderIface

struct CtkStyleProviderIface {
  CtkStyleProperties * (* get_style) (CtkStyleProvider *provider,
                                      CtkWidgetPath    *path);

  gboolean (* get_style_property) (CtkStyleProvider *provider,
                                   CtkWidgetPath    *path,
                                   CtkStateFlags     state,
                                   GParamSpec       *pspec,
                                   GValue           *value);

  CtkIconFactory * (* get_icon_factory) (CtkStyleProvider *provider,
					 CtkWidgetPath    *path);
};

Members

get_style ()

Gets a set of style information that applies to a widget path.

 

get_style_property ()

Gets the value of a widget style property that applies to a widget path.

 

get_icon_factory ()

Gets the icon factory that applies to a widget path.

 

CtkStyleProvider

typedef struct _CtkStyleProvider CtkStyleProvider;

CTK_STYLE_PROVIDER_PRIORITY_FALLBACK

#define CTK_STYLE_PROVIDER_PRIORITY_FALLBACK      1

The priority used for default style information that is used in the absence of themes.

Note that this is not very useful for providing default styling for custom style classes - themes are likely to override styling provided at this priority with catch-all * {...} rules.


CTK_STYLE_PROVIDER_PRIORITY_THEME

#define CTK_STYLE_PROVIDER_PRIORITY_THEME     200

The priority used for style information provided by themes.


CTK_STYLE_PROVIDER_PRIORITY_SETTINGS

#define CTK_STYLE_PROVIDER_PRIORITY_SETTINGS    400

The priority used for style information provided via CtkSettings.

This priority is higher than CTK_STYLE_PROVIDER_PRIORITY_THEME to let settings override themes.


CTK_STYLE_PROVIDER_PRIORITY_APPLICATION

#define CTK_STYLE_PROVIDER_PRIORITY_APPLICATION 600

A priority that can be used when adding a CtkStyleProvider for application-specific style information.


CTK_STYLE_PROVIDER_PRIORITY_USER

#define CTK_STYLE_PROVIDER_PRIORITY_USER        800

The priority used for the style information from XDG_CONFIG_HOME/ctk-3.0/ctk.css.

You should not use priorities higher than this, to give the user the last word.

See Also

CtkStyleContext, CtkCssProvider