improve grid

This commit is contained in:
lixianjing 2022-06-19 11:15:42 +08:00
parent 032d18e461
commit 5f768a4a17
22 changed files with 964 additions and 157 deletions

View File

@ -0,0 +1,33 @@
<window>
<grid x="10" y="10" w="-20" h="30" columns_definition="col(w=0.4,m=5);col(w=0.3,m=5);col(w=0.3,m=5);" rows="1"
style.normal.grid_color="gray" style.normal.border_color="black" show_grid="true"
style.normal.bg_color="#a0a0a0">
<label text="姓名" />
<label text="语文" />
<label text="数学" />
</grid>
<grid x="10" y="40" w="-20" h="180" columns_definition="col(w=0.4,m=5);col(w=0.3,m=5);col(w=0.3,m=5);" rows="5"
style.normal.grid_color="gray" style.normal.border_color="black"
style.normal.odd_bg_color="#f5f5f5" style.normal.even_bg_color="#eeeeee" show_grid="true">
<label text="张三" />
<label text="98" />
<label text="97" />
<label text="李四" />
<label text="98" />
<label text="97" />
<label text="王五" />
<label text="98" />
<label text="97" />
<label text="孙六" />
<label text="98" />
<label text="97" />
<label text="赵七" />
<label text="98" />
<label text="97" />
</grid>
</window>

View File

@ -48,6 +48,7 @@
<button focusable="true" name="open:draggable" text="Draggable"/>
<button focusable="true" name="open:rich_text_view" text="RichTextView"/>
<button focusable="true" name="open:bidi" text="Bidirectional"/>
<button focusable="true" name="open:grid" text="grid"/>
<button focusable="true" name="open:color_tile" text="Color Tile"/>
<button focusable="true" name="open:floating_keyboard" text="Floating Keyboard"/>
<button focusable="true" name="open:slider" text="Slider"/>

View File

@ -1,4 +1,8 @@
# 最新动态
2022/06/19
* 完善 grid 控件,请参考[grid控件用法](grid.md)
2022/06/18
* 修复tab键切换焦点时重新打开参考的问题。
* 完善弹出软键盘时窗口位置。

92
docs/grid.md Normal file
View File

@ -0,0 +1,92 @@
# Grid 控件用法
在很长一段时间内grid 都只是起到语义上的作用,在功能上和 view 没有不同。最近我们对它做了以下改成,在不少地方可以提高开发效率。
* 可以指定不同列的宽度。这个在默认子控件布局中是没法实现的。
* 可以绘制网格线。按传统方法去做,虽然不是不可能,也是非常麻烦的。
* 奇偶行可以指定不同的背景颜色。按传统方法去做,也是非常麻烦的。
有了上述这些特性,我们就可以非常方便的实现表格效果。
![](images/grid.png)
> 由于 grid 本身不具有滚动效果,不适合显示大量数据。
## 1. 用法
### 1.1 指定行数
通过属性 rows 指定行数。
### 1.2 指定各列的参数
通过属性 columns_definition 指定各列的参数
```c
/**
* @property {char*} columns_definition
* @annotation ["set_prop","get_prop","readable","persitent","design","scriptable"]
* 各列的参数。
* 各列的参数之间用英文的分号 (;) 分隔,每列参数的格式为:
*
* col(w=?,left_margin=?,right_margin=?,top_maorgin=?,bottom_margin=?)
*
* * w 为列的宽度(必须存在)。取值在 (0-1] 区间时,视为 grid 控件宽度的比例,否则为像素宽度。
* * left_margin可选可缩写为 l) 该列左边的边距。
* * right_margin可选可缩写为 r) 该列右边的边距。
* * top_margin可选可缩写为 t) 该列顶部的边距。
* * bottom_margin可选可缩写为 b) 该列底部的边距。
* * margin可选可缩写为 m) 同时指定上面 4 个边距。
*
*/
char* columns_definition;
```
### 1.3 显示网格
* 属性 show_grid 设置为 true。
* 在 style 中指定 grid_color 的颜色
* 在 style 中指定 border_color 的颜色
### 1.4 奇偶行不同背景颜色
* 在 style 中通过 even\_bg\_color 指定偶数行的背景颜色
* 在 style 中通过 odd\_bg\_color 指定奇数行的背景颜色
### 1.5 完整示例
```xml
<window>
<grid x="10" y="10" w="-20" h="30" columns_definition="col(w=0.4,m=5);col(w=0.3,m=5);col(w=0.3,m=5);" rows="1"
style.normal.grid_color="gray" style.normal.border_color="black" show_grid="true"
style.normal.bg_color="#a0a0a0">
<label text="姓名" />
<label text="语文" />
<label text="数学" />
</grid>
<grid x="10" y="40" w="-20" h="180" columns_definition="col(w=0.4,m=5);col(w=0.3,m=5);col(w=0.3,m=5);" rows="5"
style.normal.grid_color="gray" style.normal.border_color="black"
style.normal.odd_bg_color="#f5f5f5" style.normal.even_bg_color="#eeeeee" show_grid="true">
<label text="张三" />
<label text="98" />
<label text="97" />
<label text="李四" />
<label text="98" />
<label text="97" />
<label text="王五" />
<label text="98" />
<label text="97" />
<label text="孙六" />
<label text="98" />
<label text="97" />
<label text="赵七" />
<label text="98" />
<label text="97" />
</grid>
</window>
```

BIN
docs/images/grid.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

View File

