mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-12-01 19:49:11 +08:00
improve slider to support left/right/up/down
This commit is contained in:
parent
f65604b7e8
commit
aba26729d9
@ -1,5 +1,5 @@
|
||||
TK_CONST_DATA_ALIGN(const unsigned char ui_htranslate[]) = {
|
||||
0x04,0x00,0x01,0x01,0xae,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x68,0x74,0x72,0x61,0x6e,0x73,0x6c,0x61,
|
||||
0x04,0x00,0x01,0x01,0xb9,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x68,0x74,0x72,0x61,0x6e,0x73,0x6c,0x61,
|
||||
0x74,0x65,0x00,0x64,0x61,0x74,0x61,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,
|
||||
@ -18,85 +18,86 @@ TK_CONST_DATA_ALIGN(const unsigned char ui_htranslate[]) = {
|
||||
0x65,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,0x73,0x74,0x79,0x6c,0x65,0x00,0x69,0x6d,0x67,0x00,0x76,0x61,0x6c,0x75,0x65,0x00,
|
||||
0x32,0x30,0x00,0x00,0x00,0x73,0x6c,0x69,0x64,0x65,0x72,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x32,0x30,0x00,0x66,0x6f,0x63,0x75,0x73,0x00,0x74,0x72,0x75,0x65,0x00,0x00,0x00,0x73,0x6c,0x69,0x64,
|
||||
0x65,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,0x73,0x74,0x79,0x6c,0x65,0x00,0x69,
|
||||
0x6d,0x67,0x00,0x76,0x61,0x6c,0x75,0x65,0x00,0x33,0x30,0x00,0x6d,0x69,0x6e,0x00,0x35,0x00,0x6d,0x61,
|
||||
0x78,0x00,0x35,0x30,0x00,0x73,0x74,0x65,0x70,0x00,0x35,0x00,0x00,0x00,0x70,0x72,0x6f,0x67,0x72,0x65,
|
||||
0x73,0x73,0x5f,0x62,0x61,0x72,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x73,0x74,0x79,0x6c,0x65,0x00,0x69,0x6d,0x67,0x00,0x76,0x61,0x6c,0x75,0x65,0x00,
|
||||
0x33,0x30,0x00,0x6d,0x69,0x6e,0x00,0x35,0x00,0x6d,0x61,0x78,0x00,0x35,0x30,0x00,0x73,0x74,0x65,0x70,
|
||||
0x00,0x35,0x00,0x00,0x00,0x70,0x72,0x6f,0x67,0x72,0x65,0x73,0x73,0x5f,0x62,0x61,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,0x76,0x61,0x6c,0x75,0x65,0x00,0x31,0x30,0x00,0x73,0x68,0x6f,0x77,0x5f,0x74,0x65,0x78,0x74,
|
||||
0x00,0x74,0x72,0x75,0x65,0x00,0x61,0x6e,0x69,0x6d,0x61,0x74,0x69,0x6f,0x6e,0x00,0x76,0x61,0x6c,0x75,
|
||||
0x65,0x28,0x66,0x72,0x6f,0x6d,0x3d,0x30,0x2c,0x20,0x74,0x6f,0x3d,0x31,0x30,0x30,0x2c,0x20,0x79,0x6f,
|
||||
0x79,0x6f,0x5f,0x74,0x69,0x6d,0x65,0x73,0x3d,0x31,0x30,0x30,0x30,0x2c,0x20,0x64,0x75,0x72,0x61,0x74,
|
||||
0x69,0x6f,0x6e,0x3d,0x36,0x30,0x30,0x30,0x29,0x00,0x00,0x00,0x70,0x72,0x6f,0x67,0x72,0x65,0x73,0x73,
|
||||
0x5f,0x62,0x61,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,
|
||||
0x76,0x61,0x6c,0x75,0x65,0x00,0x31,0x30,0x00,0x73,0x74,0x79,0x6c,0x65,0x00,0x72,0x6f,0x75,0x6e,0x64,
|
||||
0x00,0x73,0x68,0x6f,0x77,0x5f,0x74,0x65,0x78,0x74,0x00,0x74,0x72,0x75,0x65,0x00,0x61,0x6e,0x69,0x6d,
|
||||
0x61,0x74,0x69,0x6f,0x6e,0x00,0x76,0x61,0x6c,0x75,0x65,0x28,0x66,0x72,0x6f,0x6d,0x3d,0x30,0x2c,0x20,
|
||||
0x74,0x6f,0x3d,0x31,0x30,0x30,0x2c,0x20,0x79,0x6f,0x79,0x6f,0x5f,0x74,0x69,0x6d,0x65,0x73,0x3d,0x31,
|
||||
0x30,0x30,0x30,0x2c,0x20,0x64,0x75,0x72,0x61,0x74,0x69,0x6f,0x6e,0x3d,0x36,0x30,0x30,0x30,0x29,0x00,
|
||||
0x00,0x00,0x70,0x72,0x6f,0x67,0x72,0x65,0x73,0x73,0x5f,0x62,0x61,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,0x73,0x74,0x79,0x6c,0x65,0x00,0x69,0x6d,0x67,0x00,
|
||||
0x76,0x61,0x6c,0x75,0x65,0x00,0x33,0x30,0x00,0x73,0x68,0x6f,0x77,0x5f,0x74,0x65,0x78,0x74,0x00,0x74,
|
||||
0x72,0x75,0x65,0x00,0x61,0x6e,0x69,0x6d,0x61,0x74,0x69,0x6f,0x6e,0x00,0x76,0x61,0x6c,0x75,0x65,0x28,
|
||||
0x66,0x72,0x6f,0x6d,0x3d,0x30,0x2c,0x20,0x74,0x6f,0x3d,0x31,0x30,0x30,0x2c,0x20,0x79,0x6f,0x79,0x6f,
|
||||
0x5f,0x74,0x69,0x6d,0x65,0x73,0x3d,0x31,0x30,0x30,0x30,0x2c,0x20,0x64,0x75,0x72,0x61,0x74,0x69,0x6f,
|
||||
0x6e,0x3d,0x36,0x30,0x30,0x30,0x29,0x00,0x00,0x00,0x70,0x72,0x6f,0x67,0x72,0x65,0x73,0x73,0x5f,0x62,
|
||||
0x61,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,0x73,0x74,
|
||||
0x79,0x6c,0x65,0x00,0x69,0x6d,0x67,0x00,0x76,0x61,0x6c,0x75,0x65,0x00,0x33,0x30,0x00,0x61,0x6e,0x69,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x76,0x61,0x6c,0x75,0x65,0x00,0x31,
|
||||
0x30,0x00,0x73,0x68,0x6f,0x77,0x5f,0x74,0x65,0x78,0x74,0x00,0x74,0x72,0x75,0x65,0x00,0x61,0x6e,0x69,
|
||||
0x6d,0x61,0x74,0x69,0x6f,0x6e,0x00,0x76,0x61,0x6c,0x75,0x65,0x28,0x66,0x72,0x6f,0x6d,0x3d,0x30,0x2c,
|
||||
0x20,0x74,0x6f,0x3d,0x31,0x30,0x30,0x2c,0x20,0x79,0x6f,0x79,0x6f,0x5f,0x74,0x69,0x6d,0x65,0x73,0x3d,
|
||||
0x31,0x30,0x30,0x30,0x2c,0x20,0x64,0x75,0x72,0x61,0x74,0x69,0x6f,0x6e,0x3d,0x36,0x30,0x30,0x30,0x29,
|
||||
0x00,0x00,0x00,0x00,0x76,0x69,0x65,0x77,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x70,0x72,0x6f,0x67,0x72,0x65,0x73,0x73,0x5f,0x62,0x61,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,0x63,0x68,0x69,0x6c,0x64,0x72,0x65,0x6e,
|
||||
0x5f,0x6c,0x61,0x79,0x6f,0x75,0x74,0x00,0x64,0x65,0x66,0x61,0x75,0x6c,0x74,0x28,0x77,0x3d,0x33,0x30,
|
||||
0x2c,0x72,0x3d,0x31,0x2c,0x6d,0x3d,0x35,0x2c,0x73,0x3d,0x35,0x29,0x00,0x00,0x73,0x6c,0x69,0x64,0x65,
|
||||
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,0x76,0x61,0x6c,0x75,0x65,0x00,0x31,0x30,0x00,
|
||||
0x73,0x74,0x79,0x6c,0x65,0x00,0x72,0x6f,0x75,0x6e,0x64,0x00,0x73,0x68,0x6f,0x77,0x5f,0x74,0x65,0x78,
|
||||
0x74,0x00,0x74,0x72,0x75,0x65,0x00,0x61,0x6e,0x69,0x6d,0x61,0x74,0x69,0x6f,0x6e,0x00,0x76,0x61,0x6c,
|
||||
0x75,0x65,0x28,0x66,0x72,0x6f,0x6d,0x3d,0x30,0x2c,0x20,0x74,0x6f,0x3d,0x31,0x30,0x30,0x2c,0x20,0x79,
|
||||
0x6f,0x79,0x6f,0x5f,0x74,0x69,0x6d,0x65,0x73,0x3d,0x31,0x30,0x30,0x30,0x2c,0x20,0x64,0x75,0x72,0x61,
|
||||
0x74,0x69,0x6f,0x6e,0x3d,0x36,0x30,0x30,0x30,0x29,0x00,0x00,0x00,0x70,0x72,0x6f,0x67,0x72,0x65,0x73,
|
||||
0x73,0x5f,0x62,0x61,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,0x76,0x61,0x6c,0x75,0x65,0x00,0x31,0x30,0x00,0x76,0x65,0x72,0x74,0x69,0x63,0x61,0x6c,
|
||||
0x00,0x74,0x72,0x75,0x65,0x00,0x62,0x61,0x72,0x5f,0x73,0x69,0x7a,0x65,0x00,0x35,0x00,0x00,0x00,0x73,
|
||||
0x6c,0x69,0x64,0x65,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,0x73,0x74,0x79,0x6c,0x65,0x00,0x69,0x6d,0x67,0x5f,0x76,0x00,0x76,
|
||||
0x61,0x6c,0x75,0x65,0x00,0x32,0x30,0x00,0x76,0x65,0x72,0x74,0x69,0x63,0x61,0x6c,0x00,0x74,0x72,0x75,
|
||||
0x65,0x00,0x00,0x00,0x73,0x6c,0x69,0x64,0x65,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,0x73,0x74,0x79,0x6c,0x65,0x00,0x69,0x6d,
|
||||
0x67,0x5f,0x76,0x00,0x76,0x61,0x6c,0x75,0x65,0x00,0x33,0x30,0x00,0x6d,0x69,0x6e,0x00,0x35,0x00,0x6d,
|
||||
0x61,0x78,0x00,0x35,0x30,0x00,0x73,0x74,0x65,0x70,0x00,0x35,0x00,0x76,0x65,0x72,0x74,0x69,0x63,0x61,
|
||||
0x6c,0x00,0x74,0x72,0x75,0x65,0x00,0x00,0x00,0x70,0x72,0x6f,0x67,0x72,0x65,0x73,0x73,0x5f,0x62,0x61,
|
||||
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,0x76,0x61,0x6c,
|
||||
0x75,0x65,0x00,0x31,0x30,0x00,0x76,0x65,0x72,0x74,0x69,0x63,0x61,0x6c,0x00,0x74,0x72,0x75,0x65,0x00,
|
||||
0x00,0x73,0x74,0x79,0x6c,0x65,0x00,0x69,0x6d,0x67,0x00,0x76,0x61,0x6c,0x75,0x65,0x00,0x33,0x30,0x00,
|
||||
0x73,0x68,0x6f,0x77,0x5f,0x74,0x65,0x78,0x74,0x00,0x74,0x72,0x75,0x65,0x00,0x61,0x6e,0x69,0x6d,0x61,
|
||||
0x74,0x69,0x6f,0x6e,0x00,0x76,0x61,0x6c,0x75,0x65,0x28,0x66,0x72,0x6f,0x6d,0x3d,0x30,0x2c,0x20,0x74,
|
||||
0x6f,0x3d,0x31,0x30,0x30,0x2c,0x20,0x79,0x6f,0x79,0x6f,0x5f,0x74,0x69,0x6d,0x65,0x73,0x3d,0x31,0x30,
|
||||
0x30,0x30,0x2c,0x20,0x64,0x75,0x72,0x61,0x74,0x69,0x6f,0x6e,0x3d,0x36,0x30,0x30,0x30,0x29,0x00,0x00,
|
||||
0x00,0x70,0x72,0x6f,0x67,0x72,0x65,0x73,0x73,0x5f,0x62,0x61,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,0x73,0x74,0x79,0x6c,0x65,0x00,0x72,0x6f,0x75,0x6e,0x64,
|
||||
0x00,0x76,0x61,0x6c,0x75,0x65,0x00,0x31,0x30,0x00,0x76,0x65,0x72,0x74,0x69,0x63,0x61,0x6c,0x00,0x74,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x73,0x74,0x79,0x6c,0x65,0x00,0x69,0x6d,0x67,0x00,0x76,
|
||||
0x61,0x6c,0x75,0x65,0x00,0x33,0x30,0x00,0x61,0x6e,0x69,0x6d,0x61,0x74,0x69,0x6f,0x6e,0x00,0x76,0x61,
|
||||
0x6c,0x75,0x65,0x28,0x66,0x72,0x6f,0x6d,0x3d,0x30,0x2c,0x20,0x74,0x6f,0x3d,0x31,0x30,0x30,0x2c,0x20,
|
||||
0x79,0x6f,0x79,0x6f,0x5f,0x74,0x69,0x6d,0x65,0x73,0x3d,0x31,0x30,0x30,0x30,0x2c,0x20,0x64,0x75,0x72,
|
||||
0x61,0x74,0x69,0x6f,0x6e,0x3d,0x36,0x30,0x30,0x30,0x29,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,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,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,0x77,0x3d,0x33,0x30,0x2c,0x72,0x3d,0x31,0x2c,0x6d,0x3d,0x35,0x2c,
|
||||
0x73,0x3d,0x35,0x29,0x00,0x00,0x73,0x6c,0x69,0x64,0x65,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,0x76,0x61,0x6c,0x75,0x65,0x00,
|
||||
0x31,0x30,0x00,0x76,0x65,0x72,0x74,0x69,0x63,0x61,0x6c,0x00,0x74,0x72,0x75,0x65,0x00,0x62,0x61,0x72,
|
||||
0x5f,0x73,0x69,0x7a,0x65,0x00,0x35,0x00,0x00,0x00,0x73,0x6c,0x69,0x64,0x65,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,0x73,0x74,
|
||||
0x79,0x6c,0x65,0x00,0x69,0x6d,0x67,0x5f,0x76,0x00,0x76,0x61,0x6c,0x75,0x65,0x00,0x32,0x30,0x00,0x76,
|
||||
0x65,0x72,0x74,0x69,0x63,0x61,0x6c,0x00,0x74,0x72,0x75,0x65,0x00,0x00,0x00,0x73,0x6c,0x69,0x64,0x65,
|
||||
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,0x73,0x74,0x79,0x6c,0x65,0x00,0x69,0x6d,0x67,0x5f,0x76,0x00,0x76,0x61,0x6c,0x75,0x65,
|
||||
0x00,0x33,0x30,0x00,0x6d,0x69,0x6e,0x00,0x35,0x00,0x6d,0x61,0x78,0x00,0x35,0x30,0x00,0x73,0x74,0x65,
|
||||
0x70,0x00,0x35,0x00,0x76,0x65,0x72,0x74,0x69,0x63,0x61,0x6c,0x00,0x74,0x72,0x75,0x65,0x00,0x00,0x00,
|
||||
0x70,0x72,0x6f,0x67,0x72,0x65,0x73,0x73,0x5f,0x62,0x61,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,0x76,0x61,0x6c,0x75,0x65,0x00,0x31,0x30,0x00,0x76,0x65,0x72,
|
||||
0x74,0x69,0x63,0x61,0x6c,0x00,0x74,0x72,0x75,0x65,0x00,0x73,0x68,0x6f,0x77,0x5f,0x74,0x65,0x78,0x74,
|
||||
0x00,0x74,0x72,0x75,0x65,0x00,0x61,0x6e,0x69,0x6d,0x61,0x74,0x69,0x6f,0x6e,0x00,0x76,0x61,0x6c,0x75,
|
||||
0x65,0x28,0x66,0x72,0x6f,0x6d,0x3d,0x30,0x2c,0x20,0x74,0x6f,0x3d,0x31,0x30,0x30,0x2c,0x20,0x79,0x6f,
|
||||
0x79,0x6f,0x5f,0x74,0x69,0x6d,0x65,0x73,0x3d,0x31,0x30,0x30,0x30,0x2c,0x20,0x64,0x75,0x72,0x61,0x74,
|
||||
0x69,0x6f,0x6e,0x3d,0x36,0x30,0x30,0x30,0x29,0x00,0x00,0x00,0x70,0x72,0x6f,0x67,0x72,0x65,0x73,0x73,
|
||||
0x5f,0x62,0x61,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,
|
||||
0x73,0x74,0x79,0x6c,0x65,0x00,0x72,0x6f,0x75,0x6e,0x64,0x00,0x76,0x61,0x6c,0x75,0x65,0x00,0x31,0x30,
|
||||
0x00,0x76,0x65,0x72,0x74,0x69,0x63,0x61,0x6c,0x00,0x74,0x72,0x75,0x65,0x00,0x61,0x6e,0x69,0x6d,0x61,
|
||||
0x74,0x69,0x6f,0x6e,0x00,0x76,0x61,0x6c,0x75,0x65,0x28,0x66,0x72,0x6f,0x6d,0x3d,0x30,0x2c,0x20,0x74,
|
||||
0x6f,0x3d,0x31,0x30,0x30,0x2c,0x20,0x79,0x6f,0x79,0x6f,0x5f,0x74,0x69,0x6d,0x65,0x73,0x3d,0x31,0x30,
|
||||
0x30,0x30,0x2c,0x20,0x64,0x75,0x72,0x61,0x74,0x69,0x6f,0x6e,0x3d,0x36,0x30,0x30,0x30,0x29,0x00,0x00,
|
||||
0x00,0x70,0x72,0x6f,0x67,0x72,0x65,0x73,0x73,0x5f,0x62,0x61,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,0x73,0x74,0x79,0x6c,0x65,0x00,0x69,0x6d,0x67,0x5f,0x76,
|
||||
0x00,0x76,0x61,0x6c,0x75,0x65,0x00,0x32,0x30,0x00,0x76,0x65,0x72,0x74,0x69,0x63,0x61,0x6c,0x00,0x74,
|
||||
0x72,0x75,0x65,0x00,0x61,0x6e,0x69,0x6d,0x61,0x74,0x69,0x6f,0x6e,0x00,0x76,0x61,0x6c,0x75,0x65,0x28,
|
||||
0x66,0x72,0x6f,0x6d,0x3d,0x30,0x2c,0x20,0x74,0x6f,0x3d,0x31,0x30,0x30,0x2c,0x20,0x79,0x6f,0x79,0x6f,
|
||||
0x5f,0x74,0x69,0x6d,0x65,0x73,0x3d,0x31,0x30,0x30,0x30,0x2c,0x20,0x64,0x75,0x72,0x61,0x74,0x69,0x6f,
|
||||
0x6e,0x3d,0x36,0x30,0x30,0x30,0x29,0x00,0x00,0x00,0x70,0x72,0x6f,0x67,0x72,0x65,0x73,0x73,0x5f,0x62,
|
||||
0x61,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,0x73,0x74,
|
||||
0x79,0x6c,0x65,0x00,0x69,0x6d,0x67,0x5f,0x76,0x00,0x76,0x61,0x6c,0x75,0x65,0x00,0x32,0x30,0x00,0x76,
|
||||
0x79,0x6c,0x65,0x00,0x69,0x6d,0x67,0x5f,0x76,0x00,0x76,0x61,0x6c,0x75,0x65,0x00,0x33,0x30,0x00,0x76,
|
||||
0x65,0x72,0x74,0x69,0x63,0x61,0x6c,0x00,0x74,0x72,0x75,0x65,0x00,0x61,0x6e,0x69,0x6d,0x61,0x74,0x69,
|
||||
0x6f,0x6e,0x00,0x76,0x61,0x6c,0x75,0x65,0x28,0x66,0x72,0x6f,0x6d,0x3d,0x30,0x2c,0x20,0x74,0x6f,0x3d,
|
||||
0x31,0x30,0x30,0x2c,0x20,0x79,0x6f,0x79,0x6f,0x5f,0x74,0x69,0x6d,0x65,0x73,0x3d,0x31,0x30,0x30,0x30,
|
||||
0x2c,0x20,0x64,0x75,0x72,0x61,0x74,0x69,0x6f,0x6e,0x3d,0x36,0x30,0x30,0x30,0x29,0x00,0x00,0x00,0x70,
|
||||
0x72,0x6f,0x67,0x72,0x65,0x73,0x73,0x5f,0x62,0x61,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,0x73,0x74,0x79,0x6c,0x65,0x00,0x69,0x6d,0x67,0x5f,0x76,0x00,0x76,
|
||||
0x61,0x6c,0x75,0x65,0x00,0x33,0x30,0x00,0x76,0x65,0x72,0x74,0x69,0x63,0x61,0x6c,0x00,0x74,0x72,0x75,
|
||||
0x65,0x00,0x61,0x6e,0x69,0x6d,0x61,0x74,0x69,0x6f,0x6e,0x00,0x76,0x61,0x6c,0x75,0x65,0x28,0x66,0x72,
|
||||
0x6f,0x6d,0x3d,0x30,0x2c,0x20,0x74,0x6f,0x3d,0x31,0x30,0x30,0x2c,0x20,0x79,0x6f,0x79,0x6f,0x5f,0x74,
|
||||
0x69,0x6d,0x65,0x73,0x3d,0x31,0x30,0x30,0x30,0x2c,0x20,0x64,0x75,0x72,0x61,0x74,0x69,0x6f,0x6e,0x3d,
|
||||
0x36,0x30,0x30,0x30,0x29,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};/*2014*/
|
||||
0x2c,0x20,0x64,0x75,0x72,0x61,0x74,0x69,0x6f,0x6e,0x3d,0x36,0x30,0x30,0x30,0x29,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,};/*2025*/
|
||||
|
Binary file not shown.
@ -1,7 +1,7 @@
|
||||
<window anim_hint="htranslate" children_layout="default(c=1,r=2,s=5)">
|
||||
<view children_layout="default(c=1,h=24,m=5,s=5)">
|
||||
<slider value="10" bar_size="5"/>
|
||||
<slider style="img" value="20" />
|
||||
<slider style="img" value="20" focus="true"/>
|
||||
<slider style="img" value="30" min="5" max="50" step="5"/>
|
||||
|
||||
<progress_bar value="10" show_text="true"
|
||||
|
@ -2,6 +2,7 @@
|
||||
* 2019/05/18
|
||||
* 修改window\_manager\_open\_window将key\target设置为新窗口。
|
||||
* 合并text selector的补丁(感谢智明提供补丁)。
|
||||
* slider支持上下左右键盘。
|
||||
|
||||
* 2019/05/16
|
||||
* 去掉slist\_remove中一个警告。
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "tkc/mem.h"
|
||||
#include "tkc/rect.h"
|
||||
#include "tkc/utils.h"
|
||||
#include "base/keys.h"
|
||||
#include "widgets/slider.h"
|
||||
#include "base/widget_vtable.h"
|
||||
#include "base/image_manager.h"
|
||||
@ -163,6 +164,53 @@ static ret_t slider_pointer_up_cleanup(widget_t* widget) {
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
static ret_t slider_add_value(widget_t* widget, int16_t delta) {
|
||||
int32_t new_value = 0;
|
||||
slider_t* slider = SLIDER(widget);
|
||||
return_value_if_fail(widget != NULL && slider != NULL, RET_BAD_PARAMS);
|
||||
|
||||
new_value = slider->value + delta;
|
||||
|
||||
if (new_value < slider->min) {
|
||||
new_value = slider->min;
|
||||
}
|
||||
|
||||
if (new_value > slider->max) {
|
||||
new_value = slider->max;
|
||||
}
|
||||
|
||||
return slider_set_value(widget, new_value);
|
||||
}
|
||||
|
||||
ret_t slider_inc(widget_t* widget) {
|
||||
ret_t ret = RET_OK;
|
||||
slider_t* slider = SLIDER(widget);
|
||||
return_value_if_fail(widget != NULL && slider != NULL, RET_BAD_PARAMS);
|
||||
|
||||
if (slider->step) {
|
||||
ret = slider_add_value(widget, slider->step);
|
||||
} else {
|
||||
ret = slider_add_value(widget, 1);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret_t slider_dec(widget_t* widget) {
|
||||
ret_t ret = RET_OK;
|
||||
slider_t* slider = SLIDER(widget);
|
||||
return_value_if_fail(widget != NULL && slider != NULL, RET_BAD_PARAMS);
|
||||
|
||||
if (slider->step) {
|
||||
ret = slider_add_value(widget, -slider->step);
|
||||
} else {
|
||||
ret = slider_add_value(widget, -1);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static ret_t slider_on_event(widget_t* widget, event_t* e) {
|
||||
rect_t r;
|
||||
ret_t ret = RET_OK;
|
||||
@ -229,6 +277,23 @@ static ret_t slider_on_event(widget_t* widget, event_t* e) {
|
||||
case EVT_POINTER_ENTER:
|
||||
widget_set_state(widget, slider->dragging ? WIDGET_STATE_PRESSED : WIDGET_STATE_OVER);
|
||||
break;
|
||||
case EVT_KEY_DOWN: {
|
||||
key_event_t* evt = (key_event_t*)e;
|
||||
if (slider->vertical) {
|
||||
if (evt->key == TK_KEY_UP) {
|
||||
slider_inc(widget);
|
||||
} else if (evt->key == TK_KEY_DOWN) {
|
||||
slider_dec(widget);
|
||||
}
|
||||
} else {
|
||||
if (evt->key == TK_KEY_LEFT) {
|
||||
slider_dec(widget);
|
||||
} else if (evt->key == TK_KEY_RIGHT) {
|
||||
slider_inc(widget);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
ret = RET_OK;
|
||||
break;
|
||||
|
@ -230,6 +230,8 @@ ret_t slider_set_vertical(widget_t* widget, bool_t vertical);
|
||||
TK_EXTERN_VTABLE(slider);
|
||||
|
||||
/*public for test*/
|
||||
ret_t slider_dec(widget_t* widget);
|
||||
ret_t slider_inc(widget_t* widget);
|
||||
ret_t slider_set_value_internal(widget_t* widget, uint16_t value, event_type_t etype, bool_t force);
|
||||
|
||||
END_C_DECLS
|
||||
|
@ -80,3 +80,69 @@ TEST(Slider, cast) {
|
||||
|
||||
widget_destroy(w);
|
||||
}
|
||||
|
||||
TEST(Slider, inc) {
|
||||
widget_t* w = slider_create(NULL, 0, 0, 100, 100);
|
||||
slider_t* slider = SLIDER(w);
|
||||
|
||||
slider_set_value(w, 0);
|
||||
ASSERT_EQ(slider_inc(w), RET_OK);
|
||||
ASSERT_EQ(slider_inc(w), RET_OK);
|
||||
ASSERT_EQ(slider_inc(w), RET_OK);
|
||||
ASSERT_EQ(slider->value, 3);
|
||||
|
||||
slider_set_value(w, 100);
|
||||
ASSERT_EQ(slider_inc(w), RET_OK);
|
||||
ASSERT_EQ(slider_inc(w), RET_OK);
|
||||
ASSERT_EQ(slider_inc(w), RET_OK);
|
||||
ASSERT_EQ(slider->value, 100);
|
||||
|
||||
widget_destroy(w);
|
||||
}
|
||||
|
||||
TEST(Slider, inc_step) {
|
||||
widget_t* w = slider_create(NULL, 0, 0, 100, 100);
|
||||
slider_t* slider = SLIDER(w);
|
||||
|
||||
slider_set_value(w, 0);
|
||||
slider_set_step(w, 10);
|
||||
ASSERT_EQ(slider_inc(w), RET_OK);
|
||||
ASSERT_EQ(slider_inc(w), RET_OK);
|
||||
ASSERT_EQ(slider_inc(w), RET_OK);
|
||||
ASSERT_EQ(slider->value, 30);
|
||||
|
||||
widget_destroy(w);
|
||||
}
|
||||
|
||||
TEST(Slider, dec) {
|
||||
widget_t* w = slider_create(NULL, 0, 0, 100, 100);
|
||||
slider_t* slider = SLIDER(w);
|
||||
|
||||
slider_set_value(w, 100);
|
||||
ASSERT_EQ(slider_dec(w), RET_OK);
|
||||
ASSERT_EQ(slider_dec(w), RET_OK);
|
||||
ASSERT_EQ(slider_dec(w), RET_OK);
|
||||
ASSERT_EQ(slider->value, 97);
|
||||
|
||||
slider_set_value(w, 0);
|
||||
ASSERT_EQ(slider_dec(w), RET_OK);
|
||||
ASSERT_EQ(slider_dec(w), RET_OK);
|
||||
ASSERT_EQ(slider_dec(w), RET_OK);
|
||||
ASSERT_EQ(slider->value, 0);
|
||||
|
||||
widget_destroy(w);
|
||||
}
|
||||
|
||||
TEST(Slider, dec_step) {
|
||||
widget_t* w = slider_create(NULL, 0, 0, 100, 100);
|
||||
slider_t* slider = SLIDER(w);
|
||||
|
||||
slider_set_value(w, 100);
|
||||
slider_set_step(w, 10);
|
||||
ASSERT_EQ(slider_dec(w), RET_OK);
|
||||
ASSERT_EQ(slider_dec(w), RET_OK);
|
||||
ASSERT_EQ(slider_dec(w), RET_OK);
|
||||
ASSERT_EQ(slider->value, 70);
|
||||
|
||||
widget_destroy(w);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user