improve text selector

This commit is contained in:
lixianjing 2023-09-14 07:10:58 +08:00
parent 9c4e84a03f
commit 86d5877fc1
6 changed files with 94 additions and 30 deletions

View File

@ -4,10 +4,13 @@
<text_selector options="1-12-%02d" loop_options="true" selected_index="0" animation="selected_index(from=11, to=0, repeat_times=0, easing=linear, duration=12000)" /> <text_selector options="1-12-%02d" loop_options="true" selected_index="0" animation="selected_index(from=11, to=0, repeat_times=0, easing=linear, duration=12000)" />
<text_selector options="1-31-%02d" loop_options="true" selected_index="0" animation="selected_index(from=0, to=30, repeat_times=0, easing=linear, duration=30000)" /> <text_selector options="1-31-%02d" loop_options="true" selected_index="0" animation="selected_index(from=0, to=30, repeat_times=0, easing=linear, duration=30000)" />
</row> </row>
<button name="close" x="center" y="middle" w="50%" h="30" text="close"/> <button name="close" x="center" y="middle:-15" w="50%" h="30" text="close"/>
<row x="10" y="bottom:30" w="100%" h="90" children_layout="default(row=1,col=3)"> <row x="0" y="middle:55" w="100%" h="90" children_layout="default(c=1,r=1,x=20,s=20)">
<text_selector style="dark" options="2000-2050" visible_nr="3" text="2018"/> <text_selector ellipses="true" loop_options="true" visible_nr="3" style:normal:border_color="#000000" options="this is long text option! this is long text option! this is long text option! this is long text option! this is long text option! this is long text option!;this is normal text option!;ellipses test"/>
<text_selector options="0-60-%02d-5" visible_nr="3" text="05"/>
<text_selector options="red;green;blue;gold;orange" visible_nr="3" text="red"/>
</row> </row>
</window> <row x="10" y="bottom:20" w="100%" h="90" children_layout="default(row=1,col=3)">
<text_selector style="dark" visible_nr="3" text="2018" options="2000-2050"/>
<text_selector visible_nr="3" text="05" options="0-60-%02d-5"/>
<text_selector visible_nr="3" text="red" options="red;green;blue;gold;orange"/>
</row>
</window>

View File

@ -2,6 +2,7 @@
2023/09/13 2023/09/13
* 增加[如何将资源编译到应用程序并使用它们](how_to_compile_res_into_app_and_use_them.md) (感谢雨欣提供补丁) * 增加[如何将资源编译到应用程序并使用它们](how_to_compile_res_into_app_and_use_them.md) (感谢雨欣提供补丁)
* 为 text\_selector 新增文本缩写功能(感谢颖健提供补丁)
2023/09/11 2023/09/11
* 增加 ASSERT\_STREQ\_UNIX\_FILE * 增加 ASSERT\_STREQ\_UNIX\_FILE

View File

