update lua bingings

This commit is contained in:
xianjimli 2018-06-20 17:35:32 +08:00
parent a8a009ac61
commit 232a783dcf
26 changed files with 2246 additions and 126 deletions

View File

@ -35,8 +35,8 @@
static void install_click_hander(widget_t* widget);
static void open_window(const char* name) {
widget_t* win = window_open(name);
static void open_window(const char* name, widget_t* to_close) {
widget_t* win = to_close ? window_open_and_close(name, to_close) : window_open(name);
install_click_hander(win);
@ -46,7 +46,8 @@ static void open_window(const char* name) {
}
static ret_t on_open_window(void* ctx, event_t* e) {
open_window((const char*)ctx);
open_window((const char*)ctx, NULL);
(void)e;
return RET_OK;
@ -213,7 +214,7 @@ static ret_t timer_preload(const timer_info_t* timer) {
widget_t* status = widget_lookup(win, "status", TRUE);
if (s_preload_nr == total) {
open_window("main");
open_window("main", win);
return RET_REMOVE;
} else {

View File

@ -361,4 +361,4 @@ const unsigned char image_bricks[] = {
0xcd,0xbb,0xcc,0xbb,0xed,0xbb,0x0d,0xc4,0x0d,0xbc,0x0d,0xc4,0x0d,0xc4,0x0d,0xc4,0xed,0xc3,0x0d,0xc4,
0x0d,0xc4,0x0d,0xc4,0x0e,0xcc,0x11,0xd5,0xb0,0xc4,0xad,0xbb,0xac,0xbb,0xec,0xc3,0xec,0xc3,0xcc,0xbb,
0xcc,0xbb,0xcc,0xc3,0xcc,0xc3,0xed,0xc3,0xed,0xc3,0xcc,0xbb,0xcc,0xbb,0xd2,0xc4,0x00,0x00,0x00,0x00,
0x60,0xfd,0x32,0x76,};/*7244*/
0x00,0x00,0x00,0x00,};/*7244*/

View File

@ -19,4 +19,4 @@ const unsigned char image_cross[] = {
0xee,0x9c,0x00,0x93,0x7e,0xb1,0x0d,0x20,0x03,0x7b,0x77,0x21,0x9a,0x39,0x01,0xf6,0xba,0x13,0x58,0x73,
0xc0,0x7a,0x27,0x6c,0xdd,0x21,0x58,0xb8,0x7b,0xc1,0x16,0xb8,0x71,0x02,0xac,0x74,0x27,0xb0,0xe6,0x80,
0xf5,0x69,0xf6,0x01,0x5c,0x3b,0x01,0x96,0xee,0x10,0x6c,0x6a,0x43,0xf0,0x07,0xce,0xe8,0x3d,0x89,0xb2,
0x0d,0x38,0x6d,0x00,0x00,0x00,0x00,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82,0x00,0xd0,0x77,0x27,};/*419*/
0x0d,0x38,0x6d,0x00,0x00,0x00,0x00,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82,0x00,0x00,0x00,0x00,};/*419*/

View File

@ -116,4 +116,4 @@ const unsigned char image_middle_on[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};/*2348*/
0x00,0x00,0x00,0x00,0x30,0x21,0x50,0xa1,};/*2348*/

View File

@ -157,4 +157,4 @@ const unsigned char image_slider_drag[] = {
0x50,0x50,0x50,0x90,0x51,0x51,0x51,0xc0,0x51,0x51,0x51,0xff,0x51,0x51,0x51,0xff,0x51,0x51,0x51,0xff,
0x51,0x51,0x51,0xff,0x51,0x51,0x51,0xd0,0x50,0x50,0x50,0xa0,0x50,0x50,0x50,0x50,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};/*3180*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1c,0xf0,0xb8,};/*3180*/

View File

@ -116,4 +116,4 @@ const unsigned char image_warn[] = {
0x12,0x96,0xdb,0xb4,0x11,0x96,0xdb,0xe9,0x12,0x96,0xdb,0xff,0x12,0x96,0xdb,0xff,0x11,0x96,0xdb,0xe9,
0x12,0x96,0xdb,0xb4,0x11,0x96,0xdb,0x78,0x0d,0x91,0xdb,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x88,0x9a,0x30,0x76,};/*2348*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};/*2348*/

View File

@ -6,4 +6,4 @@ const unsigned char theme_calibration[] = {
0x0d,0x00,0x00,0x00,0x63,0x72,0x6f,0x73,0x73,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0xc0,0xc0,
0xc0,0xff,0x01,0x00,0x00,0x00,0x0d,0x00,0x00,0x00,0x63,0x72,0x6f,0x73,0x73,0x00,0x01,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0xe0,0xe0,0xe0,0xff,0x01,0x00,0x00,0x00,0x0d,0x00,0x00,0x00,0x63,0x72,0x6f,0x73,
0x73,0x00,0x02,0x00,0x0d,0x00,};/*146*/
0x73,0x00,0x00,0x00,0x00,0x00,};/*146*/

View File

@ -15,4 +15,4 @@ const unsigned char theme_dialog1[] = {
0x00,0x00,0x00,0x00,0xff,0xff,0x01,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x72,0x65,0x64,0x5f,0x62,0x74,
0x6e,0x5f,0x70,0x00,0x02,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x06,0x00,0x00,0x00,
0x00,0x00,0xff,0xff,0x01,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x72,0x65,0x64,0x5f,0x62,0x74,0x6e,0x5f,
0x6f,0x00,0x00,0x00,0x00,0x00,};/*326*/
0x6f,0x00,0x20,0x20,0x20,0x20,};/*326*/

