mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-11-29 18:48:09 +08:00
fix windows compile errors
This commit is contained in:
parent
a558a709fe
commit
817038eeea
@ -141,6 +141,8 @@ CPPPATH=[TK_ROOT,
|
||||
TK_SRC,
|
||||
TK_3RD_ROOT,
|
||||
joinPath(TK_SRC, 'ext_widgets'),
|
||||
joinPath(TK_3RD_ROOT, 'pixman'),
|
||||
joinPath(TK_3RD_ROOT, 'pixman/pixman'),
|
||||
joinPath(TK_3RD_ROOT, 'bgfx/bgfx/include'),
|
||||
joinPath(TK_3RD_ROOT, 'bgfx/bx/include'),
|
||||
joinPath(TK_3RD_ROOT, 'bgfx/bimg/include'),
|
||||
|
@ -1,4 +1,8 @@
|
||||
# 最新动态
|
||||
* 2019/04/02
|
||||
* 修改窗口动画内存溢出问题(感谢陈谭提供补丁)。
|
||||
* 修改windows平台编译问题(感谢陈谭提供补丁)。
|
||||
|
||||
* 2019/04/01
|
||||
* 从win获取locale info。
|
||||
* 增加测试。
|
||||
|
48
tests/window_design.c
Normal file
48
tests/window_design.c
Normal file
@ -0,0 +1,48 @@
|
||||
#include "base/window_base.h"
|
||||
#include "widgets/window.h"
|
||||
|
||||
widget_t* window_design_create(widget_t* parent, xy_t x, xy_t y, wh_t w, wh_t h);
|
||||
|
||||
image_manager_t* t_image_manager = (image_manager_t*)(((char*)NULL) + 2);
|
||||
locale_info_t* t_locale_info = (locale_info_t*)(((char*)NULL) + 3);
|
||||
assets_manager_t* t_assets_manager = (assets_manager_t*)(((char*)NULL) + 4);
|
||||
font_manager_t* t_font_manager = (font_manager_t*)(((char*)NULL) + 5);
|
||||
|
||||
ret_t window_design_get_prop(widget_t* widget, const char* name, value_t* v) {
|
||||
return_value_if_fail(widget != NULL && name != NULL && v != NULL, RET_BAD_PARAMS);
|
||||
|
||||
if (tk_str_eq(name, WIDGET_PROP_DEFAULT_THEME_OBJ)) {
|
||||
value_set_pointer(v, theme());
|
||||
return RET_OK;
|
||||
} else if (tk_str_eq(name, WIDGET_PROP_IMAGE_MANAGER)) {
|
||||
value_set_pointer(v, (void*)(t_image_manager));
|
||||
return RET_OK;
|
||||
} else if (tk_str_eq(name, WIDGET_PROP_LOCALE_INFO)) {
|
||||
value_set_pointer(v, (void*)(t_locale_info));
|
||||
return RET_OK;
|
||||
} else if (tk_str_eq(name, WIDGET_PROP_FONT_MANAGER)) {
|
||||
value_set_pointer(v, (void*)(t_font_manager));
|
||||
return RET_OK;
|
||||
} else if (tk_str_eq(name, WIDGET_PROP_ASSETS_MANAGER)) {
|
||||
value_set_pointer(v, (void*)(t_assets_manager));
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
return RET_NOT_FOUND;
|
||||
}
|
||||
|
||||
TK_DECL_VTABLE(window_design) = {.type = WIDGET_TYPE_NORMAL_WINDOW,
|
||||
.size = sizeof(window_t),
|
||||
.is_window = TRUE,
|
||||
.parent = TK_PARENT_VTABLE(window_base),
|
||||
.create = window_design_create,
|
||||
.on_event = window_base_on_event,
|
||||
.on_paint_self = window_base_on_paint_self,
|
||||
.on_paint_begin = window_base_on_paint_begin,
|
||||
.on_paint_end = window_base_on_paint_end,
|
||||
.get_prop = window_design_get_prop,
|
||||
.on_destroy = window_base_on_destroy};
|
||||
|
||||
widget_t* window_design_create(widget_t* parent, xy_t x, xy_t y, wh_t w, wh_t h) {
|
||||
return window_base_create(parent, TK_REF_VTABLE(window_design), x, y, w, h);
|
||||
}
|
@ -6,51 +6,11 @@
|
||||
#include "gtest/gtest.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
widget_t* window_design_create(widget_t* parent, xy_t x, xy_t y, wh_t w, wh_t h);
|
||||
|
||||
static image_manager_t* t_image_manager = (image_manager_t*)(((char*)NULL) + 2);
|
||||
static locale_info_t* t_locale_info = (locale_info_t*)(((char*)NULL) + 3);
|
||||
static assets_manager_t* t_assets_manager = (assets_manager_t*)(((char*)NULL) + 4);
|
||||
static font_manager_t* t_font_manager = (font_manager_t*)(((char*)NULL) + 5);
|
||||
|
||||
ret_t window_design_get_prop(widget_t* widget, const char* name, value_t* v) {
|
||||
return_value_if_fail(widget != NULL && name != NULL && v != NULL, RET_BAD_PARAMS);
|
||||
|
||||
if (tk_str_eq(name, WIDGET_PROP_DEFAULT_THEME_OBJ)) {
|
||||
value_set_pointer(v, theme());
|
||||
return RET_OK;
|
||||
} else if (tk_str_eq(name, WIDGET_PROP_IMAGE_MANAGER)) {
|
||||
value_set_pointer(v, (void*)(t_image_manager));
|
||||
return RET_OK;
|
||||
} else if (tk_str_eq(name, WIDGET_PROP_LOCALE_INFO)) {
|
||||
value_set_pointer(v, (void*)(t_locale_info));
|
||||
return RET_OK;
|
||||
} else if (tk_str_eq(name, WIDGET_PROP_FONT_MANAGER)) {
|
||||
value_set_pointer(v, (void*)(t_font_manager));
|
||||
return RET_OK;
|
||||
} else if (tk_str_eq(name, WIDGET_PROP_ASSETS_MANAGER)) {
|
||||
value_set_pointer(v, (void*)(t_assets_manager));
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
return RET_NOT_FOUND;
|
||||
}
|
||||
|
||||
TK_DECL_VTABLE(window_design) = {.type = WIDGET_TYPE_NORMAL_WINDOW,
|
||||
.size = sizeof(window_t),
|
||||
.is_window = TRUE,
|
||||
.parent = TK_PARENT_VTABLE(window_base),
|
||||
.create = window_design_create,
|
||||
.on_event = window_base_on_event,
|
||||
.on_paint_self = window_base_on_paint_self,
|
||||
.on_paint_begin = window_base_on_paint_begin,
|
||||
.on_paint_end = window_base_on_paint_end,
|
||||
.get_prop = window_design_get_prop,
|
||||
.on_destroy = window_base_on_destroy};
|
||||
|
||||
widget_t* window_design_create(widget_t* parent, xy_t x, xy_t y, wh_t w, wh_t h) {
|
||||
return window_base_create(parent, TK_REF_VTABLE(window_design), x, y, w, h);
|
||||
}
|
||||
extern "C" widget_t* window_design_create(widget_t* parent, xy_t x, xy_t y, wh_t w, wh_t h);
|
||||
extern "C" image_manager_t* t_image_manager;
|
||||
extern "C" locale_info_t* t_locale_info;
|
||||
extern "C" assets_manager_t* t_assets_manager;
|
||||
extern "C" font_manager_t* t_font_manager;
|
||||
|
||||
TEST(WindowDesign, locale_info) {
|
||||
widget_t* w = window_design_create(NULL, 10, 20, 30, 40);
|
||||
|
Loading…
Reference in New Issue
Block a user