wlmaker
Loading...
Searching...
No Matches
Functions | Variables
style.c File Reference
#include <libbase/libbase.h>
#include <libbase/plist.h>
#include <stddef.h>
#include <toolkit/style.h>
Include dependency graph for style.c:

Functions

cairo_font_weight_t wlmtk_style_font_weight_cairo_from_wlmtk (wlmtk_style_font_weight_t weight)
 
bool wlmtk_style_decode_fill (bspl_object_t *object_ptr, const union bspl_desc_value *desc_value_ptr, void *value_ptr)
 
static void _wlmtk_style_test_decode_fill (bs_test_t *test_ptr)
 
static void _wlmtk_style_test_decode_font (bs_test_t *test_ptr)
 

Variables

const bspl_desc_t wlmtk_style_margin_desc []
 
static const bspl_enum_desc_t _wlmtk_style_font_weight_desc []
 
const bspl_desc_t wlmtk_style_font_desc []
 
static const bspl_enum_desc_t _wlmtk_style_fill_type_desc []
 
static const bspl_desc_t _wlmtk_style_fill_style_desc []
 
static const bspl_desc_t _wlmtk_style_fill_color_solid_desc []
 
static const bspl_desc_t _wlmtk_style_fill_color_gradient_desc []
 
static const bs_test_case_t _wlmtk_style_test_cases []
 
const bs_test_set_t wlmtk_style_test_set
 

Detailed Description

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Function Documentation

◆ _wlmtk_style_test_decode_fill()

void _wlmtk_style_test_decode_fill ( bs_test_t *  test_ptr)
static

Tests the decoder for the fill style.

◆ _wlmtk_style_test_decode_font()

void _wlmtk_style_test_decode_font ( bs_test_t *  test_ptr)
static

Tests the decoder for a font descriptor.

◆ wlmtk_style_decode_fill()

bool wlmtk_style_decode_fill ( bspl_object_t *  object_ptr,
const union bspl_desc_value *  desc_value_ptr,
void *  value_ptr 
)

Custom decoder for fill style struct from a plist dict.

Parameters
object_ptr
desc_value_ptr
value_ptr
Returns
true on success.

◆ wlmtk_style_font_weight_cairo_from_wlmtk()

cairo_font_weight_t wlmtk_style_font_weight_cairo_from_wlmtk ( wlmtk_style_font_weight_t  weight)

Translates the font weight from toolkit into cairo enum.

Variable Documentation

◆ _wlmtk_style_fill_color_gradient_desc

const bspl_desc_t _wlmtk_style_fill_color_gradient_desc[]
static
Initial value:
= {
BSPL_DESC_ARGB32(
"From", true, wlmtk_style_color_gradient_data_t, from, from, 0),
BSPL_DESC_ARGB32(
"To", true, wlmtk_style_color_gradient_data_t, to, to, 0),
}

Plist decoding descriptor of a color gradient.

◆ _wlmtk_style_fill_color_solid_desc

const bspl_desc_t _wlmtk_style_fill_color_solid_desc[]
static
Initial value:
= {
BSPL_DESC_ARGB32(
"Color", true, wlmtk_style_color_solid_data_t, color, color, 0),
}
Definition style.h:63

Plist decoding descriptor of the solid color.

◆ _wlmtk_style_fill_style_desc

const bspl_desc_t _wlmtk_style_fill_style_desc[]
static
Initial value:
= {
BSPL_DESC_ENUM("Type", true, wlmtk_style_fill_t, type, type,
}
Definition style.h:77
static const bspl_enum_desc_t _wlmtk_style_fill_type_desc[]
Definition style.c:57
@ WLMTK_STYLE_COLOR_SOLID
Definition style.h:37

Plist decoding descriptor of the fill style.

◆ _wlmtk_style_fill_type_desc

const bspl_enum_desc_t _wlmtk_style_fill_type_desc[]
static
Initial value:
= {
BSPL_ENUM("SOLID", WLMTK_STYLE_COLOR_SOLID),
BSPL_ENUM("HGRADIENT", WLMTK_STYLE_COLOR_HGRADIENT),
BSPL_ENUM("VGRADIENT", WLMTK_STYLE_COLOR_VGRADIENT),
BSPL_ENUM("DGRADIENT", WLMTK_STYLE_COLOR_DGRADIENT),
BSPL_ENUM("ADGRADIENT", WLMTK_STYLE_COLOR_ADGRADIENT),
}
@ WLMTK_STYLE_COLOR_VGRADIENT
Definition style.h:41
@ WLMTK_STYLE_COLOR_ADGRADIENT
Definition style.h:59
@ WLMTK_STYLE_COLOR_HGRADIENT
Definition style.h:39
@ WLMTK_STYLE_COLOR_DGRADIENT
Definition style.h:49

Plist decoding descriptor of the fill type.

◆ _wlmtk_style_font_weight_desc

const bspl_enum_desc_t _wlmtk_style_font_weight_desc[]
static
Initial value:
= {
BSPL_ENUM("Normal", WLMTK_FONT_WEIGHT_NORMAL),
BSPL_ENUM("Bold", WLMTK_FONT_WEIGHT_BOLD),
}

Plist decoding descriptor for font weight.

◆ _wlmtk_style_test_cases

const bs_test_case_t _wlmtk_style_test_cases[]
static
Initial value:
= {
{ true, "decode_fill", _wlmtk_style_test_decode_fill },
{ true, "decode_font", _wlmtk_style_test_decode_font },
}
static void _wlmtk_style_test_decode_fill(bs_test_t *test_ptr)
Definition style.c:173
static void _wlmtk_style_test_decode_font(bs_test_t *test_ptr)
Definition style.c:225

Unit test cases. Test cases

◆ wlmtk_style_font_desc

const bspl_desc_t wlmtk_style_font_desc[]
Initial value:
= {
BSPL_DESC_CHARBUF(
"Face", true, wlmtk_style_font_t, face, face,
BSPL_DESC_ENUM(
"Weight", true, wlmtk_style_font_t, weight, weight,
WLMTK_FONT_WEIGHT_NORMAL, _wlmtk_style_font_weight_desc),
BSPL_DESC_UINT64(
"Size", true, wlmtk_style_font_t, size, size, 10),
}
Definition style.h:105
static const bspl_enum_desc_t _wlmtk_style_font_weight_desc[]
Definition style.c:38
#define WLMTK_STYLE_FONT_FACE_LENGTH
Definition style.h:96

Plist decoding descriptor for decoding "Font" sections.

◆ wlmtk_style_margin_desc

const bspl_desc_t wlmtk_style_margin_desc[]
Initial value:
= {
BSPL_DESC_UINT64(
"Width", true, struct wlmtk_margin_style, width, width, 0),
BSPL_DESC_ARGB32(
"Color", true, struct wlmtk_margin_style, color, color, 0xff000000),
}
Definition style.h:116

Plist decoding descriptor of a margin's style.

◆ wlmtk_style_test_set

const bs_test_set_t wlmtk_style_test_set
Initial value:
= BS_TEST_SET(
true, "style", _wlmtk_style_test_cases)
static const bs_test_case_t _wlmtk_style_test_cases[]
Definition style.c:162

Unit test cases.