View File

@ -65,4 +65,4 @@ const unsigned char ui_kb_hex[] = {
0x6d,0x61,0x67,0x65,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x01,0x01,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x64,0x00,0x00,0x00,0x64,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x69,
0x6d,0x61,0x67,0x65,0x00,0x62,0x61,0x63,0x6b,0x73,0x70,0x61,0x63,0x65,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x14,0xe0,0xf9,0xc2,};/*1325*/
0x00,0x55,0x31,0x76,0xff,};/*1325*/

64
demos/res/inc/ui/lua.data Normal file
View File

@ -0,0 +1,64 @@
const unsigned char ui_lua[] = {
0x04,0x00,0x01,0x01,0xca,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x6c,0x75,0x61,0x00,0x64,0x61,0x74,0x61,
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,
0x64,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,0x6d,0x61,0x69,
0x6e,0x00,0x00,0x62,0x75,0x74,0x74,0x6f,0x6e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x01,0x00,0x0a,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x19,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,0x69,0x6e,0x63,0x00,0x74,0x65,0x78,0x74,0x00,0x49,0x6e,0x63,
0x00,0x00,0x00,0x62,0x75,0x74,0x74,0x6f,0x6e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,
0x00,0x00,0x00,0xdd,0xff,0xff,0xff,0x05,0x00,0x00,0x00,0x3c,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,0x64,0x69,0x61,0x6c,0x6f,0x67,0x31,0x00,0x74,0x65,0x78,0x74,
0x00,0x44,0x69,0x61,0x6c,0x6f,0x67,0x31,0x00,0x00,0x00,0x62,0x75,0x74,0x74,0x6f,0x6e,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x23,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x3c,
0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,0x64,0x69,0x61,0x6c,
0x6f,0x67,0x32,0x00,0x74,0x65,0x78,0x74,0x00,0x44,0x69,0x6c,0x61,0x6f,0x67,0x32,0x00,0x00,0x00,0x62,
0x75,0x74,0x74,0x6f,0x6e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x01,0x00,0x0a,
0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x19,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6e,
0x61,0x6d,0x65,0x00,0x64,0x65,0x63,0x00,0x74,0x65,0x78,0x74,0x00,0x44,0x65,0x63,0x00,0x00,0x00,0x6c,
0x61,0x62,0x65,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x0a,
0x00,0x00,0x00,0x28,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6e,
0x61,0x6d,0x65,0x00,0x6c,0x65,0x66,0x74,0x00,0x74,0x65,0x78,0x74,0x00,0x4c,0x65,0x66,0x74,0x00,0x00,
0x00,0x6c,0x61,0x62,0x65,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x01,
0x00,0x00,0x00,0x00,0x00,0x28,0x00,0x00,0x00,0x19,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x6e,0x61,0x6d,0x65,0x00,0x63,0x65,0x6e,0x74,0x65,0x72,0x00,0x74,0x65,0x78,0x74,0x00,0x43,0x65,
0x6e,0x74,0x65,0x72,0x00,0x00,0x00,0x6c,0x61,0x62,0x65,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x03,0x00,0x01,0x00,0x0a,0x00,0x00,0x00,0x28,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x1e,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,0x72,0x69,0x67,0x68,0x74,0x00,0x74,0x65,
0x78,0x74,0x00,0x52,0x69,0x67,0x68,0x74,0x00,0x00,0x00,0x70,0x72,0x6f,0x67,0x72,0x65,0x73,0x73,0x5f,
0x62,0x61,0x72,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x46,0x00,0x00,0x00,0xf0,
0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,0x62,0x61,0x72,0x31,
0x00,0x76,0x61,0x6c,0x75,0x65,0x00,0x34,0x30,0x00,0x00,0x00,0x70,0x72,0x6f,0x67,0x72,0x65,0x73,0x73,
0x5f,0x62,0x61,0x72,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x01,0x00,0x00,0x46,0x00,0x00,0x00,
0x1e,0x00,0x00,0x00,0x76,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,0x62,0x61,0x72,
0x32,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,0x63,0x68,0x65,0x63,0x6b,0x5f,0x62,0x75,0x74,0x74,0x6f,0x6e,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x6e,0x00,0x00,0x00,0x50,0x00,0x00,0x00,0x1e,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,0x63,0x31,0x00,0x74,0x65,0x78,0x74,0x00,
0x42,0x6f,0x6f,0x6b,0x00,0x00,0x00,0x63,0x68,0x65,0x63,0x6b,0x5f,0x62,0x75,0x74,0x74,0x6f,0x6e,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x64,0x00,0x00,0x00,0x6e,0x00,0x00,0x00,0x50,0x00,0x00,0x00,0x1e,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,0x63,0x32,0x00,0x74,0x65,0x78,0x74,0x00,
0x46,0x6f,0x6f,0x64,0x00,0x00,0x00,0x72,0x61,0x64,0x69,0x6f,0x5f,0x62,0x75,0x74,0x74,0x6f,0x6e,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x96,0x00,0x00,0x00,0x50,0x00,0x00,0x00,0x1e,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,0x72,0x31,0x00,0x74,0x65,0x78,0x74,0x00,
0x42,0x6f,0x6f,0x6b,0x00,0x00,0x00,0x72,0x61,0x64,0x69,0x6f,0x5f,0x62,0x75,0x74,0x74,0x6f,0x6e,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x64,0x00,0x00,0x00,0x96,0x00,0x00,0x00,0x50,0x00,0x00,0x00,0x1e,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,0x72,0x32,0x00,0x74,0x65,0x78,0x74,0x00,
0x46,0x6f,0x6f,0x64,0x00,0x00,0x00,0x72,0x61,0x64,0x69,0x6f,0x5f,0x62,0x75,0x74,0x74,0x6f,0x6e,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xbe,0x00,0x00,0x00,0x96,0x00,0x00,0x00,0x50,0x00,0x00,0x00,0x1e,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,0x72,0x33,0x00,0x74,0x65,0x78,0x74,0x00,
0x50,0x65,0x6e,0x63,0x69,0x6c,0x00,0x76,0x61,0x6c,0x75,0x65,0x00,0x74,0x72,0x75,0x65,0x00,0x00,0x00,
0x69,0x6d,0x61,0x67,0x65,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x0a,0x00,0x00,0x00,0x68,0x01,0x00,0x00,0x28,0x00,0x00,0x00,0x28,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x69,0x6d,0x61,0x67,0x65,0x00,0x65,0x61,0x72,0x74,0x68,0x00,0x00,0x00,0x69,0x6d,0x61,0x67,0x65,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x00,0x00,0x00,0x68,0x01,
0x00,0x00,0x28,0x00,0x00,0x00,0x28,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x69,0x6d,0x61,0x67,0x65,0x00,
0x72,0x67,0x62,0x61,0x00,0x00,0x00,0x69,0x6d,0x61,0x67,0x65,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6e,0x00,0x00,0x00,0x68,0x01,0x00,0x00,0x28,0x00,0x00,0x00,0x28,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x69,0x6d,0x61,0x67,0x65,0x00,0x72,0x67,0x62,0x00,0x00,0x00,0x69,
0x6d,0x61,0x67,0x65,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa0,
0x00,0x00,0x00,0x68,0x01,0x00,0x00,0x28,0x00,0x00,0x00,0x28,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x69,
0x6d,0x61,0x67,0x65,0x00,0x6d,0x65,0x73,0x73,0x61,0x67,0x65,0x00,0x00,0x00,0x69,0x6d,0x61,0x67,0x65,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd2,0x00,0x00,0x00,0x68,
0x01,0x00,0x00,0x28,0x00,0x00,0x00,0x28,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x69,0x6d,0x61,0x67,0x65,
0x00,0x72,0x65,0x64,0x5f,0x62,0x74,0x6e,0x5f,0x6e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};/*1258*/