@ -1,5 +1,5 @@
TK_CONST_DATA_ALIGN(const unsigned char ui_text_selector[]) = { TK_CONST_DATA_ALIGN(const unsigned char ui_text_selector[]) = {
0x04,0x00,0x01,0x01,0xff,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x74,0x65,0x78,0x74,0x5f,0x73,0x65,0x6c, 0x04,0x00,0x01,0x01,0xe0,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x74,0x65,0x78,0x74,0x5f,0x73,0x65,0x6c,
0x65,0x63,0x74,0x6f,0x72,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x65,0x63,0x74,0x6f,0x72,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,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,0x00,0x00,0x00,
@ -41,28 +41,52 @@ TK_CONST_DATA_ALIGN(const unsigned char ui_text_selector[]) = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x32,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x73,0x65,0x6c,0x66,0x5f,0x6c,0x61,0x79,0x6f, 0x00,0x00,0x00,0x32,0x00,0x00,0x00,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,0x63,0x65,0x6e,0x74,0x65,0x72,0x2c, 0x75,0x74,0x00,0x64,0x65,0x66,0x61,0x75,0x6c,0x74,0x28,0x78,0x3d,0x63,0x65,0x6e,0x74,0x65,0x72,0x2c,
0x79,0x3d,0x6d,0x69,0x64,0x64,0x6c,0x65,0x2c,0x77,0x3d,0x35,0x30,0x25,0x2c,0x68,0x3d,0x33,0x30,0x29, 0x79,0x3d,0x6d,0x69,0x64,0x64,0x6c,0x65,0x3a,0x2d,0x31,0x35,0x2c,0x77,0x3d,0x35,0x30,0x25,0x2c,0x68,
0x00,0x6e,0x61,0x6d,0x65,0x00,0x63,0x6c,0x6f,0x73,0x65,0x00,0x74,0x65,0x78,0x74,0x00,0x63,0x6c,0x6f, 0x3d,0x33,0x30,0x29,0x00,0x6e,0x61,0x6d,0x65,0x00,0x63,0x6c,0x6f,0x73,0x65,0x00,0x74,0x65,0x78,0x74,
0x73,0x65,0x00,0x00,0x00,0x72,0x6f,0x77,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x63,0x6c,0x6f,0x73,0x65,0x00,0x00,0x00,0x72,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,0x0a,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x64,0x00,0x00,0x00,0x5a,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,
0x62,0x6f,0x74,0x74,0x6f,0x6d,0x3a,0x33,0x30,0x2c,0x77,0x3d,0x31,0x30,0x30,0x25,0x2c,0x68,0x3d,0x39,
0x30,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,0x72,0x6f,0x77,0x3d,0x31,0x2c,0x63,0x6f,0x6c,0x3d,0x33,0x29,0x00,
0x00,0x74,0x65,0x78,0x74,0x5f,0x73,0x65,0x6c,0x65,0x63,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,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6f,0x70,0x74,0x69,0x6f,0x6e,0x73,0x00,0x32,0x30,0x30, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x64,0x00,0x00,0x00,0x5a,0x00,0x00,0x00,0x73,0x65,0x6c,
0x30,0x2d,0x32,0x30,0x35,0x30,0x00,0x76,0x69,0x73,0x69,0x62,0x6c,0x65,0x5f,0x6e,0x72,0x00,0x33,0x00, 0x66,0x5f,0x6c,0x61,0x79,0x6f,0x75,0x74,0x00,0x64,0x65,0x66,0x61,0x75,0x6c,0x74,0x28,0x78,0x3d,0x30,
0x73,0x74,0x79,0x6c,0x65,0x00,0x64,0x61,0x72,0x6b,0x00,0x74,0x65,0x78,0x74,0x00,0x32,0x30,0x31,0x38, 0x2c,0x79,0x3d,0x6d,0x69,0x64,0x64,0x6c,0x65,0x3a,0x35,0x35,0x2c,0x77,0x3d,0x31,0x30,0x30,0x25,0x2c,
0x00,0x00,0x00,0x74,0x65,0x78,0x74,0x5f,0x73,0x65,0x6c,0x65,0x63,0x74,0x6f,0x72,0x00,0x00,0x00,0x00, 0x68,0x3d,0x39,0x30,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,0x31,0x2c,0x78,0x3d,
0x32,0x30,0x2c,0x73,0x3d,0x32,0x30,0x29,0x00,0x00,0x74,0x65,0x78,0x74,0x5f,0x73,0x65,0x6c,0x65,0x63,
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,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x76,0x69,
0x73,0x69,0x62,0x6c,0x65,0x5f,0x6e,0x72,0x00,0x33,0x00,0x6f,0x70,0x74,0x69,0x6f,0x6e,0x73,0x00,0x74,
0x68,0x69,0x73,0x20,0x69,0x73,0x20,0x6c,0x6f,0x6e,0x67,0x20,0x74,0x65,0x78,0x74,0x20,0x6f,0x70,0x74,
0x69,0x6f,0x6e,0x21,0x20,0x74,0x68,0x69,0x73,0x20,0x69,0x73,0x20,0x6c,0x6f,0x6e,0x67,0x20,0x74,0x65,
0x78,0x74,0x20,0x6f,0x70,0x74,0x69,0x6f,0x6e,0x21,0x20,0x74,0x68,0x69,0x73,0x20,0x69,0x73,0x20,0x6c,
0x6f,0x6e,0x67,0x20,0x74,0x65,0x78,0x74,0x20,0x6f,0x70,0x74,0x69,0x6f,0x6e,0x21,0x20,0x74,0x68,0x69,
0x73,0x20,0x69,0x73,0x20,0x6c,0x6f,0x6e,0x67,0x20,0x74,0x65,0x78,0x74,0x20,0x6f,0x70,0x74,0x69,0x6f,
0x6e,0x21,0x20,0x74,0x68,0x69,0x73,0x20,0x69,0x73,0x20,0x6c,0x6f,0x6e,0x67,0x20,0x74,0x65,0x78,0x74,
0x20,0x6f,0x70,0x74,0x69,0x6f,0x6e,0x21,0x20,0x74,0x68,0x69,0x73,0x20,0x69,0x73,0x20,0x6c,0x6f,0x6e,
0x67,0x20,0x74,0x65,0x78,0x74,0x20,0x6f,0x70,0x74,0x69,0x6f,0x6e,0x21,0x3b,0x74,0x68,0x69,0x73,0x20,
0x69,0x73,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x20,0x74,0x65,0x78,0x74,0x20,0x6f,0x70,0x74,0x69,0x6f,
0x6e,0x21,0x3b,0x65,0x6c,0x6c,0x69,0x70,0x73,0x65,0x73,0x20,0x74,0x65,0x73,0x74,0x00,0x65,0x6c,0x6c,
0x69,0x70,0x73,0x65,0x73,0x00,0x74,0x72,0x75,0x65,0x00,0x6c,0x6f,0x6f,0x70,0x5f,0x6f,0x70,0x74,0x69,
0x6f,0x6e,0x73,0x00,0x74,0x72,0x75,0x65,0x00,0x73,0x74,0x79,0x6c,0x65,0x3a,0x6e,0x6f,0x72,0x6d,0x61,
0x6c,0x3a,0x62,0x6f,0x72,0x64,0x65,0x72,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x00,0x23,0x30,0x30,0x30,0x30,
0x30,0x30,0x00,0x00,0x00,0x00,0x72,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,0x0a,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x64,0x00,0x00,0x00,0x5a,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,0x62,0x6f,0x74,0x74,0x6f,0x6d,0x3a,0x32,0x30,0x2c,0x77,0x3d,0x31,0x30,0x30,0x25,0x2c,0x68,0x3d,
0x39,0x30,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,0x72,0x6f,0x77,0x3d,0x31,0x2c,0x63,0x6f,0x6c,0x3d,0x33,0x29,
0x00,0x00,0x74,0x65,0x78,0x74,0x5f,0x73,0x65,0x6c,0x65,0x63,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, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6f,0x70,0x74,0x69,0x6f,0x6e,0x73,0x00,0x30, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x76,0x69,0x73,0x69,0x62,0x6c,0x65,0x5f,0x6e,0x72,
0x2d,0x36,0x30,0x2d,0x25,0x30,0x32,0x64,0x2d,0x35,0x00,0x76,0x69,0x73,0x69,0x62,0x6c,0x65,0x5f,0x6e, 0x00,0x33,0x00,0x6f,0x70,0x74,0x69,0x6f,0x6e,0x73,0x00,0x32,0x30,0x30,0x30,0x2d,0x32,0x30,0x35,0x30,
0x72,0x00,0x33,0x00,0x74,0x65,0x78,0x74,0x00,0x30,0x35,0x00,0x00,0x00,0x74,0x65,0x78,0x74,0x5f,0x73, 0x00,0x73,0x74,0x79,0x6c,0x65,0x00,0x64,0x61,0x72,0x6b,0x00,0x74,0x65,0x78,0x74,0x00,0x32,0x30,0x31,
0x65,0x6c,0x65,0x63,0x74,0x6f,0x72,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x38,0x00,0x00,0x00,0x74,0x65,0x78,0x74,0x5f,0x73,0x65,0x6c,0x65,0x63,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,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x6f,0x70,0x74,0x69,0x6f,0x6e,0x73,0x00,0x72,0x65,0x64,0x3b,0x67,0x72,0x65,0x65,0x6e,0x3b, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x76,0x69,0x73,0x69,0x62,0x6c,0x65,0x5f,
0x62,0x6c,0x75,0x65,0x3b,0x67,0x6f,0x6c,0x64,0x3b,0x6f,0x72,0x61,0x6e,0x67,0x65,0x00,0x76,0x69,0x73, 0x6e,0x72,0x00,0x33,0x00,0x6f,0x70,0x74,0x69,0x6f,0x6e,0x73,0x00,0x30,0x2d,0x36,0x30,0x2d,0x25,0x30,
0x69,0x62,0x6c,0x65,0x5f,0x6e,0x72,0x00,0x33,0x00,0x74,0x65,0x78,0x74,0x00,0x72,0x65,0x64,0x00,0x00, 0x32,0x64,0x2d,0x35,0x00,0x74,0x65,0x78,0x74,0x00,0x30,0x35,0x00,0x00,0x00,0x74,0x65,0x78,0x74,0x5f,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,};/*1327*/ 0x73,0x65,0x6c,0x65,0x63,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,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x76,0x69,0x73,0x69,0x62,0x6c,0x65,0x5f,0x6e,0x72,0x00,0x33,0x00,0x6f,0x70,0x74,0x69,
0x6f,0x6e,0x73,0x00,0x72,0x65,0x64,0x3b,0x67,0x72,0x65,0x65,0x6e,0x3b,0x62,0x6c,0x75,0x65,0x3b,0x67,
0x6f,0x6c,0x64,0x3b,0x6f,0x72,0x61,0x6e,0x67,0x65,0x00,0x74,0x65,0x78,0x74,0x00,0x72,0x65,0x64,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};/*1808*/

