Themeable Stock Images

Themeable Stock Images — Manipulating stock icons

Functions

CtkIconSource * ctk_icon_source_copy ()
void ctk_icon_source_free ()
void ctk_icon_factory_add ()
void ctk_icon_factory_add_default ()
CtkIconSet * ctk_icon_factory_lookup ()
CtkIconSet * ctk_icon_factory_lookup_default ()
CtkIconFactory * ctk_icon_factory_new ()
void ctk_icon_factory_remove_default ()
void ctk_icon_set_add_source ()
CtkIconSet * ctk_icon_set_copy ()
CtkIconSet * ctk_icon_set_new ()
CtkIconSet * ctk_icon_set_new_from_pixbuf ()
CtkIconSet * ctk_icon_set_ref ()
GdkPixbuf * ctk_icon_set_render_icon ()
GdkPixbuf * ctk_icon_set_render_icon_pixbuf ()
cairo_surface_t * ctk_icon_set_render_icon_surface ()
void ctk_icon_set_unref ()
gboolean ctk_icon_size_lookup ()
gboolean ctk_icon_size_lookup_for_settings ()
CtkIconSize ctk_icon_size_register ()
void ctk_icon_size_register_alias ()
CtkIconSize ctk_icon_size_from_name ()
const gchar * ctk_icon_size_get_name ()
void ctk_icon_set_get_sizes ()
CtkTextDirection ctk_icon_source_get_direction ()
gboolean ctk_icon_source_get_direction_wildcarded ()
const gchar * ctk_icon_source_get_filename ()
GdkPixbuf * ctk_icon_source_get_pixbuf ()
const gchar * ctk_icon_source_get_icon_name ()
CtkIconSize ctk_icon_source_get_size ()
gboolean ctk_icon_source_get_size_wildcarded ()
CtkStateType ctk_icon_source_get_state ()
gboolean ctk_icon_source_get_state_wildcarded ()
CtkIconSource * ctk_icon_source_new ()
void ctk_icon_source_set_direction ()
void ctk_icon_source_set_direction_wildcarded ()
void ctk_icon_source_set_filename ()
void ctk_icon_source_set_pixbuf ()
void ctk_icon_source_set_icon_name ()
void ctk_icon_source_set_size ()
void ctk_icon_source_set_size_wildcarded ()
void ctk_icon_source_set_state ()
void ctk_icon_source_set_state_wildcarded ()

Types and Values

Object Hierarchy

    GBoxed
    ╰── CtkIconSet
    GObject
    ╰── CtkIconFactory

Implemented Interfaces

CtkIconFactory implements CtkBuildable.

Includes

#include <ctk/ctk.h>

Description

