2018-08-17 12:01:38 +08:00
|
|
|
/**
|
|
|
|
* File: demo_main.c
|
|
|
|
* Author: AWTK Develop Team
|
|
|
|
* Brief: demo main
|
|
|
|
*
|
2020-01-01 11:27:36 +08:00
|
|
|
* Copyright (c) 2018 - 2020 Guangzhou ZHIYUAN Electronics Co.,Ltd.
|
2018-08-17 12:01:38 +08:00
|
|
|
*
|
|
|
|
* 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-02-16 Li XianJing <xianjimli@hotmail.com> created
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "awtk.h"
|
|
|
|
|
2020-11-20 16:20:03 +08:00
|
|
|
static ret_t on_fullscreen(void* ctx, event_t* e) {
|
|
|
|
widget_t* btn = WIDGET(e->target);
|
|
|
|
window_t* win = WINDOW(widget_get_window(btn));
|
|
|
|
|
|
|
|
if (win->fullscreen) {
|
|
|
|
window_set_fullscreen(WIDGET(win), FALSE);
|
|
|
|
widget_set_text_utf8(btn, "Fullscreen");
|
|
|
|
} else {
|
|
|
|
window_set_fullscreen(WIDGET(win), TRUE);
|
|
|
|
widget_set_text_utf8(btn, "Unfullscreen");
|
|
|
|
}
|
|
|
|
|
|
|
|
return RET_OK;
|
|
|
|
}
|
2020-11-22 12:23:46 +08:00
|
|
|
|
2021-01-05 11:18:30 +08:00
|
|
|
static ret_t on_click_enlarge(void* ctx, event_t* e) {
|
2021-06-27 12:41:19 +08:00
|
|
|
window_manager_resize(window_manager(), 840, 800);
|
2021-01-05 11:18:30 +08:00
|
|
|
|
|
|
|
return RET_OK;
|
|
|
|
}
|
|
|
|
|
2020-03-13 10:28:49 +08:00
|
|
|
static ret_t on_click_close(void* ctx, event_t* e) {
|
|
|
|
tk_quit();
|
|
|
|
|
|
|
|
return RET_OK;
|
|
|
|
}
|
|
|
|
|
2018-08-17 12:01:38 +08:00
|
|
|
ret_t application_init(void) {
|
2020-11-20 16:20:03 +08:00
|
|
|
widget_t* win = window_open("desktop");
|
2020-03-13 10:28:49 +08:00
|
|
|
widget_child_on(win, "close", EVT_CLICK, on_click_close, NULL);
|
2021-01-05 11:18:30 +08:00
|
|
|
widget_child_on(win, "enlarge", EVT_CLICK, on_click_enlarge, NULL);
|
2020-11-20 16:20:03 +08:00
|
|
|
widget_child_on(win, "fullscreen", EVT_CLICK, on_fullscreen, win);
|
2018-08-17 12:01:38 +08:00
|
|
|
|
|
|
|
return RET_OK;
|
|
|
|
}
|
|
|
|
|
2020-02-24 08:21:11 +08:00
|
|
|
ret_t application_exit() {
|
|
|
|
log_debug("application_exit\n");
|
|
|
|
return RET_OK;
|
|
|
|
}
|
2018-08-17 12:01:38 +08:00
|
|
|
|
2021-06-08 17:08:01 +08:00
|
|
|
#define LCD_WIDTH 800
|
|
|
|
#define LCD_HEGHT 600
|
2020-03-13 10:28:49 +08:00
|
|
|
#define APP_TYPE APP_DESKTOP
|
2018-08-17 12:01:38 +08:00
|
|
|
|
2020-05-22 18:30:13 +08:00
|
|
|
#ifdef WITH_FS_RES
|
|
|
|
#define APP_DEFAULT_FONT "default_full"
|
2020-05-24 19:23:42 +08:00
|
|
|
#endif /*WITH_FS_RES*/
|
2020-05-22 18:30:13 +08:00
|
|
|
|
2020-02-24 08:21:11 +08:00
|
|
|
#include "awtk_main.inc"
|