Struct
IpuzStyle
Description [src]
struct IpuzStyle {
/* No available fields */
}
An opaque data type that defines how an IpuzCell
should
be visually styled.
Styles can either be anonymous and be defined on a per-cell
basis, or they can be named and have a style_name
associated
with them. When they’re named, they are defined at the
IpuzPuzzle
level and can apply to multiple cells.
The ipuz spec doesn’t strongly define how the style should be rendered. Some latitude is given to implementations to interpret and render the style as is appropriate to their context.
Usage:
Here’s an example of putting a circle behind a specific cell.
static void
circle_cell (IpuzCrossword *puzzle,
IpuzCellCoord *coord)
{
g_autoptr (IpuzStyle) style = NULL;
IpuzCell *cell;
cell = ipuz_crossword_get_cell (IPUZ_CROSSWORD (puzzle), coord);
style = ipuz_style_new ();
ipuz_style_set_shapebg (style, IPUZ_STYLE_SHAPE_CIRCLE);
ipuz_cell_set_style (style);
}
And here’s an example of setting a global style to set a background color:
static void
set_global_style_on_cell (IpuzPuzzle *puzzle,
IpuzCell *cell)
{
g_autoptr (IpuzStyle) style = NULL;
// Create the global style
style = ipuz_style_new ();
ipuz_style_set_bg_color (style, "#f8e45c");
ipuz_style_set_style_name (style, "yellow-bg");
ipuz_puzzle_set_style (puzzle, "yellow-bg", style);
// Set a cell.
ipuz_cell_set_style_name (cell, style, "yellow-bg");
}
Please see the ipuz spec for more details on these concepts.
Instance methods
ipuz_style_foreach_mark
Calls func
on each mark that is explicitly set on style
. For each
mark, it passes in the label at that position.
ipuz_style_is_empty
Returns #true if style doesn’t have anything set, and makes no changes to the rendering of a cell it’s associated with.