Migrating a CtkStyle based engine to a CtkThemingEngine based one should be straightforward for most of the vfuncs. Besides a cleanup in the available paint methods and a simplification in the passed arguments (in favor of CtkStyleContext containing all the information), the available render methods resemble those of CtkStyle quite evidently. Notable differences include:
ctk_paint_box(), ctk_paint_flat_box(),
ctk_paint_shadow(), ctk_paint_box_gap() and ctk_paint_shadow_gap()
are replaced by ctk_render_background(), ctk_render_frame() and
ctk_render_frame_gap(). The first function renders frameless
backgrounds and the last two render frames in various forms.
ctk_paint_resize_grip() has been subsumed by ctk_render_handle()
with a CTK_STYLE_CLASS_GRIP class set in the style context.
ctk_paint_spinner() disappears in favor of ctk_render_activity()
with a CTK_STYLE_CLASS_SPINNER class set in the style context.
The list of available render methods is:
ctk_render_background(): Renders a widget/area background.
|
ctk_render_frame(): Renders a frame border around the given rectangle.
Usually the detail of the border depends on the theme information,
plus the current widget state.
|
ctk_render_frame_gap(): Renders a frame border with a gap on one side.
|
ctk_render_layout(): Renders a PangoLayout.
|
ctk_render_handle(): Renders all kind of handles and resize grips,
depending on the style class.
|
ctk_render_check(): Render checkboxes.
|
ctk_render_option(): Render radiobuttons.
|
ctk_render_arrow(): Renders an arrow pointing to a direction.
|
ctk_render_expander(): Renders an expander indicator, such as in
CtkExpander.
|
ctk_render_focus(): Renders the indication that a widget has the
keyboard focus.
|
ctk_render_line(): Renders a line from one coordinate to another.
|
ctk_render_slider(): Renders a slider, such as in CtkScale.
|
ctk_render_extension(): Renders an extension that protrudes from
a UI element, such as a notebook tab.
|
ctk_render_activity(): Renders an area displaying activity, be it
a progressbar or a spinner.
|
ctk_render_icon_pixbuf(): Renders an icon into a GdkPixbuf.
|
One of the main differences to CtkStyle-based engines is that the
rendered widget is totally isolated from the theme engine, all style
information is meant to be retrieved from the CtkThemingEngine API,
or from the CtkWidgetPath obtained from ctk_theming_engine_get_path(),
which fully represents the rendered widget's hierarchy from a styling
point of view.
The detail string available in CtkStyle-based engines has been
replaced by widget regions and style classes. Regions are a way for
complex widgets to associate different styles with different areas,
such as even and odd rows in a treeview. Style classes allow sharing
of style information between widgets, regardless of their type.
Regions and style classes can be used in style sheets to associate
styles, and them engines can also access them. There are several
predefined classes and regions such as CTK_STYLE_CLASS_BUTTON or
CTK_STYLE_REGION_TAB in ctkstylecontext.h,
although custom widgets may define their own, which themes may
attempt to handle.