View File

@ -20,4 +20,4 @@ const unsigned char ui_memtest[] = {
0x62,0x65,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x01,0x00,0x00,0x00,
0x00,0x00,0x5a,0x00,0x00,0x00,0x64,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6e,0x61,
0x6d,0x65,0x00,0x6d,0x65,0x6d,0x63,0x70,0x79,0x00,0x74,0x65,0x78,0x74,0x00,0x6e,0x2f,0x61,0x00,0x00,
0x00,0x00,0x00,0x00,0x58,0x17,};/*426*/
0x00,0x00,0x00,0x00,0x58,0x47,};/*426*/

BIN
demos/res/raw/ui/lua.bin Normal file

Binary file not shown.

24
demos/res/raw/ui/lua.xml Normal file
View File

@ -0,0 +1,24 @@
<window name="main">
<button name="inc" x="10" y="5" w="25%" h="30" text="Inc"/>
<button name="dialog1" x="center:-35" y="5" w="60" h="30" text="Dialog1"/>
<button name="dialog2" x="center:35" y="5" w="60" h="30" text="Dilaog2"/>
<button name="dec" x="right:10" y="5" w="25%" h="30" text="Dec"/>
<label name="left" x="10" y="40" w="30%" h="30" text="Left"/>
<label name="center" x="center" y="40" w="25%" h="30" text="Center"/>
<label name="right" x="right:10" y="40" w="30%" h="30" text="Right"/>
<progress_bar name="bar1" x="10" y="70" w="240" h="30" value="40"/>
<progress_bar name="bar2" x="280" y="70" w="30" h="118" value="20" vertical="true"/>
<check_button name="c1" x="10" y="110" w="80" h="30" text="Book"/>
<check_button name="c2" x="100" y="110" w="80" h="30" text="Food"/>
<radio_button name="r1" x="10" y="150" w="80" h="30" text="Book"/>
<radio_button name="r2" x="100" y="150" w="80" h="30" text="Food"/>
<radio_button name="r3" x="190" y="150" w="80" h="30" text="Pencil" value="true"/>
<image image="earth" x="10" y="360" w="40" h="40"/>
<image image="rgba" x="60" y="360" w="40" h="40"/>
<image image="rgb" x="110" y="360" w="40" h="40"/>
<image image="message" x="160" y="360" w="40" h="40"/>
<image image="red_btn_n" x="210" y="360" w="40" h="40"/>
</window>

