style_mutable_t

概述

image

可变的style(可实时修改并生效,主要用于在designer中被编辑的控件,或者一些特殊控件)。

style_mutable也对style_const进行了包装,当用户没修改某个值时,便从style_const中获取。


函数

函数名称 说明
dialog_highlighter_register_builtins 注册内置的对话框高亮策略。
style_mutable_cast 转换为style_mutable对象。
style_mutable_create 创建style_mutable对象。
style_mutable_foreach 遍历。对每项调用回调函数on_style_item。
style_mutable_get_name 获取style的名称。
style_mutable_get_value 获取指定名称的值。
style_mutable_register 将自己注册到style_factory。
style_mutable_set_color 设置指定名称的颜色值。
style_mutable_set_int 设置指定名称整数格式的值。
style_mutable_set_name 设置style的名称。
style_mutable_set_str 设置指定名称字符串的值。
style_mutable_set_value 设置指定名称的值。

属性

属性名称 类型 说明
name char* 名称。

dialog_highlighter_register_builtins 函数


  • 函数功能:

注册内置的对话框高亮策略。

  • 函数原型:
  1. ret_t dialog_highlighter_register_builtins ();
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。

style_mutable_cast 函数


  • 函数功能:

转换为style_mutable对象。

  • 函数原型:
  1. style_t* style_mutable_cast (style_t* s);
  • 参数说明:
参数 类型 说明
返回值 style_t* style对象。
s style_t* style对象。

style_mutable_create 函数


  • 函数功能:

创建style_mutable对象。

除了测试程序外不需要直接调用,widget会通过style_factory_create创建。

  • 函数原型:
  1. style_t* style_mutable_create (widget_t* widget);
  • 参数说明:
参数 类型 说明
返回值 style_t* style对象。
widget widget_t* 控件

style_mutable_foreach 函数


  • 函数功能:

遍历。对每项调用回调函数on_style_item。

  • 函数原型:
  1. ret_t style_mutable_foreach (style_t* s, tk_on_style_item_t on_style_item, void* ctx);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
s style_t* style对象。
on_style_item tk_on_style_item_t 回调函数。
ctx void* 回调函数的上下文。

style_mutable_get_name 函数


  • 函数功能:

获取style的名称。

  • 函数原型:
  1. const char* style_mutable_get_name (style_t* s);
  • 参数说明:
参数 类型 说明
返回值 const char* style的名称。
s style_t* style对象。

style_mutable_get_value 函数


  • 函数功能:

获取指定名称的值。

  • 函数原型:
  1. ret_t style_mutable_get_value (style_t* s, const char* state, const char* name, const value_t* v);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
s style_t* style对象。
state const char* 控件状态。
name const char* 属性名。
v const value_t* 值。

style_mutable_register 函数


  • 函数功能:

将自己注册到style_factory。

  • 函数原型:
  1. ret_t style_mutable_register ();
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。

style_mutable_set_color 函数


  • 函数功能:

设置指定名称的颜色值。

  • 函数原型:
  1. ret_t style_mutable_set_color (style_t* s, const char* state, const char* name, color_t val);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
s style_t* style对象。
state const char* 控件状态。
name const char* 属性名。
val color_t 值。

style_mutable_set_int 函数


  • 函数功能:

设置指定名称整数格式的值。

  • 函数原型:
  1. ret_t style_mutable_set_int (style_t* s, const char* state, const char* name, int32_t val);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
s style_t* style对象。
state const char* 控件状态。
name const char* 属性名。
val int32_t 值。

style_mutable_set_name 函数


  • 函数功能:

设置style的名称。

  • 函数原型:
  1. ret_t style_mutable_set_name (style_t* s, const char* name);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
s style_t* style对象。
name const char* 名称。

style_mutable_set_str 函数


  • 函数功能:

设置指定名称字符串的值。

  • 函数原型:
  1. ret_t style_mutable_set_str (style_t* s, const char* state, const char* name, const char* val);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
s style_t* style对象。
state const char* 控件状态。
name const char* 属性名。
val const char* 值。

style_mutable_set_value 函数


  • 函数功能:

设置指定名称的值。

  • 函数原型:
  1. ret_t style_mutable_set_value (style_t* s, const char* state, const char* name, const value_t* v);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
s style_t* style对象。
state const char* 控件状态。
name const char* 属性名。
v const value_t* 值。

name 属性


名称。

  • 类型:char*
特性 是否支持
可直接读取
可直接修改
可脚本化