An icon factory manages a collection of CtkIconSet; a CtkIconSet manages a set of variants of a particular icon (i.e. a CtkIconSet 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 CtkStyle has a list of CtkIconFactory 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, CTK+ looks for the icon in a list of default icon factories, maintained by ctk_icon_factory_add_default() and ctk_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 ctk_style_lookup_icon_set() on the widget that will display the icon, or the convenience function ctk_widget_render_icon(). These functions take the theme into account when looking up the icon to use for a given stock ID.

CtkIconFactory as CtkBuildable

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

  • direction

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

  • state

    State of the source, a CtkStateType enum value. This attribute is optional.

A CtkIconFactory UI definition fragment.

1
2
3
4
5
6
7
8
9
10
11
12
13
<object class="CtkIconFactory" id="iconfactory1">
  <sources>
    <source stock-id="apple-red" filename="apple-red.png"/>
  </sources>
</object>
<object class="CtkWindow" id="window1">
  <child>
    <object class="CtkButton" id="apple_button">
      <property name="label">apple-red</property>
      <property name="use-stock">True</property>
    </object>
  </child>
</object>

Functions

ctk_icon_source_copy ()

CtkIconSource *
ctk_icon_source_copy (const CtkIconSource *source);

Creates a copy of source ; mostly useful for language bindings.

Parameters

source

a CtkIconSource

 

Returns

a new CtkIconSource


ctk_icon_source_free ()

void
ctk_icon_source_free (CtkIconSource *source);

Frees a dynamically-allocated icon source, along with its filename, size, and pixbuf fields if those are not NULL.

Parameters

source

a CtkIconSource

 

ctk_icon_factory_add ()

void
ctk_icon_factory_add (CtkIconFactory *factory,
                      const gchar *stock_id,
                      CtkIconSet *icon_set);

Adds the given icon_set to the icon factory, under the name stock_id . stock_id should be namespaced for your application, e.g. “myapp-whatever-icon”. Normally applications create a CtkIconFactory, then add it to the list of default factories with ctk_icon_factory_add_default(). Then they pass the stock_id to widgets such as CtkImage to display the icon. Themes can provide an icon with the same name (such as "myapp-whatever-icon") to override your application’s default icons. If an icon already existed in factory for stock_id , it is unreferenced and replaced with the new icon_set .

Parameters

factory

a CtkIconFactory

 

stock_id

icon name

 

icon_set

icon set

 

ctk_icon_factory_add_default ()

void
ctk_icon_factory_add_default (CtkIconFactory *factory);

Adds an icon factory to the list of icon factories searched by ctk_style_lookup_icon_set(). This means that, for example, ctk_image_new_from_stock() will be able to find icons in factory . There will normally be an icon factory added for each library or application that comes with icons. The default icon factories can be overridden by themes.

Parameters

factory

a CtkIconFactory

 

ctk_icon_factory_lookup ()

CtkIconSet *
ctk_icon_factory_lookup (CtkIconFactory *factory,
                         const gchar *stock_id);

Looks up stock_id in the icon factory, returning an icon set if found, otherwise NULL. For display to the user, you should use ctk_style_lookup_icon_set() on the CtkStyle for the widget that will display the icon, instead of using this function directly, so that themes are taken into account.

Parameters

factory

a CtkIconFactory

 

stock_id

an icon name

 

Returns

icon set of stock_id .

[transfer none]


ctk_icon_factory_lookup_default ()

CtkIconSet *
ctk_icon_factory_lookup_default (const gchar *stock_id);

Looks for an icon in the list of default icon factories. For display to the user, you should use ctk_style_lookup_icon_set() on the CtkStyle for the widget that will display the icon, instead of using this function directly, so that themes are taken into account.

Parameters

stock_id

an icon name

 

Returns

a CtkIconSet, or NULL.

[transfer none]


ctk_icon_factory_new ()

CtkIconFactory *
ctk_icon_factory_new (void);

Creates a new CtkIconFactory. An icon factory manages a collection of CtkIconSets; a CtkIconSet manages a set of variants of a particular icon (i.e. a CtkIconSet 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 CtkStyle has a list of CtkIconFactorys 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, CTK+ looks for the icon in a list of default icon factories, maintained by ctk_icon_factory_add_default() and ctk_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.

Returns

a new CtkIconFactory


ctk_icon_factory_remove_default ()

void
ctk_icon_factory_remove_default (CtkIconFactory *factory);

Removes an icon factory from the list of default icon factories. Not normally used; you might use it for a library that can be unloaded or shut down.

Parameters

factory

a CtkIconFactory previously added with ctk_icon_factory_add_default()

 

ctk_icon_set_add_source ()

void
ctk_icon_set_add_source (CtkIconSet *icon_set,
                         const CtkIconSource *source);

Icon sets have a list of CtkIconSource, which they use as base icons for rendering icons in different states and sizes. Icons are scaled, made to look insensitive, etc. in ctk_icon_set_render_icon(), but CtkIconSet needs base images to work with. The base images and when to use them are described by a CtkIconSource.

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

ctk_icon_set_new_from_pixbuf() creates a new icon set with a default icon source based on the given pixbuf.

Parameters

icon_set

a CtkIconSet

 

source

a CtkIconSource

 

ctk_icon_set_copy ()

CtkIconSet *
ctk_icon_set_copy (CtkIconSet *icon_set);

Copies icon_set by value.

Parameters

icon_set

a CtkIconSet

 

Returns

a new CtkIconSet identical to the first.


ctk_icon_set_new ()

CtkIconSet *
ctk_icon_set_new (void);

Creates a new CtkIconSet. A CtkIconSet represents a single icon in various sizes and widget states. It can provide a GdkPixbuf for a given size and state on request, and automatically caches some of the rendered GdkPixbuf objects.

Normally you would use ctk_widget_render_icon_pixbuf() instead of using CtkIconSet directly. The one case where you’d use CtkIconSet is to create application-specific icon sets to place in a CtkIconFactory.

Returns

a new CtkIconSet


ctk_icon_set_new_from_pixbuf ()

CtkIconSet *
ctk_icon_set_new_from_pixbuf (GdkPixbuf *pixbuf);

Creates a new CtkIconSet with pixbuf as the default/fallback source image. If you don’t add any additional CtkIconSource to the icon set, all variants of the icon will be created from pixbuf , using scaling, pixelation, etc. as required to adjust the icon size or make the icon look insensitive/prelighted.

Parameters

pixbuf

a GdkPixbuf

 

Returns

a new CtkIconSet


ctk_icon_set_ref ()

CtkIconSet *
ctk_icon_set_ref (CtkIconSet *icon_set);

Increments the reference count on icon_set .

Parameters

icon_set

a CtkIconSet.

 

Returns

icon_set .


ctk_icon_set_render_icon ()

GdkPixbuf *
ctk_icon_set_render_icon (CtkIconSet *icon_set,
                          CtkStyle *style,
                          CtkTextDirection direction,
                          CtkStateType state,
                          CtkIconSize size,
                          CtkWidget *widget,
                          const gchar *detail);

Renders an icon using ctk_style_render_icon(). In most cases, ctk_widget_render_icon() is better, since it automatically provides most of the arguments from the current widget settings. This function never returns NULL; if the icon can’t be rendered (perhaps because an image file fails to load), a default "missing image" icon will be returned instead.

Parameters

icon_set

a CtkIconSet

 

style

a CtkStyle associated with widget , or NULL.

[allow-none]

direction

text direction

 

state

widget state

 

size

icon size (CtkIconSize). A size of (CtkIconSize)-1 means render at the size of the source and don’t scale.

[type int]

widget

widget that will display the icon, or NULL. The only use that is typically made of this is to determine the appropriate CdkScreen.

[allow-none]

detail

detail to pass to the theme engine, or NULL. Note that passing a detail of anything but NULL will disable caching.

[allow-none]

Returns

a GdkPixbuf to be displayed.

[transfer full]


ctk_icon_set_render_icon_pixbuf ()

GdkPixbuf *
ctk_icon_set_render_icon_pixbuf (CtkIconSet *icon_set,
                                 CtkStyleContext *context,
                                 CtkIconSize size);

Renders an icon using ctk_render_icon_pixbuf(). In most cases, ctk_widget_render_icon_pixbuf() is better, since it automatically provides most of the arguments from the current widget settings. This function never returns NULL; if the icon can’t be rendered (perhaps because an image file fails to load), a default "missing image" icon will be returned instead.

Parameters

icon_set

a CtkIconSet

 

context

a CtkStyleContext

 

size

icon size (CtkIconSize). A size of (CtkIconSize)-1 means render at the size of the source and don’t scale.

[type int]

Returns

a GdkPixbuf to be displayed.

[transfer full]

Since: 3.0


ctk_icon_set_render_icon_surface ()

cairo_surface_t *
ctk_icon_set_render_icon_surface (CtkIconSet *icon_set,
                                  CtkStyleContext *context,
                                  CtkIconSize size,
                                  int scale,
                                  CdkWindow *for_window);

ctk_icon_set_render_icon_surface is deprecated and should not be used in newly-written code.

Renders an icon using ctk_render_icon_pixbuf() and converts it to a cairo surface.

This function never returns NULL; if the icon can’t be rendered (perhaps because an image file fails to load), a default "missing image" icon will be returned instead.

Parameters

icon_set

a CtkIconSet

 

context

a CtkStyleContext

 

size

icon size (CtkIconSize). A size of (CtkIconSize)-1 means render at the size of the source and don’t scale.

[type int]

scale

the window scale to render for

 

for_window

CdkWindow to optimize drawing for, or NULL.

[allow-none]

Returns

a cairo_surface_t to be displayed.

[transfer full]

Since: 3.10


ctk_icon_set_unref ()

void
ctk_icon_set_unref (CtkIconSet *icon_set);

Decrements the reference count on icon_set , and frees memory if the reference count reaches 0.

Parameters

icon_set

a CtkIconSet

 

ctk_icon_size_lookup ()

gboolean
ctk_icon_size_lookup (CtkIconSize size,
                      gint *width,
                      gint *height);

Obtains the pixel size of a semantic icon size size : CTK_ICON_SIZE_MENU, CTK_ICON_SIZE_BUTTON, etc. This function isn’t normally needed, ctk_icon_theme_load_icon() is the usual way to get an icon for rendering, then just look at the size of the rendered pixbuf. The rendered pixbuf may not even correspond to the width/height returned by ctk_icon_size_lookup(), because themes are free to render the pixbuf however they like, including changing the usual size.

Parameters

size

an icon size (CtkIconSize).

[type int]

width

location to store icon width.

[out][allow-none]

height

location to store icon height.

[out][allow-none]

Returns

TRUE if size was a valid size


ctk_icon_size_lookup_for_settings ()

gboolean
ctk_icon_size_lookup_for_settings (CtkSettings *settings,
                                   CtkIconSize size,
                                   gint *width,
                                   gint *height);

Obtains the pixel size of a semantic icon size, possibly modified by user preferences for a particular CtkSettings. Normally size would be CTK_ICON_SIZE_MENU, CTK_ICON_SIZE_BUTTON, etc. This function isn’t normally needed, ctk_widget_render_icon_pixbuf() is the usual way to get an icon for rendering, then just look at the size of the rendered pixbuf. The rendered pixbuf may not even correspond to the width/height returned by ctk_icon_size_lookup(), because themes are free to render the pixbuf however they like, including changing the usual size.

Parameters

settings

a CtkSettings object, used to determine which set of user preferences to used.

 

size

an icon size (CtkIconSize).

[type int]

width

location to store icon width.

[out][allow-none]

height

location to store icon height.

[out][allow-none]

Returns

TRUE if size was a valid size

Since: 2.2


ctk_icon_size_register ()

CtkIconSize
ctk_icon_size_register (const gchar *name,
                        gint width,
                        gint height);

Registers a new icon size, along the same lines as CTK_ICON_SIZE_MENU, etc. Returns the integer value for the size.

Parameters

name

name of the icon size

 

width

the icon width

 

height

the icon height

 

Returns

integer value representing the size (CtkIconSize).

[type int]


ctk_icon_size_register_alias ()

void
ctk_icon_size_register_alias (const gchar *alias,
                              CtkIconSize target);

Registers alias as another name for target . So calling ctk_icon_size_from_name() with alias as argument will return target .

Parameters

alias

an alias for target

 

target

an existing icon size (CtkIconSize).

[type int]

ctk_icon_size_from_name ()

CtkIconSize
ctk_icon_size_from_name (const gchar *name);

Looks up the icon size associated with name .

Parameters

name

the name to look up.

 

Returns

the icon size (CtkIconSize).

[type int]


ctk_icon_size_get_name ()

const gchar *
ctk_icon_size_get_name (CtkIconSize size);

Gets the canonical name of the given icon size. The returned string is statically allocated and should not be freed.

Parameters

size

a CtkIconSize.

[type int]

Returns

the name of the given icon size.


ctk_icon_set_get_sizes ()

void
ctk_icon_set_get_sizes (CtkIconSet *icon_set,
                        CtkIconSize **sizes,
                        gint *n_sizes);

Obtains a list of icon sizes this icon set can render. The returned array must be freed with g_free().

Parameters

icon_set

a CtkIconSet

 

sizes

return location for array of sizes (CtkIconSize).

[array length=n_sizes][out][type int]

n_sizes

location to store number of elements in returned array

 

ctk_icon_source_get_direction ()

CtkTextDirection
ctk_icon_source_get_direction (const CtkIconSource *source);

Obtains the text direction this icon source applies to. The return value is only useful/meaningful if the text direction is not wildcarded.

Parameters

source

a CtkIconSource

 

Returns

text direction this source matches


ctk_icon_source_get_direction_wildcarded ()

gboolean
ctk_icon_source_get_direction_wildcarded
                               (const CtkIconSource *source);

Gets the value set by ctk_icon_source_set_direction_wildcarded().

Parameters

source

a CtkIconSource

 

Returns

TRUE if this icon source is a base for any text direction variant


ctk_icon_source_get_filename ()

const gchar *
ctk_icon_source_get_filename (const CtkIconSource *source);

Retrieves the source filename, or NULL if none is set. The filename is not a copy, and should not be modified or expected to persist beyond the lifetime of the icon source.

Parameters

source

a CtkIconSource

 

Returns

image filename. This string must not be modified or freed.

[type filename]


ctk_icon_source_get_pixbuf ()

GdkPixbuf *
ctk_icon_source_get_pixbuf (const CtkIconSource *source);

Retrieves the source pixbuf, or NULL if none is set. In addition, if a filename source is in use, this function in some cases will return the pixbuf from loaded from the filename. This is, for example, true for the CtkIconSource passed to the CtkStyle render_icon() virtual function. The reference count on the pixbuf is not incremented.

Parameters

source

a CtkIconSource

 

Returns

source pixbuf.

[transfer none]


ctk_icon_source_get_icon_name ()

const gchar *
ctk_icon_source_get_icon_name (const CtkIconSource *source);

Retrieves the source icon name, or NULL if none is set. The icon_name is not a copy, and should not be modified or expected to persist beyond the lifetime of the icon source.

Parameters

source

a CtkIconSource

 

Returns

icon name. This string must not be modified or freed.


ctk_icon_source_get_size ()

CtkIconSize
ctk_icon_source_get_size (const CtkIconSource *source);

Obtains the icon size this source applies to. The return value is only useful/meaningful if the icon size is not wildcarded.

Parameters

source

a CtkIconSource

 

Returns

icon size (CtkIconSize) this source matches.

[type int]


ctk_icon_source_get_size_wildcarded ()

gboolean
ctk_icon_source_get_size_wildcarded (const CtkIconSource *source);

Gets the value set by ctk_icon_source_set_size_wildcarded().

Parameters

source

a CtkIconSource

 

Returns

TRUE if this icon source is a base for any icon size variant


ctk_icon_source_get_state ()

CtkStateType
ctk_icon_source_get_state (const CtkIconSource *source);

Obtains the widget state this icon source applies to. The return value is only useful/meaningful if the widget state is not wildcarded.

Parameters

source

a CtkIconSource

 

Returns

widget state this source matches


ctk_icon_source_get_state_wildcarded ()

gboolean
ctk_icon_source_get_state_wildcarded (const CtkIconSource *source);

Gets the value set by ctk_icon_source_set_state_wildcarded().

Parameters

source

a CtkIconSource

 

Returns

TRUE if this icon source is a base for any widget state variant


ctk_icon_source_new ()

CtkIconSource *
ctk_icon_source_new (void);

Creates a new CtkIconSource. A CtkIconSource contains a GdkPixbuf (or image filename) that serves as the base image for one or more of the icons in a CtkIconSet, along with a specification for which icons in the icon set will be based on that pixbuf or image file. An icon set contains a set of icons that represent “the same” logical concept in different states, different global text directions, and different sizes.

So for example 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. CtkIconSet contains a list of CtkIconSource from which it can derive specific icon variants in the set.

In the simplest case, CtkIconSet contains one source pixbuf from which it derives all variants. The convenience function ctk_icon_set_new_from_pixbuf() handles this case; if you only have one source pixbuf, just use that function.

If you want to use a different base pixbuf for different icon variants, you create multiple icon sources, mark which variants they’ll be used to create, and add them to the icon set with ctk_icon_set_add_source().

By default, the icon source has all parameters wildcarded. That is, the icon source will be used as the base icon for any desired text direction, widget state, or icon size.

Returns

a new CtkIconSource


ctk_icon_source_set_direction ()

void
ctk_icon_source_set_direction (CtkIconSource *source,
                               CtkTextDirection direction);

Sets the text direction this icon source is intended to be used with.

Setting the text direction on an icon source makes no difference if the text direction is wildcarded. Therefore, you should usually call ctk_icon_source_set_direction_wildcarded() to un-wildcard it in addition to calling this function.

Parameters

source

a CtkIconSource

 

direction

text direction this source applies to

 

ctk_icon_source_set_direction_wildcarded ()

void
ctk_icon_source_set_direction_wildcarded
                               (CtkIconSource *source,
                                gboolean setting);

If the text direction is wildcarded, this source can be used as the base image for an icon in any CtkTextDirection. If the text direction is not wildcarded, then the text direction the icon source applies to should be set with ctk_icon_source_set_direction(), and the icon source will only be used with that text direction.

CtkIconSet prefers non-wildcarded sources (exact matches) over wildcarded sources, and will use an exact match when possible.

Parameters

source

a CtkIconSource

 

setting

TRUE to wildcard the text direction

 

ctk_icon_source_set_filename ()

void
ctk_icon_source_set_filename (CtkIconSource *source,
                              const gchar *filename);

Sets the name of an image file to use as a base image when creating icon variants for CtkIconSet. The filename must be absolute.

Parameters

source

a CtkIconSource

 

filename

image file to use.

[type filename]

ctk_icon_source_set_pixbuf ()

void
ctk_icon_source_set_pixbuf (CtkIconSource *source,
                            GdkPixbuf *pixbuf);

Sets a pixbuf to use as a base image when creating icon variants for CtkIconSet.

Parameters

source

a CtkIconSource

 

pixbuf

pixbuf to use as a source

 

ctk_icon_source_set_icon_name ()

void
ctk_icon_source_set_icon_name (CtkIconSource *source,
                               const gchar *icon_name);

Sets the name of an icon to look up in the current icon theme to use as a base image when creating icon variants for CtkIconSet.

Parameters

source

a CtkIconSource

 

icon_name

name of icon to use.

[allow-none]

ctk_icon_source_set_size ()

void
ctk_icon_source_set_size (CtkIconSource *source,
                          CtkIconSize size);

Sets the icon size this icon source is intended to be used with.

Setting the icon size on an icon source makes no difference if the size is wildcarded. Therefore, you should usually call ctk_icon_source_set_size_wildcarded() to un-wildcard it in addition to calling this function.

Parameters

source

a CtkIconSource

 

size

icon size (CtkIconSize) this source applies to.

[type int]

ctk_icon_source_set_size_wildcarded ()

void
ctk_icon_source_set_size_wildcarded (CtkIconSource *source,
                                     gboolean setting);

If the icon size is wildcarded, this source can be used as the base image for an icon of any size. If the size is not wildcarded, then the size the source applies to should be set with ctk_icon_source_set_size() and the icon source will only be used with that specific size.

CtkIconSet prefers non-wildcarded sources (exact matches) over wildcarded sources, and will use an exact match when possible.

CtkIconSet will normally scale wildcarded source images to produce an appropriate icon at a given size, but will not change the size of source images that match exactly.

Parameters

source

a CtkIconSource

 

setting

TRUE to wildcard the widget state

 

ctk_icon_source_set_state ()

void
ctk_icon_source_set_state (CtkIconSource *source,
                           CtkStateType state);

Sets the widget state this icon source is intended to be used with.

Setting the widget state on an icon source makes no difference if the state is wildcarded. Therefore, you should usually call ctk_icon_source_set_state_wildcarded() to un-wildcard it in addition to calling this function.

Parameters

source

a CtkIconSource

 

state

widget state this source applies to

 

ctk_icon_source_set_state_wildcarded ()

void
ctk_icon_source_set_state_wildcarded (CtkIconSource *source,
                                      gboolean setting);

If the widget state is wildcarded, this source can be used as the base image for an icon in any CtkStateType. If the widget state is not wildcarded, then the state the source applies to should be set with ctk_icon_source_set_state() and the icon source will only be used with that specific state.

CtkIconSet prefers non-wildcarded sources (exact matches) over wildcarded sources, and will use an exact match when possible.

CtkIconSet will normally transform wildcarded source images to produce an appropriate icon for a given state, for example lightening an image on prelight, but will not modify source images that match exactly.

Parameters

source

a CtkIconSource

 

setting

TRUE to wildcard the widget state

 

Types and Values

CtkIconSource

typedef struct _CtkIconSource CtkIconSource;

struct CtkIconFactory

struct CtkIconFactory;

struct CtkIconFactoryClass

struct CtkIconFactoryClass {
  GObjectClass parent_class;
};

Members


CtkIconSet

typedef struct _CtkIconSet CtkIconSet;

enum CtkIconSize

Built-in stock icon sizes.

Members

CTK_ICON_SIZE_INVALID

Invalid size.

 

CTK_ICON_SIZE_MENU

Size appropriate for menus (16px).

 

CTK_ICON_SIZE_SMALL_TOOLBAR

Size appropriate for small toolbars (16px).

 

CTK_ICON_SIZE_LARGE_TOOLBAR

Size appropriate for large toolbars (24px)

 

CTK_ICON_SIZE_BUTTON

Size appropriate for buttons (16px)

 

CTK_ICON_SIZE_DND

Size appropriate for drag and drop (32px)

 

CTK_ICON_SIZE_DIALOG

Size appropriate for dialogs (48px)