View File

@ -27,6 +27,7 @@
#include "res/inc/ui/kb_ufloat.data"
#include "res/inc/ui/kb_uint.data"
#include "res/inc/ui/keyboard.data"
#include "res/inc/ui/lua.data"
#include "res/inc/ui/main.data"
#include "res/inc/ui/memtest.data"
#include "res/inc/ui/preload.data"
@ -199,6 +200,7 @@ ret_t resource_init(void) {
resource_manager_add(rm, ui_kb_ufloat);
resource_manager_add(rm, ui_kb_uint);
resource_manager_add(rm, ui_keyboard);
resource_manager_add(rm, ui_lua);
resource_manager_add(rm, ui_main);
resource_manager_add(rm, ui_memtest);
resource_manager_add(rm, ui_preload);

View File

@ -3,7 +3,7 @@ function on_click(ctx, evt)
end
function application_init()
local win = Window.open("window");
local win = Window.open("lua");
win.inc:on(EventType.CLICK, function(evt)
win.bar2:set_value(win.bar2.value + 10);
@ -25,16 +25,11 @@ function application_init()
function show_dialog(name)
local dlg = Dialog.open(name)
dlg.client.ok:on(EventType.CLICK, function(evt)
dlg.client.quit:on(EventType.CLICK, function(evt)
print("ok clicked");
dlg:quit(0)
end);
dlg.client.cancel:on(EventType.CLICK, function(evt)
print("cancel clicked");
dlg:quit(1)
end);
dlg:modal()
dlg:destroy()
end

File diff suppressed because it is too large Load Diff

View File

@ -175,6 +175,12 @@ typedef enum _event_type_t {
*
*/
EVT_WINDOW_LOAD,
/**
* @const EVT_WINDOW_OPEN
*
*/
EVT_WINDOW_OPEN,
/**
* @const EVT_IM_COMMIT
*

View File

@ -52,24 +52,6 @@ typedef struct _keyboard_t {
*/
widget_t* keyboard_create(widget_t* parent, xy_t x, xy_t y, wh_t w, wh_t h);
/**
* @method keyboard_open
* @constructor
* keyboard对象ui_loader/ui_builder_default里实现
* @param {char*} name keyboard的名称
*
* @return {widget_t*}
*/
/**
* @method keyboard_open
* @constructor
* keyboard对象ui_loader/ui_builder_default里实现
* @param {char*} name keyboard的名称
*
* @return {widget_t*}
*/
/**
* @method keyboard_close
* @deconstructor

View File

@ -954,7 +954,7 @@ ret_t widget_foreach(widget_t* widget, tk_visit_t visit, void* ctx);
*
* @param {widget_t*} widget
*
* @return {widget*}
* @return {widget_t*}
*/
widget_t* widget_get_window(widget_t* widget);

View File

@ -93,8 +93,14 @@ static ret_t window_manager_create_animator(window_manager_t* wm, widget_t* curr
static ret_t window_manager_check_if_need_open_animation(const idle_info_t* info) {
widget_t* curr_win = WIDGET(info->ctx);
window_manager_t* wm = WINDOW_MANAGER(curr_win->parent);
ret_t ret = window_manager_create_animator(wm, curr_win, TRUE);
return window_manager_create_animator(wm, curr_win, TRUE);
if (ret != RET_OK) {
event_t e = event_init(EVT_WINDOW_OPEN, curr_win);
widget_dispatch(curr_win, &e);
}
return ret;
}
static ret_t window_manager_check_if_need_close_animation(window_manager_t* wm,
@ -260,6 +266,12 @@ static ret_t window_manager_paint_animation(widget_t* widget, canvas_t* c) {
window_manager_inc_fps(widget);
if (ret == RET_DONE) {
if (wm->animator->open) {
widget_t* curr_win = wm->animator->curr_win;
event_t e = event_init(EVT_WINDOW_OPEN, curr_win);
widget_dispatch(curr_win, &e);
}
window_animator_destroy(wm->animator);
wm->animator = NULL;
wm->animating = FALSE;

View File

@ -92,7 +92,7 @@ static ret_t input_method_default_show_keyboard(input_method_t* im) {
}
im->input_type = input_type;
im->keyboard = keyboard_open(keyboard);
im->keyboard = window_open(keyboard);
value_set_str(&v, open_anim_hint);
widget_set_prop(im->keyboard, WIDGET_PROP_OPEN_ANIM_HINT, &v);

View File

@ -60,6 +60,7 @@ ret_t tk_quit(void);
/**
* @method tk_set_lcd_orientation
* (XXX:090)
* @param {int} orientation
* @global
*
* @return {ret_t} RET_OK表示成功

View File

@ -133,7 +133,22 @@ ui_builder_t* ui_builder_default(const char* name) {
return &s_ui_builder;
}
static widget_t* window_open_impl(const char* name, int res_type) {
static ret_t on_window_open(void* ctx, event_t* e) {
widget_t* to_close = WIDGET(ctx);
widget_t* open = WIDGET(e->target);
if (open != NULL && open->name.str != NULL) {
log_debug("window %s open\n", open->name.str);
}
if (to_close != NULL && to_close->name.str != NULL) {
log_debug("window %s close\n", to_close->name.str);
}
return RET_REMOVE;
}
static widget_t* window_open_impl(const char* name, int res_type, widget_t* to_close) {
ui_loader_t* loader = default_ui_loader();
ui_builder_t* builder = ui_builder_default(name);
const resource_info_t* ui = resource_manager_ref(resource_manager(), res_type, name);
@ -142,15 +157,19 @@ static widget_t* window_open_impl(const char* name, int res_type) {
ui_loader_load(loader, ui->data, ui->size, builder);
resource_manager_unref(resource_manager(), ui);
if (builder->root != NULL) {
widget_on(builder->root, EVT_WINDOW_OPEN, on_window_open, to_close);
}
return builder->root;
}
widget_t* window_open(const char* name) {
return window_open_impl(name, RESOURCE_TYPE_UI);
widget_t* window_open_and_close(const char* name, widget_t* to_close) {
return window_open_impl(name, RESOURCE_TYPE_UI, to_close);
}
widget_t* keyboard_open(const char* name) {
return window_open_impl(name, RESOURCE_TYPE_UI);
widget_t* window_open(const char* name) {
return window_open_impl(name, RESOURCE_TYPE_UI, NULL);
}
widget_t* dialog_open(const char* name) {

View File

@ -30,7 +30,7 @@ ui_builder_t* ui_builder_default(const char* name);
widget_t* window_open(const char* name);
widget_t* dialog_open(const char* name);
widget_t* keyboard_open(const char* name);
widget_t* window_open_and_close(const char* name, widget_t* to_close);
END_C_DECLS

View File

@ -130,7 +130,7 @@ function extractIDL(result, filename, content) {
m.type = 'method';
m.header = filename;
result.push(m);
} else {
} else if(cls) {
cls.methods.push(m);
}
}

File diff suppressed because it is too large Load Diff