mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-11-30 02:58:26 +08:00
57 lines
2.4 KiB
C
57 lines
2.4 KiB
C
#include "base/window_base.h"
|
|
#include "base/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, t_image_manager);
|
|
return RET_OK;
|
|
} else if (tk_str_eq(name, WIDGET_PROP_LOCALE_INFO)) {
|
|
value_set_pointer(v, t_locale_info);
|
|
return RET_OK;
|
|
} else if (tk_str_eq(name, WIDGET_PROP_FONT_MANAGER)) {
|
|
value_set_pointer(v, t_font_manager);
|
|
} else if (tk_str_eq(name, WIDGET_PROP_ASSETS_MANAGER)) {
|
|
value_set_pointer(v, 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,
|
|
.get_parent_vt = TK_GET_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) {
|
|
widget_t* widget = window_base_create(parent, TK_REF_VTABLE(window_design), x, y, w, h);
|
|
window_base_t* base = WINDOW_BASE(widget);
|
|
return_value_if_fail(base != NULL, NULL);
|
|
|
|
base->image_manager = t_image_manager;
|
|
base->locale_info = t_locale_info;
|
|
base->font_manager = t_font_manager;
|
|
base->assets_manager = t_assets_manager;
|
|
|
|
return widget;
|
|
}
|