diff --git a/awtk_config.py b/awtk_config.py index 9e6520656..a35dd9890 100644 --- a/awtk_config.py +++ b/awtk_config.py @@ -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'), diff --git a/docs/changes.md b/docs/changes.md index 389d08a73..ed0948e6e 100644 --- a/docs/changes.md +++ b/docs/changes.md @@ -1,4 +1,8 @@ # 最新动态 +* 2019/04/02 + * 修改窗口动画内存溢出问题(感谢陈谭提供补丁)。 + * 修改windows平台编译问题(感谢陈谭提供补丁)。 + * 2019/04/01 * 从win获取locale info。 * 增加测试。 diff --git a/tests/window_design.c b/tests/window_design.c new file mode 100644 index 000000000..0e35e5a24 --- /dev/null +++ b/tests/window_design.c @@ -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); +} diff --git a/tests/window_design_test.cc b/tests/window_design_test.cc index c1233a8e7..1e08ea9c6 100644 --- a/tests/window_design_test.cc +++ b/tests/window_design_test.cc @@ -6,51 +6,11 @@ #include "gtest/gtest.h" #include -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);