View File

@ -43,6 +43,7 @@ static ret_t text_selector_sync_yoffset_with_selected_index(text_selector_t* tex
const char* s_text_selector_properties[] = {WIDGET_PROP_TEXT, const char* s_text_selector_properties[] = {WIDGET_PROP_TEXT,
WIDGET_PROP_VALUE, WIDGET_PROP_VALUE,
WIDGET_PROP_OPTIONS, WIDGET_PROP_OPTIONS,
WIDGET_PROP_ELLIPSES,
TEXT_SELECTOR_PROP_VISIBLE_NR, TEXT_SELECTOR_PROP_VISIBLE_NR,
WIDGET_PROP_SELECTED_INDEX, WIDGET_PROP_SELECTED_INDEX,
WIDGET_PROP_LOCALIZE_OPTIONS, WIDGET_PROP_LOCALIZE_OPTIONS,
@ -161,15 +162,18 @@ static ret_t text_selector_prepare_highlight_style(widget_t* widget, canvas_t* c
static ret_t text_selector_paint_text(widget_t* widget, canvas_t* c, rect_t* r, static ret_t text_selector_paint_text(widget_t* widget, canvas_t* c, rect_t* r,
text_selector_option_t* iter, int32_t empty_item_height, text_selector_option_t* iter, int32_t empty_item_height,
int32_t item_height) { int32_t item_height) {
text_selector_t* text_selector = NULL;
uint32_t d = tk_abs(r->y - empty_item_height); uint32_t d = tk_abs(r->y - empty_item_height);
text_selector = TEXT_SELECTOR(widget);
if (d < item_height) { if (d < item_height) {
text_selector_prepare_highlight_style(widget, c, (item_height - d) / (float_t)item_height, text_selector_prepare_highlight_style(widget, c, (item_height - d) / (float_t)item_height,
d < item_height / 2); d < item_height / 2);
} else { } else {
widget_prepare_text_style(widget, c); widget_prepare_text_style(widget, c);
} }
return canvas_draw_text_in_rect(c, iter->text.str, iter->text.size, r); return widget_draw_text_in_rect(widget, c, iter->text.str, iter->text.size, r, text_selector->ellipses);
} }
static ret_t text_selector_paint_self(widget_t* widget, canvas_t* c) { static ret_t text_selector_paint_self(widget_t* widget, canvas_t* c) {
@ -414,6 +418,9 @@ static ret_t text_selector_get_prop(widget_t* widget, const char* name, value_t*
} else if (tk_str_eq(name, WIDGET_PROP_OPTIONS)) { } else if (tk_str_eq(name, WIDGET_PROP_OPTIONS)) {
value_set_str(v, text_selector->options); value_set_str(v, text_selector->options);
return RET_OK; return RET_OK;
} else if (tk_str_eq(name, WIDGET_PROP_ELLIPSES)) {
value_set_bool(v, text_selector->ellipses);
return RET_OK;
} else if (tk_str_eq(name, WIDGET_PROP_LOCALIZE_OPTIONS)) { } else if (tk_str_eq(name, WIDGET_PROP_LOCALIZE_OPTIONS)) {
value_set_bool(v, text_selector->localize_options); value_set_bool(v, text_selector->localize_options);
return RET_OK; return RET_OK;
@ -450,6 +457,8 @@ static ret_t text_selector_set_prop(widget_t* widget, const char* name, const va
} else if (tk_str_eq(name, WIDGET_PROP_TEXT)) { } else if (tk_str_eq(name, WIDGET_PROP_TEXT)) {
text_selector_set_text(widget, value_str(v)); text_selector_set_text(widget, value_str(v));
return RET_OK; return RET_OK;
} else if (tk_str_eq(name, WIDGET_PROP_ELLIPSES)) {
return text_selector_set_ellipses(widget, value_bool(v));
} else if (tk_str_eq(name, TEXT_SELECTOR_PROP_VISIBLE_NR)) { } else if (tk_str_eq(name, TEXT_SELECTOR_PROP_VISIBLE_NR)) {
text_selector_set_visible_nr(widget, value_int(v)); text_selector_set_visible_nr(widget, value_int(v));
return RET_OK; return RET_OK;
@ -1140,3 +1149,12 @@ widget_t* text_selector_cast(widget_t* widget) {
return widget; return widget;
} }
ret_t text_selector_set_ellipses(widget_t* widget, bool_t ellipses) {
text_selector_t* text_selector = TEXT_SELECTOR(widget);
return_value_if_fail(text_selector != NULL, RET_BAD_PARAMS);
text_selector->ellipses = ellipses;
return widget_invalidate(widget, NULL);
}

View File

@ -143,6 +143,13 @@ typedef struct _text_selector_t {
*/ */
bool_t enable_value_animator; bool_t enable_value_animator;
/**
* @property {bool_t} ellipses
* @annotation ["set_prop","get_prop","readable","persitent","design","scriptable"]
* ...
*/
bool_t ellipses;
/** /**
* @property {easing_type_t} mask_easing * @property {easing_type_t} mask_easing
* @annotation ["set_prop","get_prop","readable","persitent","design","scriptable"] * @annotation ["set_prop","get_prop","readable","persitent","design","scriptable"]
@ -431,6 +438,17 @@ ret_t text_selector_set_mask_easing(widget_t* widget, easing_type_t mask_easing)
*/ */
ret_t text_selector_set_mask_area_scale(widget_t* widget, float_t mask_area_scale); ret_t text_selector_set_mask_area_scale(widget_t* widget, float_t mask_area_scale);
/**
* @method text_selector_set_ellipses
* ...
* @annotation ["scriptable"]
* @param {widget_t*} widget
* @param {bool_t} ellipses
*
* @return {ret_t} RET_OK表示成功
*/
ret_t text_selector_set_ellipses(widget_t* widget, bool_t ellipses);
#define TEXT_SELECTOR_PROP_VISIBLE_NR "visible_nr" #define TEXT_SELECTOR_PROP_VISIBLE_NR "visible_nr"
#define WIDGET_TYPE_TEXT_SELECTOR "text_selector" #define WIDGET_TYPE_TEXT_SELECTOR "text_selector"
#define TEXT_SELECTOR_PROP_LOOP_OPTIONS "loop_options" #define TEXT_SELECTOR_PROP_LOOP_OPTIONS "loop_options"