@ -167,6 +167,7 @@ extern TK_CONST_DATA_ALIGN(const unsigned char ui_image_animation[]);
extern TK_CONST_DATA_ALIGN(const unsigned char ui_image_value[]);
extern TK_CONST_DATA_ALIGN(const unsigned char ui_slide_view[]);
extern TK_CONST_DATA_ALIGN(const unsigned char ui_time_clock[]);
extern TK_CONST_DATA_ALIGN(const unsigned char ui_grid[]);
extern TK_CONST_DATA_ALIGN(const unsigned char ui_tab_top[]);
extern TK_CONST_DATA_ALIGN(const unsigned char ui_slide_view_v[]);
extern TK_CONST_DATA_ALIGN(const unsigned char ui_top[]);
@ -1044,6 +1045,7 @@ ret_t assets_init_dark(void) {
assets_manager_add(am, ui_image_value);
assets_manager_add(am, ui_slide_view);
assets_manager_add(am, ui_time_clock);
assets_manager_add(am, ui_grid);
assets_manager_add(am, ui_tab_top);
assets_manager_add(am, ui_slide_view_v);
assets_manager_add(am, ui_top);

View File

@ -167,6 +167,7 @@
#include "default/inc/ui/image_value.data"
#include "default/inc/ui/slide_view.data"
#include "default/inc/ui/time_clock.data"
#include "default/inc/ui/grid.data"
#include "default/inc/ui/tab_top.data"
#include "default/inc/ui/slide_view_v.data"
#include "default/inc/ui/top.data"
@ -1044,6 +1045,7 @@ ret_t assets_init_default(void) {
assets_manager_add(am, ui_image_value);
assets_manager_add(am, ui_slide_view);
assets_manager_add(am, ui_time_clock);
assets_manager_add(am, ui_grid);
assets_manager_add(am, ui_tab_top);
assets_manager_add(am, ui_slide_view_v);
assets_manager_add(am, ui_top);

View File

@ -162,6 +162,7 @@ extern TK_CONST_DATA_ALIGN(const unsigned char ui_image_animation[]);
extern TK_CONST_DATA_ALIGN(const unsigned char ui_image_value[]);
extern TK_CONST_DATA_ALIGN(const unsigned char ui_slide_view[]);
extern TK_CONST_DATA_ALIGN(const unsigned char ui_time_clock[]);
extern TK_CONST_DATA_ALIGN(const unsigned char ui_grid[]);
extern TK_CONST_DATA_ALIGN(const unsigned char ui_tab_top[]);
extern TK_CONST_DATA_ALIGN(const unsigned char ui_slide_view_v[]);
extern TK_CONST_DATA_ALIGN(const unsigned char ui_top[]);
@ -669,6 +670,7 @@ ret_t assets_init_dark(void) {
assets_manager_add(am, ui_image_value);
assets_manager_add(am, ui_slide_view);
assets_manager_add(am, ui_time_clock);
assets_manager_add(am, ui_grid);
assets_manager_add(am, ui_tab_top);
assets_manager_add(am, ui_slide_view_v);
assets_manager_add(am, ui_top);

View File

@ -162,6 +162,7 @@
#include "default/inc/ui/image_value.data"
#include "default/inc/ui/slide_view.data"
#include "default/inc/ui/time_clock.data"
#include "default/inc/ui/grid.data"
#include "default/inc/ui/tab_top.data"
#include "default/inc/ui/slide_view_v.data"
#include "default/inc/ui/top.data"
@ -669,6 +670,7 @@ ret_t assets_init_default(void) {
assets_manager_add(am, ui_image_value);
assets_manager_add(am, ui_slide_view);
assets_manager_add(am, ui_time_clock);
assets_manager_add(am, ui_grid);
assets_manager_add(am, ui_tab_top);
assets_manager_add(am, ui_slide_view_v);
assets_manager_add(am, ui_top);

View File

@ -0,0 +1,89 @@
TK_CONST_DATA_ALIGN(const unsigned char ui_grid[]) = {
0x04,0x00,0x01,0x01,0xae,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x67,0x72,0x69,0x64,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x12,0x12,0x22,0x11,0x77,0x69,0x6e,0x64,0x6f,0x77,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x67,0x72,0x69,
0x64,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0xec,0xff,0xff,
0xff,0x1e,0x00,0x00,0x00,0x73,0x65,0x6c,0x66,0x5f,0x6c,0x61,0x79,0x6f,0x75,0x74,0x00,0x64,0x65,0x66,
0x61,0x75,0x6c,0x74,0x28,0x78,0x3d,0x31,0x30,0x2c,0x79,0x3d,0x31,0x30,0x2c,0x77,0x3d,0x2d,0x32,0x30,
0x2c,0x68,0x3d,0x33,0x30,0x29,0x00,0x63,0x6f,0x6c,0x75,0x6d,0x6e,0x73,0x5f,0x64,0x65,0x66,0x69,0x6e,
0x69,0x74,0x69,0x6f,0x6e,0x00,0x63,0x6f,0x6c,0x28,0x77,0x3d,0x30,0x2e,0x34,0x2c,0x6d,0x3d,0x35,0x29,
0x3b,0x63,0x6f,0x6c,0x28,0x77,0x3d,0x30,0x2e,0x33,0x2c,0x6d,0x3d,0x35,0x29,0x3b,0x63,0x6f,0x6c,0x28,
0x77,0x3d,0x30,0x2e,0x33,0x2c,0x6d,0x3d,0x35,0x29,0x3b,0x00,0x72,0x6f,0x77,0x73,0x00,0x31,0x00,0x73,
0x74,0x79,0x6c,0x65,0x2e,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x2e,0x67,0x72,0x69,0x64,0x5f,0x63,0x6f,0x6c,
0x6f,0x72,0x00,0x67,0x72,0x61,0x79,0x00,0x73,0x74,0x79,0x6c,0x65,0x2e,0x6e,0x6f,0x72,0x6d,0x61,0x6c,
0x2e,0x62,0x6f,0x72,0x64,0x65,0x72,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x00,0x62,0x6c,0x61,0x63,0x6b,0x00,
0x73,0x68,0x6f,0x77,0x5f,0x67,0x72,0x69,0x64,0x00,0x74,0x72,0x75,0x65,0x00,0x73,0x74,0x79,0x6c,0x65,
0x2e,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x2e,0x62,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x00,0x23,0x61,0x30,
0x61,0x30,0x61,0x30,0x00,0x00,0x6c,0x61,0x62,0x65,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x74,0x65,0x78,0x74,0x00,0xe5,
0xa7,0x93,0xe5,0x90,0x8d,0x00,0x00,0x00,0x6c,0x61,0x62,0x65,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x74,0x65,0x78,0x74,
0x00,0xe8,0xaf,0xad,0xe6,0x96,0x87,0x00,0x00,0x00,0x6c,0x61,0x62,0x65,0x6c,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x74,0x65,
0x78,0x74,0x00,0xe6,0x95,0xb0,0xe5,0xad,0xa6,0x00,0x00,0x00,0x00,0x67,0x72,0x69,0x64,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x28,0x00,0x00,0x00,0xec,0xff,0xff,0xff,0xb4,0x00,0x00,
0x00,0x73,0x65,0x6c,0x66,0x5f,0x6c,0x61,0x79,0x6f,0x75,0x74,0x00,0x64,0x65,0x66,0x61,0x75,0x6c,0x74,
0x28,0x78,0x3d,0x31,0x30,0x2c,0x79,0x3d,0x34,0x30,0x2c,0x77,0x3d,0x2d,0x32,0x30,0x2c,0x68,0x3d,0x31,
0x38,0x30,0x29,0x00,0x63,0x6f,0x6c,0x75,0x6d,0x6e,0x73,0x5f,0x64,0x65,0x66,0x69,0x6e,0x69,0x74,0x69,
0x6f,0x6e,0x00,0x63,0x6f,0x6c,0x28,0x77,0x3d,0x30,0x2e,0x34,0x2c,0x6d,0x3d,0x35,0x29,0x3b,0x63,0x6f,
0x6c,0x28,0x77,0x3d,0x30,0x2e,0x33,0x2c,0x6d,0x3d,0x35,0x29,0x3b,0x63,0x6f,0x6c,0x28,0x77,0x3d,0x30,
0x2e,0x33,0x2c,0x6d,0x3d,0x35,0x29,0x3b,0x00,0x72,0x6f,0x77,0x73,0x00,0x35,0x00,0x73,0x74,0x79,0x6c,
0x65,0x2e,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x2e,0x67,0x72,0x69,0x64,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x00,
0x67,0x72,0x61,0x79,0x00,0x73,0x74,0x79,0x6c,0x65,0x2e,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x2e,0x62,0x6f,
0x72,0x64,0x65,0x72,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x00,0x62,0x6c,0x61,0x63,0x6b,0x00,0x73,0x74,0x79,
0x6c,0x65,0x2e,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x2e,0x6f,0x64,0x64,0x5f,0x62,0x67,0x5f,0x63,0x6f,0x6c,
0x6f,0x72,0x00,0x23,0x66,0x35,0x66,0x35,0x66,0x35,0x00,0x73,0x74,0x79,0x6c,0x65,0x2e,0x6e,0x6f,0x72,
0x6d,0x61,0x6c,0x2e,0x65,0x76,0x65,0x6e,0x5f,0x62,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x00,0x23,0x65,
0x65,0x65,0x65,0x65,0x65,0x00,0x73,0x68,0x6f,0x77,0x5f,0x67,0x72,0x69,0x64,0x00,0x74,0x72,0x75,0x65,
0x00,0x00,0x6c,0x61,0x62,0x65,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x74,0x65,0x78,0x74,0x00,0xe5,0xbc,0xa0,0xe4,0xb8,
0x89,0x00,0x00,0x00,0x6c,0x61,0x62,0x65,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x74,0x65,0x78,0x74,0x00,0x39,0x38,0x00,
0x00,0x00,0x6c,0x61,0x62,0x65,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x74,0x65,0x78,0x74,0x00,0x39,0x37,0x00,0x00,0x00,
0x6c,0x61,0x62,0x65,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x74,0x65,0x78,0x74,0x00,0xe6,0x9d,0x8e,0xe5,0x9b,0x9b,0x00,
0x00,0x00,0x6c,0x61,0x62,0x65,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x74,0x65,0x78,0x74,0x00,0x39,0x38,0x00,0x00,0x00,
0x6c,0x61,0x62,0x65,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x74,0x65,0x78,0x74,0x00,0x39,0x37,0x00,0x00,0x00,0x6c,0x61,
0x62,0x65,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x74,0x65,0x78,0x74,0x00,0xe7,0x8e,0x8b,0xe4,0xba,0x94,0x00,0x00,0x00,
0x6c,0x61,0x62,0x65,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x74,0x65,0x78,0x74,0x00,0x39,0x38,0x00,0x00,0x00,0x6c,0x61,
0x62,0x65,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x74,0x65,0x78,0x74,0x00,0x39,0x37,0x00,0x00,0x00,0x6c,0x61,0x62,0x65,
0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x74,0x65,0x78,0x74,0x00,0xe5,0xad,0x99,0xe5,0x85,0xad,0x00,0x00,0x00,0x6c,0x61,
0x62,0x65,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x74,0x65,0x78,0x74,0x00,0x39,0x38,0x00,0x00,0x00,0x6c,0x61,0x62,0x65,
0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x74,0x65,0x78,0x74,0x00,0x39,0x37,0x00,0x00,0x00,0x6c,0x61,0x62,0x65,0x6c,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x74,0x65,0x78,0x74,0x00,0xe8,0xb5,0xb5,0xe4,0xb8,0x83,0x00,0x00,0x00,0x6c,0x61,0x62,0x65,
0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x74,0x65,0x78,0x74,0x00,0x39,0x38,0x00,0x00,0x00,0x6c,0x61,0x62,0x65,0x6c,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x74,0x65,0x78,0x74,0x00,0x39,0x37,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};/*1758*/

View File

@ -1,5 +1,5 @@
TK_CONST_DATA_ALIGN(const unsigned char ui_main[]) = {
0x04,0x00,0x01,0x01,0x60,0x17,0x00,0x00,0x00,0x00,0x00,0x00,0x6d,0x61,0x69,0x6e,0x00,0x00,0x00,0x00,
0x04,0x00,0x01,0x01,0xba,0x17,0x00,0x00,0x00,0x00,0x00,0x00,0x6d,0x61,0x69,0x6e,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x12,0x12,0x22,0x11,0x77,0x69,0x6e,0x64,0x6f,0x77,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
@ -241,63 +241,68 @@ TK_CONST_DATA_ALIGN(const unsigned char ui_main[]) = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x66,0x6f,0x63,
0x75,0x73,0x61,0x62,0x6c,0x65,0x00,0x74,0x72,0x75,0x65,0x00,0x6e,0x61,0x6d,0x65,0x00,0x6f,0x70,0x65,
0x6e,0x3a,0x63,0x6f,0x6c,0x6f,0x72,0x5f,0x74,0x69,0x6c,0x65,0x00,0x74,0x65,0x78,0x74,0x00,0x43,0x6f,
0x6c,0x6f,0x72,0x20,0x54,0x69,0x6c,0x65,0x00,0x00,0x00,0x62,0x75,0x74,0x74,0x6f,0x6e,0x00,0x00,0x00,
0x6e,0x3a,0x67,0x72,0x69,0x64,0x00,0x74,0x65,0x78,0x74,0x00,0x67,0x72,0x69,0x64,0x00,0x00,0x00,0x62,
0x75,0x74,0x74,0x6f,0x6e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x66,
0x6f,0x63,0x75,0x73,0x61,0x62,0x6c,0x65,0x00,0x74,0x72,0x75,0x65,0x00,0x6e,0x61,0x6d,0x65,0x00,0x6f,
0x70,0x65,0x6e,0x3a,0x66,0x6c,0x6f,0x61,0x74,0x69,0x6e,0x67,0x5f,0x6b,0x65,0x79,0x62,0x6f,0x61,0x72,
0x64,0x00,0x74,0x65,0x78,0x74,0x00,0x46,0x6c,0x6f,0x61,0x74,0x69,0x6e,0x67,0x20,0x4b,0x65,0x79,0x62,
0x6f,0x61,0x72,0x64,0x00,0x00,0x00,0x62,0x75,0x74,0x74,0x6f,0x6e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x66,0x6f,0x63,0x75,0x73,
0x61,0x62,0x6c,0x65,0x00,0x74,0x72,0x75,0x65,0x00,0x6e,0x61,0x6d,0x65,0x00,0x6f,0x70,0x65,0x6e,0x3a,
0x73,0x6c,0x69,0x64,0x65,0x72,0x00,0x74,0x65,0x78,0x74,0x00,0x53,0x6c,0x69,0x64,0x65,0x72,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x66,0x6f,0x63,0x75,0x73,0x61,0x62,0x6c,0x65,0x00,0x74,0x72,0x75,
0x65,0x00,0x6e,0x61,0x6d,0x65,0x00,0x6f,0x70,0x65,0x6e,0x3a,0x63,0x6f,0x6c,0x6f,0x72,0x5f,0x74,0x69,
0x6c,0x65,0x00,0x74,0x65,0x78,0x74,0x00,0x43,0x6f,0x6c,0x6f,0x72,0x20,0x54,0x69,0x6c,0x65,0x00,0x00,
0x00,0x62,0x75,0x74,0x74,0x6f,0x6e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x66,0x6f,0x63,0x75,0x73,0x61,0x62,0x6c,0x65,0x00,0x74,
0x72,0x75,0x65,0x00,0x6e,0x61,0x6d,0x65,0x00,0x6f,0x70,0x65,0x6e,0x3a,0x63,0x6c,0x6f,0x73,0x65,0x5f,
0x77,0x69,0x6e,0x64,0x6f,0x77,0x00,0x74,0x65,0x78,0x74,0x00,0x63,0x6c,0x6f,0x73,0x65,0x5f,0x77,0x69,
0x6e,0x64,0x6f,0x77,0x00,0x00,0x00,0x00,0x76,0x69,0x65,0x77,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x64,0x00,0x00,0x00,0x64,0x00,0x00,0x00,0x73,0x65,0x6c,0x66,
0x5f,0x6c,0x61,0x79,0x6f,0x75,0x74,0x00,0x64,0x65,0x66,0x61,0x75,0x6c,0x74,0x28,0x78,0x3d,0x30,0x2c,
0x79,0x3d,0x30,0x2c,0x77,0x3d,0x31,0x30,0x30,0x25,0x2c,0x68,0x3d,0x31,0x30,0x30,0x25,0x29,0x00,0x63,
0x68,0x69,0x6c,0x64,0x72,0x65,0x6e,0x5f,0x6c,0x61,0x79,0x6f,0x75,0x74,0x00,0x64,0x65,0x66,0x61,0x75,
0x6c,0x74,0x28,0x63,0x3d,0x31,0x2c,0x72,0x3d,0x38,0x2c,0x6d,0x3d,0x35,0x2c,0x73,0x3d,0x35,0x29,0x00,
0x00,0x62,0x75,0x74,0x74,0x6f,0x6e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x66,0x6f,0x63,0x75,0x73,0x61,0x62,0x6c,0x65,0x00,0x74,
0x72,0x75,0x65,0x00,0x6e,0x61,0x6d,0x65,0x00,0x6f,0x70,0x65,0x6e,0x3a,0x6d,0x65,0x6d,0x74,0x65,0x73,
0x74,0x00,0x74,0x65,0x78,0x74,0x00,0x4d,0x65,0x6d,0x54,0x65,0x73,0x74,0x00,0x00,0x00,0x62,0x75,0x74,
0x72,0x75,0x65,0x00,0x6e,0x61,0x6d,0x65,0x00,0x6f,0x70,0x65,0x6e,0x3a,0x66,0x6c,0x6f,0x61,0x74,0x69,
0x6e,0x67,0x5f,0x6b,0x65,0x79,0x62,0x6f,0x61,0x72,0x64,0x00,0x74,0x65,0x78,0x74,0x00,0x46,0x6c,0x6f,
0x61,0x74,0x69,0x6e,0x67,0x20,0x4b,0x65,0x79,0x62,0x6f,0x61,0x72,0x64,0x00,0x00,0x00,0x62,0x75,0x74,
0x74,0x6f,0x6e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x66,0x6f,0x63,0x75,0x73,0x61,0x62,0x6c,0x65,0x00,0x74,0x72,0x75,0x65,0x00,
0x6e,0x61,0x6d,0x65,0x00,0x6f,0x70,0x65,0x6e,0x3a,0x63,0x61,0x6c,0x69,0x62,0x72,0x61,0x74,0x69,0x6f,
0x6e,0x5f,0x77,0x69,0x6e,0x00,0x74,0x65,0x78,0x74,0x00,0x43,0x61,0x6c,0x69,0x62,0x72,0x61,0x74,0x69,
0x6f,0x6e,0x00,0x00,0x00,0x62,0x75,0x74,0x74,0x6f,0x6e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x6e,0x61,0x6d,0x65,0x00,0x6f,0x70,0x65,0x6e,0x3a,0x73,0x6c,0x69,0x64,0x65,0x72,0x00,0x74,0x65,0x78,
0x74,0x00,0x53,0x6c,0x69,0x64,0x65,0x72,0x00,0x00,0x00,0x62,0x75,0x74,0x74,0x6f,0x6e,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x66,0x6f,0x63,0x75,0x73,0x61,0x62,
0x6c,0x65,0x00,0x74,0x72,0x75,0x65,0x00,0x6e,0x61,0x6d,0x65,0x00,0x73,0x68,0x6f,0x77,0x5f,0x66,0x70,
0x73,0x00,0x74,0x65,0x78,0x74,0x00,0x53,0x68,0x6f,0x77,0x20,0x46,0x50,0x53,0x00,0x00,0x00,0x62,0x75,
0x74,0x74,0x6f,0x6e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x66,
0x6f,0x63,0x75,0x73,0x61,0x62,0x6c,0x65,0x00,0x74,0x72,0x75,0x65,0x00,0x6e,0x61,0x6d,0x65,0x00,0x6f,
0x70,0x65,0x6e,0x3a,0x63,0x6c,0x6f,0x73,0x65,0x5f,0x77,0x69,0x6e,0x64,0x6f,0x77,0x00,0x74,0x65,0x78,
0x74,0x00,0x63,0x6c,0x6f,0x73,0x65,0x5f,0x77,0x69,0x6e,0x64,0x6f,0x77,0x00,0x00,0x00,0x00,0x76,0x69,
0x65,0x77,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x64,0x00,
0x00,0x00,0x64,0x00,0x00,0x00,0x73,0x65,0x6c,0x66,0x5f,0x6c,0x61,0x79,0x6f,0x75,0x74,0x00,0x64,0x65,
0x66,0x61,0x75,0x6c,0x74,0x28,0x78,0x3d,0x30,0x2c,0x79,0x3d,0x30,0x2c,0x77,0x3d,0x31,0x30,0x30,0x25,
0x2c,0x68,0x3d,0x31,0x30,0x30,0x25,0x29,0x00,0x63,0x68,0x69,0x6c,0x64,0x72,0x65,0x6e,0x5f,0x6c,0x61,
0x79,0x6f,0x75,0x74,0x00,0x64,0x65,0x66,0x61,0x75,0x6c,0x74,0x28,0x63,0x3d,0x31,0x2c,0x72,0x3d,0x38,
0x2c,0x6d,0x3d,0x35,0x2c,0x73,0x3d,0x35,0x29,0x00,0x00,0x62,0x75,0x74,0x74,0x6f,0x6e,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x66,0x6f,0x63,0x75,0x73,0x61,0x62,0x6c,0x65,0x00,0x74,0x72,0x75,0x65,
0x00,0x6e,0x61,0x6d,0x65,0x00,0x73,0x6e,0x61,0x70,0x73,0x68,0x6f,0x74,0x00,0x74,0x65,0x78,0x74,0x00,
0x54,0x61,0x6b,0x65,0x20,0x53,0x6e,0x61,0x70,0x73,0x68,0x6f,0x74,0x00,0x00,0x00,0x62,0x75,0x74,0x74,
0x6f,0x6e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x66,
0x6f,0x63,0x75,0x73,0x61,0x62,0x6c,0x65,0x00,0x74,0x72,0x75,0x65,0x00,0x6e,0x61,0x6d,0x65,0x00,0x6f,
0x70,0x65,0x6e,0x3a,0x6d,0x65,0x6d,0x74,0x65,0x73,0x74,0x00,0x74,0x65,0x78,0x74,0x00,0x4d,0x65,0x6d,
0x54,0x65,0x73,0x74,0x00,0x00,0x00,0x62,0x75,0x74,0x74,0x6f,0x6e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x66,0x6f,0x63,0x75,0x73,0x61,0x62,0x6c,0x65,0x00,0x74,0x72,0x75,0x65,0x00,0x6e,
0x61,0x6d,0x65,0x00,0x72,0x65,0x6c,0x6f,0x61,0x64,0x5f,0x74,0x68,0x65,0x6d,0x65,0x00,0x74,0x65,0x78,
0x74,0x00,0x54,0x65,0x73,0x74,0x20,0x43,0x68,0x61,0x6e,0x67,0x65,0x20,0x54,0x68,0x65,0x6d,0x65,0x00,
0x00,0x00,0x62,0x75,0x74,0x74,0x6f,0x6e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x66,0x6f,0x63,0x75,0x73,
0x61,0x62,0x6c,0x65,0x00,0x74,0x72,0x75,0x65,0x00,0x6e,0x61,0x6d,0x65,0x00,0x6f,0x70,0x65,0x6e,0x3a,
0x63,0x61,0x6c,0x69,0x62,0x72,0x61,0x74,0x69,0x6f,0x6e,0x5f,0x77,0x69,0x6e,0x00,0x74,0x65,0x78,0x74,
0x00,0x43,0x61,0x6c,0x69,0x62,0x72,0x61,0x74,0x69,0x6f,0x6e,0x00,0x00,0x00,0x62,0x75,0x74,0x74,0x6f,
0x6e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x66,0x6f,0x63,0x75,0x73,0x61,0x62,0x6c,0x65,0x00,
0x74,0x72,0x75,0x65,0x00,0x6e,0x61,0x6d,0x65,0x00,0x65,0x78,0x69,0x74,0x00,0x74,0x65,0x78,0x74,0x00,
0x45,0x78,0x69,0x74,0x00,0x00,0x00,0x00,0x00,0x73,0x6c,0x69,0x64,0x65,0x5f,0x69,0x6e,0x64,0x69,0x63,
0x61,0x74,0x6f,0x72,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x64,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x73,0x65,0x6c,
0x66,0x5f,0x6c,0x61,0x79,0x6f,0x75,0x74,0x00,0x64,0x65,0x66,0x61,0x75,0x6c,0x74,0x28,0x78,0x3d,0x30,
0x2c,0x79,0x3d,0x62,0x2c,0x77,0x3d,0x31,0x30,0x30,0x25,0x2c,0x68,0x3d,0x32,0x30,0x29,0x00,0x74,0x72,
0x61,0x6e,0x73,0x69,0x74,0x69,0x6f,0x6e,0x00,0x74,0x72,0x75,0x65,0x00,0x73,0x74,0x79,0x6c,0x65,0x00,
0x62,0x6c,0x75,0x65,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};/*6032*/
0x00,0x00,0x00,0x66,0x6f,0x63,0x75,0x73,0x61,0x62,0x6c,0x65,0x00,0x74,0x72,0x75,0x65,0x00,0x6e,0x61,
0x6d,0x65,0x00,0x73,0x68,0x6f,0x77,0x5f,0x66,0x70,0x73,0x00,0x74,0x65,0x78,0x74,0x00,0x53,0x68,0x6f,
0x77,0x20,0x46,0x50,0x53,0x00,0x00,0x00,0x62,0x75,0x74,0x74,0x6f,0x6e,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x66,0x6f,0x63,0x75,
0x73,0x61,0x62,0x6c,0x65,0x00,0x74,0x72,0x75,0x65,0x00,0x6e,0x61,0x6d,0x65,0x00,0x73,0x6e,0x61,0x70,
0x73,0x68,0x6f,0x74,0x00,0x74,0x65,0x78,0x74,0x00,0x54,0x61,0x6b,0x65,0x20,0x53,0x6e,0x61,0x70,0x73,
0x68,0x6f,0x74,0x00,0x00,0x00,0x62,0x75,0x74,0x74,0x6f,0x6e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x66,0x6f,0x63,0x75,0x73,0x61,
0x62,0x6c,0x65,0x00,0x74,0x72,0x75,0x65,0x00,0x6e,0x61,0x6d,0x65,0x00,0x72,0x65,0x6c,0x6f,0x61,0x64,
0x5f,0x74,0x68,0x65,0x6d,0x65,0x00,0x74,0x65,0x78,0x74,0x00,0x54,0x65,0x73,0x74,0x20,0x43,0x68,0x61,
0x6e,0x67,0x65,0x20,0x54,0x68,0x65,0x6d,0x65,0x00,0x00,0x00,0x62,0x75,0x74,0x74,0x6f,0x6e,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x66,0x6f,0x63,0x75,0x73,0x61,0x62,0x6c,0x65,0x00,0x74,0x72,0x75,0x65,0x00,0x6e,0x61,0x6d,0x65,0x00,
0x65,0x78,0x69,0x74,0x00,0x74,0x65,0x78,0x74,0x00,0x45,0x78,0x69,0x74,0x00,0x00,0x00,0x00,0x00,0x73,
0x6c,0x69,0x64,0x65,0x5f,0x69,0x6e,0x64,0x69,0x63,0x61,0x74,0x6f,0x72,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x64,
0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x73,0x65,0x6c,0x66,0x5f,0x6c,0x61,0x79,0x6f,0x75,0x74,0x00,0x64,
0x65,0x66,0x61,0x75,0x6c,0x74,0x28,0x78,0x3d,0x30,0x2c,0x79,0x3d,0x62,0x2c,0x77,0x3d,0x31,0x30,0x30,
0x25,0x2c,0x68,0x3d,0x32,0x30,0x29,0x00,0x74,0x72,0x61,0x6e,0x73,0x69,0x74,0x69,0x6f,0x6e,0x00,0x74,
0x72,0x75,0x65,0x00,0x73,0x74,0x79,0x6c,0x65,0x00,0x62,0x6c,0x75,0x65,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,};/*6122*/

Binary file not shown.

Binary file not shown.

View File

@ -167,6 +167,7 @@
#include "assets/default/inc/ui/image_value.data"
#include "assets/default/inc/ui/slide_view.data"
#include "assets/default/inc/ui/time_clock.data"
#include "assets/default/inc/ui/grid.data"
#include "assets/default/inc/ui/tab_top.data"
#include "assets/default/inc/ui/slide_view_v.data"
#include "assets/default/inc/ui/top.data"
@ -1044,6 +1045,7 @@ ret_t assets_init(void) {
assets_manager_add(am, ui_image_value);
assets_manager_add(am, ui_slide_view);
assets_manager_add(am, ui_time_clock);
assets_manager_add(am, ui_grid);
assets_manager_add(am, ui_tab_top);
assets_manager_add(am, ui_slide_view_v);
assets_manager_add(am, ui_top);

View File

@ -167,6 +167,7 @@
#include "assets/default/inc/ui/image_value.data"
#include "assets/default/inc/ui/slide_view.data"
#include "assets/default/inc/ui/time_clock.data"
#include "assets/default/inc/ui/grid.data"
#include "assets/default/inc/ui/tab_top.data"
#include "assets/default/inc/ui/slide_view_v.data"
#include "assets/default/inc/ui/top.data"
@ -1044,6 +1045,7 @@ ret_t assets_init(void) {
assets_manager_add(am, ui_image_value);
assets_manager_add(am, ui_slide_view);
assets_manager_add(am, ui_time_clock);
assets_manager_add(am, ui_grid);
assets_manager_add(am, ui_tab_top);
assets_manager_add(am, ui_slide_view_v);
assets_manager_add(am, ui_top);

View File

@ -162,6 +162,7 @@
#include "assets/default/inc/ui/image_value.data"
#include "assets/default/inc/ui/slide_view.data"
#include "assets/default/inc/ui/time_clock.data"
#include "assets/default/inc/ui/grid.data"
#include "assets/default/inc/ui/tab_top.data"
#include "assets/default/inc/ui/slide_view_v.data"
#include "assets/default/inc/ui/top.data"
@ -669,6 +670,7 @@ ret_t assets_init(void) {
assets_manager_add(am, ui_image_value);
assets_manager_add(am, ui_slide_view);
assets_manager_add(am, ui_time_clock);
assets_manager_add(am, ui_grid);
assets_manager_add(am, ui_tab_top);
assets_manager_add(am, ui_slide_view_v);
assets_manager_add(am, ui_top);

View File

@ -162,6 +162,7 @@
#include "assets/default/inc/ui/image_value.data"
#include "assets/default/inc/ui/slide_view.data"
#include "assets/default/inc/ui/time_clock.data"
#include "assets/default/inc/ui/grid.data"
#include "assets/default/inc/ui/tab_top.data"
#include "assets/default/inc/ui/slide_view_v.data"
#include "assets/default/inc/ui/top.data"
@ -669,6 +670,7 @@ ret_t assets_init(void) {
assets_manager_add(am, ui_image_value);
assets_manager_add(am, ui_slide_view);
assets_manager_add(am, ui_time_clock);
assets_manager_add(am, ui_grid);
assets_manager_add(am, ui_tab_top);
assets_manager_add(am, ui_slide_view_v);
assets_manager_add(am, ui_top);

View File

@ -298,6 +298,24 @@ BEGIN_C_DECLS
*/
#define STYLE_ID_CLEAR_BG "clear_bg"
/**
* @const STYLE_ID_GRID_COLOR
* 线(grid控件)
*/
#define STYLE_ID_GRID_COLOR "grid_color"
/**
* @const STYLE_ID_EVEN_BG_COLOR
* (grid控件)
*/
#define STYLE_ID_EVEN_BG_COLOR "even_bg_color"
/**
* @const STYLE_ID_ODD_BG_COLOR
* (grid控件)
*/
#define STYLE_ID_ODD_BG_COLOR "odd_bg_color"
struct _style_t;
typedef struct _style_t style_t;

View File

@ -1007,6 +1007,24 @@ BEGIN_C_DECLS
*/
#define WIDGET_PROP_MOVE_FOCUS_RIGHT_KEY "move_focus_right_key"
/**
* @const WIDGET_PROP_ROWS
*
*/
#define WIDGET_PROP_ROWS "rows"
/**
* @const WIDGET_PROP_SHOW_GRID
* 线
*/
#define WIDGET_PROP_SHOW_GRID "show_grid"
/**
* @const WIDGET_PROP_COLUMNS_DEFINITION
*
*/
#define WIDGET_PROP_COLUMNS_DEFINITION "columns_definition"
/**
* @enum widget_type_t
* @annotation ["scriptable", "string"]

View File

@ -1,9 +1,9 @@
/**
* File: grid.h
* File: grid.c
* Author: AWTK Develop Team
* Brief: grid
* Brief:
*
* Copyright (c) 2018 - 2022 Guangzhou ZHIYUAN Electronics Co.,Ltd.
* Copyright (c) 2022 - 2022 Guangzhou ZHIYUAN Electronics Co.,Ltd.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -15,20 +15,400 @@
/**
* History:
* ================================================================
* 2018-08-29 Li XianJing <xianjimli@hotmail.com> created
* 2022-06-18 Li XianJing <xianjimli@hotmail.com> created
*
*/
#include "tkc/mem.h"
#include "widgets/grid.h"
#include "tkc/utils.h"
#include "tkc/tokenizer.h"
#include "tkc/func_call_parser.h"
#include "grid.h"
#include "base/layout.h"
typedef struct _column_definition_t {
double w;
uint8_t left_margin;
uint8_t right_margin;
uint8_t top_margin;
uint8_t bottom_margin;
/*用于临时存储*/
uint32_t real_w;
} column_definition_t;
typedef struct _column_definition_parser_t {
func_call_parser_t parser;
column_definition_t* definition;
} column_definition_parser_t;
static ret_t column_definition_on_param(func_call_parser_t* parser, const char* name,
const char* value) {
column_definition_parser_t* p = (column_definition_parser_t*)parser;
switch (*name) {
case 'w': {
p->definition->w = tk_atof(value);
break;
}
case 'l': {
p->definition->left_margin = tk_atoi(value);
break;
}
case 'r': {
p->definition->right_margin = tk_atoi(value);
break;
}
case 't': {
p->definition->top_margin = tk_atoi(value);
break;
}
case 'b': {
p->definition->bottom_margin = tk_atoi(value);
break;
}
case 'm': {
int32_t margin = tk_atoi(value);
p->definition->top_margin = margin;
p->definition->bottom_margin = margin;
p->definition->left_margin = margin;
p->definition->right_margin = margin;
break;
}
default:
break;
}
return RET_OK;
}
static column_definition_t* column_definition_create(const char* str) {
column_definition_parser_t p;
column_definition_t* definition = TKMEM_ZALLOC(column_definition_t);
return_value_if_fail(definition != NULL, NULL);
func_call_parser_init(&(p.parser), str, tk_strlen(str));
p.parser.on_name = NULL;
p.parser.on_done = NULL;
p.definition = definition;
p.parser.on_param = column_definition_on_param;
func_call_parser_parse(&(p.parser));
func_call_parser_deinit(&(p.parser));
assert(definition->w > 0);
return definition;
}
static ret_t column_definition_destroy(column_definition_t* definition) {
TKMEM_FREE(definition);
return RET_OK;
}
static ret_t grid_parse_columns_definition(widget_t* widget, const char* definitions) {
tokenizer_t t;
grid_t* grid = GRID(widget);
return_value_if_fail(tokenizer_init(&t, definitions, strlen(definitions), ";") != NULL,
RET_BAD_PARAMS);
while (tokenizer_has_more(&t)) {
const char* iter = tokenizer_next(&t);
column_definition_t* col = column_definition_create(iter);
break_if_fail(col != NULL);
if (darray_push(&(grid->cols_definition), col) != RET_OK) {
column_definition_destroy(col);
break;
}
}
tokenizer_deinit(&t);
return RET_OK;
}
ret_t grid_set_rows(widget_t* widget, uint32_t rows) {
grid_t* grid = GRID(widget);
return_value_if_fail(grid != NULL, RET_BAD_PARAMS);
grid->rows = rows;
return RET_OK;
}
ret_t grid_set_columns_definition(widget_t* widget, const char* columns_definition) {
grid_t* grid = GRID(widget);
return_value_if_fail(grid != NULL, RET_BAD_PARAMS);
grid->columns_definition = tk_str_copy(grid->columns_definition, columns_definition);
darray_clear(&(grid->cols_definition));
if (grid->columns_definition != NULL) {
grid_parse_columns_definition(widget, grid->columns_definition);
}
return RET_OK;
}
ret_t grid_set_show_grid(widget_t* widget, bool_t show_grid) {
grid_t* grid = GRID(widget);
return_value_if_fail(grid != NULL, RET_BAD_PARAMS);
grid->show_grid = show_grid;
return RET_OK;
}
static ret_t grid_get_prop(widget_t* widget, const char* name, value_t* v) {
grid_t* grid = GRID(widget);
return_value_if_fail(grid != NULL && name != NULL && v != NULL, RET_BAD_PARAMS);
if (tk_str_eq(WIDGET_PROP_ROWS, name)) {
value_set_uint32(v, grid->rows);
return RET_OK;
} else if (tk_str_eq(WIDGET_PROP_COLUMNS_DEFINITION, name)) {
value_set_str(v, grid->columns_definition);
return RET_OK;
} else if (tk_str_eq(WIDGET_PROP_SHOW_GRID, name)) {
value_set_bool(v, grid->show_grid);
return RET_OK;
}
return RET_NOT_FOUND;
}
static ret_t grid_set_prop(widget_t* widget, const char* name, const value_t* v) {
return_value_if_fail(widget != NULL && name != NULL && v != NULL, RET_BAD_PARAMS);
if (tk_str_eq(WIDGET_PROP_ROWS, name)) {
grid_set_rows(widget, value_uint32(v));
return RET_OK;
} else if (tk_str_eq(WIDGET_PROP_COLUMNS_DEFINITION, name)) {
grid_set_columns_definition(widget, value_str(v));
return RET_OK;
} else if (tk_str_eq(WIDGET_PROP_SHOW_GRID, name)) {
grid_set_show_grid(widget, value_bool(v));
return RET_OK;
}
return RET_NOT_FOUND;
}
static ret_t grid_on_destroy(widget_t* widget) {
grid_t* grid = GRID(widget);
return_value_if_fail(widget != NULL && grid != NULL, RET_BAD_PARAMS);
TKMEM_FREE(grid->columns_definition);
darray_deinit(&(grid->cols_definition));
return RET_OK;
}
static ret_t grid_on_paint_self(widget_t* widget, canvas_t* c) {
grid_t* grid = GRID(widget);
(void)grid;
return RET_OK;
}
static ret_t grid_on_event(widget_t* widget, event_t* e) {
grid_t* grid = GRID(widget);
return_value_if_fail(widget != NULL && grid != NULL, RET_BAD_PARAMS);
(void)grid;
return RET_OK;
}
static ret_t grid_on_layout_children_impl(widget_t* widget) {
uint32_t i = 0;
int32_t tw = 0;
uint32_t cols = 0;
int32_t ox = 0;
int32_t row_height = 0;
grid_t* grid = GRID(widget);
return_value_if_fail(grid != NULL && grid->rows > 0, RET_BAD_PARAMS);
return_value_if_fail(grid->cols_definition.size > 0, RET_BAD_PARAMS);
cols = grid->cols_definition.size;
row_height = widget->h / grid->rows;
for (i = 0; i < cols; i++) {
column_definition_t* def = (column_definition_t*)darray_get(&(grid->cols_definition), i);
if (def->w <= 1) {
def->real_w = def->w * widget->w;
} else {
def->real_w = def->w;
}
tw += def->real_w;
}
assert(tw <= widget->w);
WIDGET_FOR_EACH_CHILD_BEGIN(widget, iter, i)
uint32_t row = i / cols;
uint32_t col = i % cols;
column_definition_t* def = (column_definition_t*)darray_get(&(grid->cols_definition), col);
int32_t x = def->left_margin + ox;
int32_t y = def->top_margin + row * row_height;
int32_t w = def->real_w - def->left_margin - def->right_margin;
int32_t h = row_height - def->top_margin - def->bottom_margin;
assert(w > 0 && h > 0);
assert(w <= widget->w);
assert(h <= row_height);
widget_move_resize_ex(iter, x, y, w, h, FALSE);
if (iter->self_layout) {
rect_t area = rect_init(x, y, w, h);
self_layouter_layout(iter->self_layout, iter, &area);
}
widget_layout_children(iter);
if ((col + 1) == cols) {
ox = 0;
} else {
ox += def->real_w;
}
WIDGET_FOR_EACH_CHILD_END();
return RET_OK;
}
static ret_t grid_on_layout_children(widget_t* widget) {
grid_t* grid = GRID(widget);
return_value_if_fail(widget != NULL, RET_BAD_PARAMS);
if (widget->children_layout != NULL) {
widget_layout_children_default(widget);
} else if (grid->rows > 0 && grid->columns_definition != NULL) {
grid_on_layout_children_impl(widget);
}
return RET_OK;
}
const char* s_grid_properties[] = {WIDGET_PROP_ROWS, WIDGET_PROP_COLUMNS_DEFINITION,
WIDGET_PROP_SHOW_GRID, NULL};
static ret_t grid_draw_grid(widget_t* widget, canvas_t* c) {
uint32_t x = 0;
uint32_t y = 0;
uint32_t row = 0;
uint32_t col = 0;
uint32_t cols = 0;
int32_t row_height = 0;
grid_t* grid = GRID(widget);
color_t grid_color = color_init(0, 0, 0, 0xff);
return_value_if_fail(grid != NULL && grid->rows > 0, RET_BAD_PARAMS);
return_value_if_fail(grid->cols_definition.size > 0, RET_BAD_PARAMS);
grid_color = style_get_color(widget->astyle, STYLE_ID_GRID_COLOR, grid_color);
cols = grid->cols_definition.size;
row_height = widget->h / grid->rows;
canvas_set_stroke_color(c, grid_color);
for (row = 0; row < grid->rows; row++) {
if (row) {
canvas_draw_hline(c, 0, y, widget->w);
}
y += row_height;
}
for (col = 0; col < cols; col++) {
column_definition_t* def = (column_definition_t*)darray_get(&(grid->cols_definition), col);
if (col) {
canvas_draw_vline(c, x, 0, widget->h);
}
x += def->real_w;
}
return RET_OK;
}
static ret_t grid_on_paint_border(widget_t* widget, canvas_t* c) {
grid_t* grid = GRID(widget);
if (grid->show_grid && widget->astyle != NULL) {
rect_t r = rect_init(0, 0, widget->w, widget->h);
grid_draw_grid(widget, c);
widget_stroke_border_rect(widget, c, &r);
}
return RET_OK;
}
static ret_t grid_on_paint_background_impl(widget_t* widget, canvas_t* c) {
grid_t* grid = GRID(widget);
return_value_if_fail(grid != NULL && grid->rows > 0, RET_BAD_PARAMS);
return_value_if_fail(grid->cols_definition.size > 0, RET_BAD_PARAMS);
if (widget->astyle != NULL) {
uint32_t i = 0;
uint32_t row_height = widget->h / grid->rows;
color_t trans = color_init(0, 0, 0, 0);
color_t bg = style_get_color(widget->astyle, STYLE_ID_BG_COLOR, trans);
color_t odd_bg = style_get_color(widget->astyle, STYLE_ID_ODD_BG_COLOR, bg);
color_t even_bg = style_get_color(widget->astyle, STYLE_ID_EVEN_BG_COLOR, bg);
if (odd_bg.rgba.a == 0 && even_bg.rgba.a == 0) {
return RET_OK;
}
for (i = 0; i < grid->rows; i++) {
rect_t r = rect_init(0, i * row_height, widget->w, row_height);
canvas_set_fill_color(c, ((i % 2) == 0) ? even_bg : odd_bg);
canvas_fill_rect(c, r.x, r.y, r.w, r.h);
}
}
return RET_OK;
}
static ret_t grid_on_paint_background(widget_t* widget, canvas_t* c) {
grid_t* grid = GRID(widget);
return_value_if_fail(grid != NULL, RET_BAD_PARAMS);
if (grid->rows > 0 && grid->cols_definition.size > 0) {
grid_on_paint_background_impl(widget, c);
} else {
widget_draw_background(widget, c);
}
return RET_OK;
}
TK_DECL_VTABLE(grid) = {.size = sizeof(grid_t),
.type = WIDGET_TYPE_ROW,
.type = WIDGET_TYPE_GRID,
.clone_properties = s_grid_properties,
.persistent_properties = s_grid_properties,
.parent = TK_PARENT_VTABLE(widget),
.create = grid_create};
.create = grid_create,
.on_paint_self = grid_on_paint_self,
.set_prop = grid_set_prop,
.get_prop = grid_get_prop,
.on_event = grid_on_event,
.on_layout_children = grid_on_layout_children,
.on_paint_border = grid_on_paint_border,
.on_paint_background = grid_on_paint_background,
.on_destroy = grid_on_destroy};
widget_t* grid_create(widget_t* parent, xy_t x, xy_t y, wh_t w, wh_t h) {
return widget_create(parent, TK_REF_VTABLE(grid), x, y, w, h);
widget_t* widget = widget_create(parent, TK_REF_VTABLE(grid), x, y, w, h);
grid_t* grid = GRID(widget);
return_value_if_fail(grid != NULL, NULL);
grid->rows = 3;
grid->show_grid = FALSE;
grid->columns_definition = NULL;
darray_init(&(grid->cols_definition), 5, (tk_destroy_t)column_definition_destroy, NULL);
return widget;
}
widget_t* grid_cast(widget_t* widget) {

View File

@ -1,96 +1,158 @@
/**
* File: grid.h
* Author: AWTK Develop Team
* Brief: grid
*
* Copyright (c) 2018 - 2022 Guangzhou ZHIYUAN Electronics Co.,Ltd.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* License file for more details.
*
*/
/**
* History:
* ================================================================
* 2018-08-29 Li XianJing <xianjimli@hotmail.com> created
*
*/
#ifndef TK_GRID_H
#define TK_GRID_H
#include "base/widget.h"
BEGIN_C_DECLS
/**
* @class grid_t
* @parent widget_t
* @annotation ["scriptable","design","widget"]
* grid控件
*
* xml更具有可读性
* layout\_children属性指定
* [](https://github.com/zlgopen/awtk/blob/master/docs/layout.md)。
*
* grid\_t是[widget\_t](widget_t.md)widget\_t的函数均适用于grid\_t控件
*
* xml中使用"grid"grid
*
* ```xml
* <grid x="0" y="0" w="100%" h="100%" children_layout="default(c=2,r=2,m=5,s=5)">
* <button name="open:basic" text="Basic"/>
* <button name="open:button" text="Buttons"/>
* <button name="open:edit" text="Edits"/>
* <button name="open:keyboard" text="KeyBoard"/>
* </grid>
* ```
*
* style来设置控件的显示风格
*
* ```xml
* <style name="default" border_color="#a0a0a0">
* <normal bg_color="#f0f0f0" />
* </style>
* ```
*
*/
typedef struct _grid_t {
widget_t widget;
} grid_t;
/**
* @method grid_create
* grid对象
* @annotation ["constructor", "scriptable"]
* @param {widget_t*} parent
* @param {xy_t} x x坐标
* @param {xy_t} y y坐标
* @param {wh_t} w
* @param {wh_t} h
*
* @return {widget_t*}
*/
widget_t* grid_create(widget_t* parent, xy_t x, xy_t y, wh_t w, wh_t h);
/**
* @method grid_cast
* grid对象(使)
* @annotation ["cast", "scriptable"]
* @param {widget_t*} widget grid对象
*
* @return {widget_t*} grid对象
*/
widget_t* grid_cast(widget_t* widget);
#define GRID(widget) ((grid_t*)(grid_cast(WIDGET(widget))))
/*public for subclass and runtime type check*/
TK_EXTERN_VTABLE(grid);
END_C_DECLS
#endif /*TK_GRID_H*/
/**
* File: grid.h
* Author: AWTK Develop Team
* Brief:
*
* Copyright (c) 2022 - 2022 Guangzhou ZHIYUAN Electronics Co.,Ltd.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* License file for more details.
*
*/
/**
* History:
* ================================================================
* 2022-06-18 Li XianJing <xianjimli@hotmail.com> created
*
*/
#ifndef TK_GRID_H
#define TK_GRID_H
#include "base/widget.h"
BEGIN_C_DECLS
/**
* @class grid_t
* @parent widget_t
* @annotation ["scriptable","design","widget"]
*
* xml中使用"grid"
*
* ```xml
* <!-- ui -->
* <grid x="c" y="50" w="100" h="100"/>
* ```
*
* style来设置控件的显示风格
*
* ```xml
* <!-- style -->
* <grid>
* <style name="default" grid_color="gray" border_color="black" odd_bg_color="#f5f5f5" even_bg_color="#eeeeee">
* <normal />
* </style>
* </grid>
* ```
*/
typedef struct _grid_t {
widget_t widget;
/**
* @property {uint32_t} rows
* @annotation ["set_prop","get_prop","readable","persitent","design","scriptable"]
*
*/
uint32_t rows;
/**
* @property {char*} columns_definition
* @annotation ["set_prop","get_prop","readable","persitent","design","scriptable"]
*
* (;)
*
* col(w=?,left_margin=?,right_margin=?,top_maorgin=?,bottom_margin=?)
*
* * w ()(0-1]grid控件宽度的比例
* * left_margin(l)
* * right_margin(r)
* * top_margin(t)
* * bottom_margin(b)
* * margin(m) 4
*
*/
char* columns_definition;
/**
* @property {bool_t} show_grid
* @annotation ["set_prop","get_prop","readable","persitent","design","scriptable"]
*
*/
bool_t show_grid;
/*private*/
darray_t cols_definition;
} grid_t;
/**
* @method grid_create
* @annotation ["constructor", "scriptable"]
* grid对象
* @param {widget_t*} parent
* @param {xy_t} x x坐标
* @param {xy_t} y y坐标
* @param {wh_t} w
* @param {wh_t} h
*
* @return {widget_t*} grid对象
*/
widget_t* grid_create(widget_t* parent, xy_t x, xy_t y, wh_t w, wh_t h);
/**
* @method grid_cast
* grid对象(使)
* @annotation ["cast", "scriptable"]
* @param {widget_t*} widget grid对象
*
* @return {widget_t*} grid对象
*/
widget_t* grid_cast(widget_t* widget);
/**
* @method grid_set_rows
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
* @param {uint32_t} rows
*
* @return {ret_t} RET_OK表示成功
*/
ret_t grid_set_rows(widget_t* widget, uint32_t rows);
/**
* @method grid_set_columns_definition
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
* @param {const char*} columns_definition
*
* @return {ret_t} RET_OK表示成功
*/
ret_t grid_set_columns_definition(widget_t* widget, const char* columns_definition);
/**
* @method grid_set_show_grid
*
* @annotation ["scriptable"]
* @param {widget_t*} widget widget对象
* @param {bool_t} show_grid
*
* @return {ret_t} RET_OK表示成功
*/
ret_t grid_set_show_grid(widget_t* widget, bool_t show_grid);
#define GRID(widget) ((grid_t*)(grid_cast(WIDGET(widget))))
/*public for subclass and runtime type check*/
TK_EXTERN_VTABLE(grid);
END_C_DECLS
#endif /*TK_GRID_H*/

View File

@ -1,10 +1,99 @@
#include "widgets/grid.h"
#include "widgets/button.h"
#include "gtest/gtest.h"
TEST(Grid, cast) {
widget_t* w = grid_create(NULL, 10, 20, 30, 40);
TEST(Grid, basic1) {
widget_t* w = grid_create(NULL, 10, 20, 300, 120);
grid_t* g = GRID(w);
ASSERT_EQ(w, grid_cast(w));
ASSERT_EQ(grid_set_show_grid(w, TRUE), RET_OK);
ASSERT_EQ(g->show_grid, TRUE);
ASSERT_EQ(grid_set_show_grid(w, FALSE), RET_OK);
ASSERT_EQ(g->show_grid, FALSE);
ASSERT_EQ(grid_set_rows(w, 2), RET_OK);
ASSERT_EQ(g->rows, 2);
ASSERT_EQ(grid_set_columns_definition(w, "col(w=100,margin=2)"), RET_OK);
ASSERT_STREQ(g->columns_definition, "col(w=100,margin=2)");
ASSERT_EQ(g->cols_definition.size, 1);
widget_destroy(w);
idle_dispatch();
}
TEST(Grid, layout) {
widget_t* w = grid_create(NULL, 10, 20, 200, 80);
widget_t* b1 = button_create(w, 0, 0, 0, 0);
widget_t* b2 = button_create(w, 0, 0, 0, 0);
widget_t* b3 = button_create(w, 0, 0, 0, 0);
widget_t* b4 = button_create(w, 0, 0, 0, 0);
grid_t* g = GRID(w);
grid_set_rows(w, 2);
ASSERT_EQ(grid_set_columns_definition(w, "col(w=0.4,margin=2);col(w=0.6,margin=2);"), RET_OK);
ASSERT_EQ(g->cols_definition.size, 2);
widget_layout(w);
ASSERT_EQ(b1->x, 2);
ASSERT_EQ(b1->y, 2);
ASSERT_EQ(b1->w, 76);
ASSERT_EQ(b1->h, 36);
ASSERT_EQ(b2->x, 82);
ASSERT_EQ(b2->y, 2);
ASSERT_EQ(b2->w, 116);
ASSERT_EQ(b2->h, 36);
ASSERT_EQ(b3->x, 2);
ASSERT_EQ(b3->y, 42);
ASSERT_EQ(b3->w, 76);
ASSERT_EQ(b3->h, 36);
ASSERT_EQ(b4->x, 82);
ASSERT_EQ(b4->y, 42);
ASSERT_EQ(b4->w, 116);
ASSERT_EQ(b4->h, 36);
widget_destroy(w);
idle_dispatch();
}
TEST(Grid, layout2) {
widget_t* w = grid_create(NULL, 10, 20, 200, 80);
widget_t* b1 = button_create(w, 0, 0, 0, 0);
widget_t* b2 = button_create(w, 0, 0, 0, 0);
widget_t* b3 = button_create(w, 0, 0, 0, 0);
widget_t* b4 = button_create(w, 0, 0, 0, 0);
grid_t* g = GRID(w);
grid_set_rows(w, 2);
ASSERT_EQ(grid_set_columns_definition(w, "col(w=80,margin=2);col(w=120,margin=2);"), RET_OK);
ASSERT_EQ(g->cols_definition.size, 2);
widget_layout(w);
ASSERT_EQ(b1->x, 2);
ASSERT_EQ(b1->y, 2);
ASSERT_EQ(b1->w, 76);
ASSERT_EQ(b1->h, 36);
ASSERT_EQ(b2->x, 82);
ASSERT_EQ(b2->y, 2);
ASSERT_EQ(b2->w, 116);
ASSERT_EQ(b2->h, 36);
ASSERT_EQ(b3->x, 2);
ASSERT_EQ(b3->y, 42);
ASSERT_EQ(b3->w, 76);
ASSERT_EQ(b3->h, 36);
ASSERT_EQ(b4->x, 82);
ASSERT_EQ(b4->y, 42);
ASSERT_EQ(b4->w, 116);
ASSERT_EQ(b4->h, 36);
widget_destroy(w);
idle_dispatch();