mirror of
https://github.com/zlgopen/awtk.git
synced 2025-05-08 19:44:45 +08:00
improve widget vtable
This commit is contained in:
parent
262fd346f6
commit
45436e0bf2
@ -193,7 +193,7 @@ CFLAGS = COMMON_CFLAGS
|
||||
LINKFLAGS = OS_LINKFLAGS
|
||||
LIBPATH = [TK_BIN_DIR, TK_LIB_DIR] + OS_LIBPATH
|
||||
CCFLAGS = OS_FLAGS + COMMON_CCFLAGS
|
||||
AWTK_CCFLAGS = OS_FLAGS + COMMON_CCFLAGS + ' -DWITH_WIDGET_TYPE_CHECK=1 '
|
||||
AWTK_CCFLAGS = OS_FLAGS + COMMON_CCFLAGS
|
||||
|
||||
AWTK_STATIC_LIBS = AWTK_STATIC_LIBS + NANOVG_BACKEND_LIBS
|
||||
STATIC_LIBS = AWTK_STATIC_LIBS + ['SDL2', 'glad'] + OS_LIBS
|
||||
|
@ -1067,7 +1067,7 @@ static ret_t vpage_change_kb_type_without_zh(void* ctx, const void* iter) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
vt = (vt->parent != NULL) ? vt->parent : NULL;
|
||||
vt = (vt->get_parent_vt != NULL) ? vt->get_parent_vt() : NULL;
|
||||
}
|
||||
|
||||
return RET_OK;
|
||||
|
@ -1,5 +1,8 @@
|
||||
# 最新动态
|
||||
|
||||
2022/10/12
|
||||
* 删除WITH\_WIDGET\_TYPE\_CHECK宏支持非awtk类库继承控件方案(感谢智明提供补丁)
|
||||
|
||||
2022/10/11
|
||||
* fscript_widget新增show_fps接口(感谢雨欣提供补丁)
|
||||
* 完善高亮策略中的update_background功能(感谢雨欣提供补丁)
|
||||
|
@ -16,7 +16,7 @@ TK_DECL_VTABLE(edit) = {.size = sizeof(edit_t),
|
||||
.pointer_cursor = WIDGET_CURSOR_EDIT,
|
||||
.clone_properties = s_edit_properties,
|
||||
.persistent_properties = s_edit_properties,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = edit_create,
|
||||
.on_re_translate = edit_on_re_translate,
|
||||
.on_paint_self = edit_on_paint_self,
|
||||
|
@ -173,12 +173,6 @@
|
||||
* #define FRAGMENT_FRAME_BUFFER_SIZE 32 * 1024
|
||||
*/
|
||||
|
||||
/**
|
||||
* 启用 widget 类型检查,请定义本宏(除非编译器不支持,否则请定义它)。
|
||||
*
|
||||
* #define WITH_WIDGET_TYPE_CHECK 1
|
||||
*/
|
||||
|
||||
/**
|
||||
* 启用输入法,但不想启用联想功能,请定义本宏。
|
||||
*
|
||||
|
@ -191,12 +191,6 @@
|
||||
* #define FRAGMENT_FRAME_BUFFER_SIZE 32 * 1024
|
||||
*/
|
||||
|
||||
/**
|
||||
* 启用widget类型检查,请定义本宏(除非编译器不支持,否则请定义它)。
|
||||
*
|
||||
* #define WITH_WIDGET_TYPE_CHECK 1
|
||||
*/
|
||||
|
||||
/**
|
||||
* 启用输入法,但不想启用联想功能,请定义本宏。
|
||||
*
|
||||
|
@ -103,7 +103,7 @@ TK_DECL_VTABLE(dialog) = {.size = sizeof(dialog_t),
|
||||
.clone_properties = s_dialog_properties,
|
||||
.on_copy = dialog_on_copy,
|
||||
.persistent_properties = s_dialog_properties,
|
||||
.parent = TK_PARENT_VTABLE(window_base),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(window_base),
|
||||
.create = dialog_create,
|
||||
.on_add_child = dialog_on_add_child,
|
||||
.on_event = window_base_on_event,
|
||||
|
@ -244,7 +244,7 @@ ret_t image_base_set_clickable(widget_t* widget, bool_t clickable) {
|
||||
return widget_invalidate(widget, NULL);
|
||||
}
|
||||
|
||||
TK_DECL_VTABLE(image_base) = {.size = sizeof(image_base_t), .parent = TK_PARENT_VTABLE(widget)};
|
||||
TK_DECL_VTABLE(image_base) = {.size = sizeof(image_base_t), .get_parent_vt = TK_GET_PARENT_VTABLE(widget)};
|
||||
|
||||
widget_t* image_base_cast(widget_t* widget) {
|
||||
return_value_if_fail(WIDGET_IS_INSTANCE_OF(widget, image_base), NULL);
|
||||
|
@ -305,17 +305,15 @@ typedef struct _widget_animator_t widget_animator_t;
|
||||
#define TK_KEY_LONG_PRESS_TIME TK_LONG_PRESS_TIME
|
||||
#endif /*TK_KEY_LONG_PRESS_TIME*/
|
||||
|
||||
#ifdef WITH_WIDGET_TYPE_CHECK
|
||||
#define TK_REF_VTABLE(vt) &(g_##vt##_vtable)
|
||||
#define TK_PARENT_VTABLE(vt) TK_REF_VTABLE(vt)
|
||||
#define TK_DECL_VTABLE(vt) const widget_vtable_t g_##vt##_vtable
|
||||
#define TK_EXTERN_VTABLE(vt) extern const widget_vtable_t g_##vt##_vtable
|
||||
#else
|
||||
#define TK_REF_VTABLE(vt) &(s_##vt##_vtable)
|
||||
#define TK_PARENT_VTABLE(vt) NULL
|
||||
#define TK_DECL_VTABLE(vt) static const widget_vtable_t s_##vt##_vtable
|
||||
#define TK_EXTERN_VTABLE(vt)
|
||||
#endif /*WITH_WIDGET_TYPE_CHECK*/
|
||||
#define TK_GET_VTABLE(vt) vt##_get_widget_vtable()
|
||||
#define TK_GET_PARENT_VTABLE(vt) vt##_get_widget_vtable
|
||||
#define TK_PARENT_VTABLE(vt) NULL, .get_parent_vt = TK_GET_PARENT_VTABLE(vt)
|
||||
#define TK_DECL_VTABLE(vt) \
|
||||
extern const widget_vtable_t g_##vt##_vtable; \
|
||||
const widget_vtable_t* vt##_get_widget_vtable(void) { return &g_##vt##_vtable; } \
|
||||
const widget_vtable_t g_##vt##_vtable
|
||||
#define TK_EXTERN_VTABLE(vt) const widget_vtable_t* vt##_get_widget_vtable(void);
|
||||
|
||||
#ifndef TK_KEY_MOVE_FOCUS_NEXT
|
||||
#define TK_KEY_MOVE_FOCUS_NEXT "tab"
|
||||
|
@ -3594,7 +3594,7 @@ widget_t* widget_init(widget_t* widget, widget_t* parent, const widget_vtable_t*
|
||||
|
||||
wstr_init(&(widget->text), 0);
|
||||
if (!widget->vt) {
|
||||
widget->vt = widget_vtable_default();
|
||||
widget->vt = TK_GET_VTABLE(widget);
|
||||
}
|
||||
|
||||
if (widget->astyle == NULL &&
|
||||
@ -4090,17 +4090,13 @@ bool_t widget_is_instance_of(widget_t* widget, const widget_vtable_t* vt) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
iter = iter->parent;
|
||||
iter = widget_get_parent_vtable(iter);
|
||||
}
|
||||
#ifdef WITH_WIDGET_TYPE_CHECK
|
||||
if (vt == widget_vtable_default()) {
|
||||
if (vt == TK_GET_VTABLE(widget)) {
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
#else
|
||||
return TRUE;
|
||||
#endif /*WITH_WIDGET_TYPE_CHECK*/
|
||||
}
|
||||
|
||||
static ret_t widget_ensure_visible_in_scroll_view(widget_t* scroll_view, widget_t* widget) {
|
||||
|
@ -50,6 +50,8 @@
|
||||
|
||||
BEGIN_C_DECLS
|
||||
|
||||
typedef const widget_vtable_t* (*widget_get_vt_t)(void);
|
||||
|
||||
typedef ret_t (*widget_invalidate_t)(widget_t* widget, const rect_t* r);
|
||||
typedef ret_t (*widget_on_event_t)(widget_t* widget, event_t* e);
|
||||
typedef ret_t (*widget_on_event_before_children_t)(widget_t* widget, event_t* e);
|
||||
@ -151,9 +153,22 @@ struct _widget_vtable_t {
|
||||
uint32_t allow_draw_outside : 1;
|
||||
|
||||
/**
|
||||
* parent class vtable
|
||||
* dynamic parent class vtable
|
||||
* 该属性用于动态继承使用的获取父类虚表。(parent 和 get_parent_vt 只能二选一)
|
||||
* 备注:
|
||||
* 1,如果需要获取父类的虚表,请使用 widget_get_parent_vtable 函数来获取。
|
||||
* 2,动态继承需要通过 widget_vtable_init 函数来动态创建 vt 虚表
|
||||
* 3,动态继承是运行时的时候才会使用,所以 awtk 默认的控件都是属于静态继承的,所以静态继承状态下,该 parent 属性为 NULL。
|
||||
*/
|
||||
const struct _widget_vtable_t* parent;
|
||||
/**
|
||||
* get parent class vtable
|
||||
* 该属性用于静态继承的时候的获取父类虚表指针。(parent 和 get_parent_vt 只能二选一)
|
||||
* 备注:
|
||||
* 1,如果需要获取父类的虚表,请使用 widget_get_parent_vtable 函数来获取。
|
||||
* 2,awtk 默认控件都是静态继承的,所以该 get_parent_vt 属性一般有值,但是一旦出现动态继承后,该 get_parent_vt 属性值为 NULL。
|
||||
*/
|
||||
widget_get_vt_t get_parent_vt;
|
||||
/**
|
||||
* cursor image name
|
||||
*/
|
||||
|
@ -22,6 +22,38 @@
|
||||
#include "base/widget_vtable.h"
|
||||
#include "tkc/mem.h"
|
||||
|
||||
widget_vtable_t* widget_vtable_init(widget_vtable_t* vt, const widget_vtable_t* parent) {
|
||||
return_value_if_fail(vt != NULL && parent != NULL, NULL);
|
||||
tk_memcpy(vt, parent, sizeof(widget_vtable_t));
|
||||
vt->parent = parent;
|
||||
vt->get_parent_vt = NULL;
|
||||
return vt;
|
||||
}
|
||||
|
||||
const widget_vtable_t* widget_get_parent_vtable(const widget_vtable_t* vt) {
|
||||
return_value_if_fail(vt != NULL, NULL);
|
||||
return_value_if_fail(!(vt->parent != NULL && vt->get_parent_vt != NULL), NULL);
|
||||
|
||||
if (vt->parent != NULL) {
|
||||
return vt->parent;
|
||||
}
|
||||
if (vt->get_parent_vt != NULL) {
|
||||
return vt->get_parent_vt();
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ret_t widget_set_self_vtable(widget_t* widget, const widget_vtable_t* vt) {
|
||||
return_value_if_fail(widget != NULL && vt != NULL, RET_BAD_PARAMS);
|
||||
widget->vt = vt;
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
const widget_vtable_t* widget_get_self_vtable(widget_t* widget) {
|
||||
return_value_if_fail(widget != NULL, NULL);
|
||||
return widget->vt;
|
||||
}
|
||||
|
||||
ret_t widget_invalidate_default(widget_t* widget, const rect_t* rect) {
|
||||
rect_t t = *rect;
|
||||
rect_t* r = &t;
|
||||
@ -280,6 +312,7 @@ ret_t widget_on_paint_children_clip(widget_t* widget, canvas_t* c) {
|
||||
TK_DECL_VTABLE(widget) = {.size = sizeof(widget_t),
|
||||
.type = WIDGET_TYPE_NONE,
|
||||
.parent = NULL,
|
||||
.get_parent_vt = NULL,
|
||||
.on_copy = widget_on_copy_default,
|
||||
.invalidate = widget_invalidate_default,
|
||||
.on_event = widget_on_event_default,
|
||||
@ -295,6 +328,3 @@ TK_DECL_VTABLE(widget) = {.size = sizeof(widget_t),
|
||||
.find_target = widget_find_target_default,
|
||||
.on_destroy = widget_on_destroy_default};
|
||||
|
||||
const widget_vtable_t* widget_vtable_default() {
|
||||
return TK_REF_VTABLE(widget);
|
||||
}
|
||||
|
@ -184,7 +184,58 @@ ret_t widget_set_prop_default(widget_t* widget, const char* name, const value_t*
|
||||
*/
|
||||
widget_t* widget_find_target_default(widget_t* widget, xy_t x, xy_t y);
|
||||
|
||||
const widget_vtable_t* widget_vtable_default(void);
|
||||
/**
|
||||
* @method widget_vtable_init
|
||||
* 动态初始化虚表。
|
||||
*
|
||||
* 备注:
|
||||
* 初始化的时候,虚表会自动继承父类的所有属性。
|
||||
* @annotation ["global"]
|
||||
*
|
||||
* @param {widget_vtable_t*} vt 子类虚表。
|
||||
* @param {const widget_vtable_t*} parent 被继承的父类虚表。
|
||||
*
|
||||
* @return {widget_vtable_t*} 成功返回虚表,失败返回 NULL。
|
||||
*/
|
||||
widget_vtable_t* widget_vtable_init(widget_vtable_t* vt, const widget_vtable_t* parent);
|
||||
|
||||
/**
|
||||
* @method widget_get_parent_vtable
|
||||
* 获取父类的虚表。
|
||||
*
|
||||
* @annotation ["global"]
|
||||
*
|
||||
* @param {const widget_vtable_t*} vt 子类的虚表。
|
||||
*
|
||||
* @return {const widget_vtable_t*} 成功返回虚表,失败返回 NULL。
|
||||
*/
|
||||
const widget_vtable_t* widget_get_parent_vtable(const widget_vtable_t* vt);
|
||||
|
||||
/**
|
||||
* @method widget_set_self_vtable
|
||||
* 设置控件的虚表。
|
||||
*
|
||||
* @annotation ["global"]
|
||||
*
|
||||
* @param {widget_t*} widget 控件。
|
||||
* @param {const widget_vtable_t*} vt 新的虚表。
|
||||
*
|
||||
* @return {ret_t} 返回RET_OK表示成功,否则表示失败。
|
||||
*/
|
||||
ret_t widget_set_self_vtable(widget_t* widget, const widget_vtable_t* vt);
|
||||
|
||||
/**
|
||||
* @method widget_get_self_vtable
|
||||
* 获取控件的虚表。
|
||||
*
|
||||
* @annotation ["global"]
|
||||
*
|
||||
* @param {widget_t*} widget 控件。
|
||||
*
|
||||
* @return {const widget_vtable_t*} 成功返回虚表,失败返回 NULL。
|
||||
*/
|
||||
const widget_vtable_t* widget_get_self_vtable(widget_t* widget);
|
||||
|
||||
ret_t widget_grab_default(widget_t* widget, widget_t* child);
|
||||
ret_t widget_ungrab_default(widget_t* widget, widget_t* child);
|
||||
ret_t widget_destroy_default(widget_t* widget);
|
||||
|
@ -81,7 +81,7 @@ static ret_t window_on_copy(widget_t* widget, widget_t* other) {
|
||||
TK_DECL_VTABLE(window) = {.type = WIDGET_TYPE_NORMAL_WINDOW,
|
||||
.size = sizeof(window_t),
|
||||
.is_window = TRUE,
|
||||
.parent = TK_PARENT_VTABLE(window_base),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(window_base),
|
||||
.create = window_create,
|
||||
.clone_properties = s_window_properties,
|
||||
.on_copy = window_on_copy,
|
||||
|
@ -678,7 +678,7 @@ static const char* s_window_base_properties[] = {WIDGET_PROP_ANIM_HINT,
|
||||
|
||||
TK_DECL_VTABLE(window_base) = {
|
||||
.size = sizeof(window_base_t),
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.clone_properties = s_window_base_properties,
|
||||
.persistent_properties = s_window_base_properties,
|
||||
};
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
TK_DECL_VTABLE(canvas_widget) = {.size = sizeof(canvas_widget_t),
|
||||
.type = WIDGET_TYPE_CANVAS_WIDGET,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = canvas_widget_create};
|
||||
|
||||
widget_t* canvas_widget_create(widget_t* parent, xy_t x, xy_t y, wh_t w, wh_t h) {
|
||||
|
@ -153,7 +153,7 @@ static ret_t color_component_on_destroy(widget_t* widget) {
|
||||
TK_DECL_VTABLE(color_component) = {.size = sizeof(color_component_t),
|
||||
.inputable = TRUE,
|
||||
.type = WIDGET_TYPE_COLOR_COMPONENT,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = color_component_create,
|
||||
.on_destroy = color_component_on_destroy,
|
||||
.on_event = color_component_on_event,
|
||||
|
@ -57,7 +57,7 @@ TK_DECL_VTABLE(color_picker) = {.size = sizeof(color_picker_t),
|
||||
.type = WIDGET_TYPE_COLOR_PICKER,
|
||||
.set_prop = color_picker_set_prop,
|
||||
.get_prop = color_picker_get_prop,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.on_paint_begin = color_picker_on_paint_begin,
|
||||
.create = color_picker_create};
|
||||
|
||||
|
@ -359,7 +359,7 @@ TK_DECL_VTABLE(draggable) = {.size = sizeof(draggable_t),
|
||||
.type = WIDGET_TYPE_DRAGGABLE,
|
||||
.clone_properties = s_draggable_properties,
|
||||
.persistent_properties = s_draggable_properties,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = draggable_create,
|
||||
.on_paint_self = draggable_on_paint_self,
|
||||
.set_prop = draggable_set_prop,
|
||||
|
@ -454,7 +454,7 @@ TK_DECL_VTABLE(file_browser_view) = {.size = sizeof(file_browser_view_t),
|
||||
.type = WIDGET_TYPE_FILE_BROWSER_VIEW,
|
||||
.clone_properties = s_file_browser_view_properties,
|
||||
.persistent_properties = s_file_browser_view_properties,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = file_browser_view_create,
|
||||
.on_paint_self = file_browser_view_on_paint_self,
|
||||
.set_prop = file_browser_view_set_prop,
|
||||
|
@ -107,7 +107,7 @@ TK_DECL_VTABLE(gauge) = {.size = sizeof(gauge_t),
|
||||
.type = WIDGET_TYPE_GAUGE,
|
||||
.clone_properties = s_gauge_properties,
|
||||
.persistent_properties = s_gauge_properties,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = gauge_create,
|
||||
.on_paint_self = gauge_on_paint_self,
|
||||
.set_prop = gauge_set_prop,
|
||||
|
@ -341,7 +341,7 @@ TK_DECL_VTABLE(gauge_pointer) = {.size = sizeof(gauge_pointer_t),
|
||||
.clone_properties = s_gauge_pointer_properties,
|
||||
.persistent_properties = s_gauge_pointer_properties,
|
||||
.allow_draw_outside = TRUE,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = gauge_pointer_create,
|
||||
.on_paint_self = gauge_pointer_on_paint_self,
|
||||
.on_paint_background = widget_on_paint_null,
|
||||
|
@ -241,7 +241,7 @@ TK_DECL_VTABLE(gif_image) = {.size = sizeof(gif_image_t),
|
||||
.return_key_to_activate = TRUE,
|
||||
.clone_properties = s_gif_image_properties,
|
||||
.persistent_properties = s_gif_image_properties,
|
||||
.parent = TK_PARENT_VTABLE(image_base),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(image_base),
|
||||
.create = gif_image_create,
|
||||
.on_destroy = gif_image_on_destroy,
|
||||
.on_event = image_base_on_event,
|
||||
|
@ -233,7 +233,7 @@ static const char* s_image_animation_clone_properties[] = {IMAGE_ANIMATION_PROP_
|
||||
TK_DECL_VTABLE(image_animation) = {.size = sizeof(image_animation_t),
|
||||
.type = WIDGET_TYPE_IMAGE_ANIMATION,
|
||||
.clone_properties = s_image_animation_clone_properties,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = image_animation_create,
|
||||
.on_destroy = image_animation_on_destroy,
|
||||
.get_prop = image_animation_get_prop,
|
||||
|
@ -298,7 +298,7 @@ static const char* s_image_value_properties[] = {WIDGET_PROP_VALUE,
|
||||
|
||||
TK_DECL_VTABLE(image_value) = {.size = sizeof(image_value_t),
|
||||
.type = WIDGET_TYPE_IMAGE_VALUE,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.inputable = TRUE,
|
||||
.clone_properties = s_image_value_properties,
|
||||
.persistent_properties = s_image_value_properties,
|
||||
|
@ -395,7 +395,7 @@ static const char* const s_candidates_properties[] = {
|
||||
TK_DECL_VTABLE(candidates) = {.size = sizeof(candidates_t),
|
||||
.scrollable = TRUE,
|
||||
.type = WIDGET_TYPE_CANDIDATES,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.clone_properties = s_candidates_properties,
|
||||
.persistent_properties = s_candidates_properties,
|
||||
.create = candidates_create,
|
||||
|
@ -81,7 +81,7 @@ TK_DECL_VTABLE(keyboard) = {.size = sizeof(keyboard_t),
|
||||
.is_keyboard = TRUE,
|
||||
.clone_properties = s_keyboard_properties,
|
||||
.persistent_properties = s_keyboard_properties,
|
||||
.parent = TK_PARENT_VTABLE(window_base),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(window_base),
|
||||
.create = keyboard_create,
|
||||
.on_event = keyboard_on_event,
|
||||
.on_paint_self = window_base_on_paint_self,
|
||||
|
@ -84,7 +84,7 @@ static ret_t lang_indicator_on_paint_self(widget_t* widget, canvas_t* c) {
|
||||
|
||||
TK_DECL_VTABLE(lang_indicator) = {.size = sizeof(lang_indicator_t),
|
||||
.type = WIDGET_TYPE_LANG_INDICATOR,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.set_prop = lang_indicator_set_prop,
|
||||
.get_prop = lang_indicator_get_prop,
|
||||
.on_destroy = lang_indicator_on_destroy,
|
||||
|
@ -194,7 +194,7 @@ static ret_t line_number_set_prop(widget_t* widget, const char* name, const valu
|
||||
|
||||
TK_DECL_VTABLE(line_number) = {.size = sizeof(line_number_t),
|
||||
.type = WIDGET_TYPE_LINE_NUMBER,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = line_number_create,
|
||||
.set_prop = line_number_set_prop,
|
||||
.get_prop = line_number_get_prop,
|
||||
|
@ -1162,7 +1162,7 @@ TK_DECL_VTABLE(mledit) = {.size = sizeof(mledit_t),
|
||||
.pointer_cursor = WIDGET_CURSOR_EDIT,
|
||||
.clone_properties = s_mledit_properties,
|
||||
.persistent_properties = s_mledit_properties,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = mledit_create,
|
||||
.on_paint_self = mledit_on_paint_self,
|
||||
.on_re_translate = mledit_on_re_translate,
|
||||
|
@ -149,7 +149,7 @@ static ret_t mutable_image_set_prop(widget_t* widget, const char* name, const va
|
||||
TK_DECL_VTABLE(mutable_image) = {.size = sizeof(mutable_image_t),
|
||||
.type = WIDGET_TYPE_MUTABLE_IMAGE,
|
||||
.clone_properties = s_mutable_image_clone_properties,
|
||||
.parent = TK_PARENT_VTABLE(image_base),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(image_base),
|
||||
.create = mutable_image_create,
|
||||
.on_destroy = mutable_image_on_destroy,
|
||||
.on_event = image_base_on_event,
|
||||
|
@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
* File: progress_circle.c
|
||||
* Author: AWTK Develop Team
|
||||
* Brief: progress_circle
|
||||
@ -417,7 +417,7 @@ static const char* s_progress_circle_clone_properties[] = {WIDGET_PROP_VALUE,
|
||||
TK_DECL_VTABLE(progress_circle) = {.size = sizeof(progress_circle_t),
|
||||
.type = WIDGET_TYPE_PROGRESS_CIRCLE,
|
||||
.clone_properties = s_progress_circle_clone_properties,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = progress_circle_create,
|
||||
.on_paint_self = progress_circle_on_paint_self,
|
||||
.on_paint_background = progress_circle_on_paint_background,
|
||||
|
@ -586,7 +586,7 @@ static const char* s_rich_text_clone_properties[] = {WIDGET_PROP_MARGIN, WIDGET_
|
||||
NULL};
|
||||
TK_DECL_VTABLE(rich_text) = {.size = sizeof(rich_text_t),
|
||||
.type = "rich_text",
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = rich_text_create,
|
||||
.clone_properties = s_rich_text_clone_properties,
|
||||
.on_event = rich_text_on_event,
|
||||
|
@ -119,7 +119,7 @@ static ret_t rich_text_view_on_remove_child(widget_t* widget, widget_t* child) {
|
||||
|
||||
TK_DECL_VTABLE(rich_text_view) = {.size = sizeof(rich_text_view_t),
|
||||
.type = WIDGET_TYPE_RICH_TEXT_VIEW,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.on_add_child = rich_text_view_on_add_child,
|
||||
.on_remove_child = rich_text_view_on_remove_child,
|
||||
.create = rich_text_view_create};
|
||||
|
@ -518,7 +518,7 @@ static const char* const s_hscroll_label_properties[] = {HSCROLL_LABEL_PROP_YOYO
|
||||
TK_DECL_VTABLE(hscroll_label) = {.size = sizeof(hscroll_label_t),
|
||||
.type = WIDGET_TYPE_HSCROLL_LABEL,
|
||||
.clone_properties = s_hscroll_label_properties,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = hscroll_label_create,
|
||||
.on_destroy = hscroll_label_on_destroy,
|
||||
.on_attach_parent = hscroll_label_on_attach_parent,
|
||||
|
@ -163,7 +163,7 @@ TK_DECL_VTABLE(list_item) = {.size = sizeof(list_item_t),
|
||||
.type = WIDGET_TYPE_LIST_ITEM,
|
||||
.space_key_to_activate = TRUE,
|
||||
.return_key_to_activate = TRUE,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = list_item_create,
|
||||
.on_event = list_item_on_event,
|
||||
.on_paint_self = list_item_on_paint_self,
|
||||
|
@ -107,9 +107,6 @@ widget_t* list_item_seperator_cast(widget_t* widget);
|
||||
#define LIST_ITEM_SEPERATOR(widget) \
|
||||
((list_item_seperator_t*)(list_item_seperator_cast(WIDGET(widget))))
|
||||
|
||||
/*public for subclass and runtime type check*/
|
||||
TK_EXTERN_VTABLE(list_item_seperator);
|
||||
|
||||
#define WIDGET_TYPE_LIST_ITEM_SEPERATOR "list_item_seperator"
|
||||
|
||||
END_C_DECLS
|
||||
|
@ -197,7 +197,7 @@ static ret_t list_view_on_event(widget_t* widget, event_t* e) {
|
||||
|
||||
TK_DECL_VTABLE(list_view) = {.type = WIDGET_TYPE_LIST_VIEW,
|
||||
.size = sizeof(list_view_t),
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = list_view_create,
|
||||
.set_prop = list_view_set_prop,
|
||||
.get_prop = list_view_get_prop,
|
||||
|
@ -87,7 +87,7 @@ static ret_t list_view_h_on_event(widget_t* widget, event_t* e) {
|
||||
|
||||
TK_DECL_VTABLE(list_view_h) = {.type = WIDGET_TYPE_LIST_VIEW_H,
|
||||
.size = sizeof(list_view_h_t),
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = list_view_h_create,
|
||||
.set_prop = list_view_h_set_prop,
|
||||
.get_prop = list_view_h_get_prop,
|
||||
|
@ -538,7 +538,7 @@ TK_DECL_VTABLE(scroll_bar_mobile) = {.size = sizeof(scroll_bar_t),
|
||||
.inputable = TRUE,
|
||||
.type = WIDGET_TYPE_SCROLL_BAR_MOBILE,
|
||||
.clone_properties = s_scroll_bar_clone_properties,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = scroll_bar_create_mobile,
|
||||
.set_prop = scroll_bar_set_prop,
|
||||
.get_prop = scroll_bar_get_prop,
|
||||
@ -550,7 +550,7 @@ TK_DECL_VTABLE(scroll_bar_desktop) = {.size = sizeof(scroll_bar_t),
|
||||
.type = WIDGET_TYPE_SCROLL_BAR_DESKTOP,
|
||||
.clone_properties = s_scroll_bar_clone_properties,
|
||||
.persistent_properties = s_scroll_bar_persitent_properties,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = scroll_bar_create_desktop_self,
|
||||
.on_event = scroll_bar_desktop_on_event,
|
||||
.on_layout_children = scroll_bar_on_layout_children,
|
||||
|
@ -771,7 +771,7 @@ TK_DECL_VTABLE(scroll_view) = {.size = sizeof(scroll_view_t),
|
||||
.type = WIDGET_TYPE_SCROLL_VIEW,
|
||||
.scrollable = TRUE,
|
||||
.clone_properties = s_scroll_view_clone_properties,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = scroll_view_create,
|
||||
.on_event = scroll_view_on_event,
|
||||
.on_layout_children = scroll_view_on_layout_children,
|
||||
|
@ -328,7 +328,7 @@ TK_DECL_VTABLE(serial_widget) = {.size = sizeof(serial_widget_t),
|
||||
.type = WIDGET_TYPE_SERIAL_WIDGET,
|
||||
.clone_properties = s_serial_widget_properties,
|
||||
.persistent_properties = s_serial_widget_properties,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = serial_widget_create,
|
||||
.on_paint_self = serial_widget_on_paint_self,
|
||||
.set_prop = serial_widget_set_prop,
|
||||
|
@ -659,7 +659,7 @@ TK_DECL_VTABLE(slide_menu) = {.size = sizeof(slide_menu_t),
|
||||
.type = WIDGET_TYPE_SLIDE_MENU,
|
||||
.clone_properties = s_slide_menu_properties,
|
||||
.persistent_properties = s_slide_menu_properties,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = slide_menu_create,
|
||||
.set_prop = slide_menu_set_prop,
|
||||
.get_prop = slide_menu_get_prop,
|
||||
|
@ -924,7 +924,7 @@ TK_DECL_VTABLE(slide_indicator_linear) = {.size = sizeof(slide_indicator_t),
|
||||
.type = WIDGET_TYPE_SLIDE_INDICATOR,
|
||||
.clone_properties = s_slide_indicator_properties,
|
||||
.persistent_properties = s_slide_indicator_properties,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = slide_indicator_create,
|
||||
.on_event = slide_indicator_on_event,
|
||||
.get_prop = slide_indicator_get_prop,
|
||||
@ -938,7 +938,7 @@ TK_DECL_VTABLE(slide_indicator_arc) = {.size = sizeof(slide_indicator_t),
|
||||
.type = WIDGET_TYPE_SLIDE_INDICATOR_ARC,
|
||||
.clone_properties = s_slide_indicator_properties,
|
||||
.persistent_properties = s_slide_indicator_properties,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = slide_indicator_create_arc,
|
||||
.on_event = slide_indicator_on_event,
|
||||
.get_prop = slide_indicator_get_prop,
|
||||
|
@ -784,7 +784,7 @@ TK_DECL_VTABLE(slide_view) = {.size = sizeof(slide_view_t),
|
||||
.get_only_active_children = slide_view_get_only_active_children,
|
||||
.clone_properties = s_slide_view_properties,
|
||||
.persistent_properties = s_slide_view_properties,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = slide_view_create,
|
||||
.on_event = slide_view_on_event,
|
||||
.get_prop = slide_view_get_prop,
|
||||
|
@ -135,7 +135,7 @@ TK_DECL_VTABLE(svg_image) = {.size = sizeof(svg_image_t),
|
||||
.type = WIDGET_TYPE_SVG_IMAGE,
|
||||
.clone_properties = s_svg_image_properties,
|
||||
.persistent_properties = s_svg_image_properties,
|
||||
.parent = TK_PARENT_VTABLE(image_base),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(image_base),
|
||||
.create = svg_image_create,
|
||||
.on_destroy = svg_image_on_destroy,
|
||||
.on_event = image_base_on_event,
|
||||
|
@ -433,7 +433,7 @@ TK_DECL_VTABLE(switch) = {
|
||||
.return_key_to_activate = TRUE,
|
||||
.clone_properties = s_switch_properties,
|
||||
.persistent_properties = s_switch_properties,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = switch_create,
|
||||
.on_event = switch_on_event,
|
||||
.on_paint_background = switch_on_paint_background,
|
||||
|
@ -798,7 +798,7 @@ TK_DECL_VTABLE(text_selector) = {.size = sizeof(text_selector_t),
|
||||
.type = WIDGET_TYPE_TEXT_SELECTOR,
|
||||
.clone_properties = s_text_selector_properties,
|
||||
.persistent_properties = s_text_selector_properties,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = text_selector_create,
|
||||
.on_paint_self = text_selector_on_paint_self,
|
||||
.on_layout_children = text_selector_on_layout_children,
|
||||
|
@ -377,7 +377,7 @@ TK_DECL_VTABLE(time_clock) = {.size = sizeof(time_clock_t),
|
||||
.type = WIDGET_TYPE_TIME_CLOCK,
|
||||
.clone_properties = s_time_clock_properties,
|
||||
.persistent_properties = s_time_clock_properties,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = time_clock_create,
|
||||
.on_paint_self = time_clock_on_paint_self,
|
||||
.set_prop = time_clock_set_prop,
|
||||
|
@ -105,7 +105,7 @@ TK_DECL_VTABLE(timer_widget) = {.size = sizeof(timer_widget_t),
|
||||
.type = WIDGET_TYPE_TIMER_WIDGET,
|
||||
.clone_properties = s_timer_widget_properties,
|
||||
.persistent_properties = s_timer_widget_properties,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = timer_widget_create,
|
||||
.on_paint_self = timer_widget_on_paint_self,
|
||||
.set_prop = timer_widget_set_prop,
|
||||
|
@ -272,7 +272,7 @@ TK_DECL_VTABLE(vpage) = {.size = sizeof(vpage_t),
|
||||
.type = WIDGET_TYPE_VPAGE,
|
||||
.clone_properties = s_vpage_properties,
|
||||
.persistent_properties = s_vpage_properties,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = vpage_create,
|
||||
.set_prop = vpage_set_prop,
|
||||
.get_prop = vpage_get_prop,
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
TK_DECL_VTABLE(app_bar) = {.size = sizeof(app_bar_t),
|
||||
.type = WIDGET_TYPE_APP_BAR,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = app_bar_create};
|
||||
|
||||
widget_t* app_bar_create(widget_t* parent, xy_t x, xy_t y, wh_t w, wh_t h) {
|
||||
|
@ -399,7 +399,7 @@ TK_DECL_VTABLE(button) = {.size = sizeof(button_t),
|
||||
.type = WIDGET_TYPE_BUTTON,
|
||||
.space_key_to_activate = TRUE,
|
||||
.return_key_to_activate = TRUE,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = button_create,
|
||||
.invalidate = button_invalidate,
|
||||
.clone_properties = s_button_properties,
|
||||
|
@ -28,7 +28,7 @@ static ret_t button_group_on_paint_self(widget_t* widget, canvas_t* c) {
|
||||
|
||||
TK_DECL_VTABLE(button_group) = {.size = sizeof(button_group_t),
|
||||
.type = WIDGET_TYPE_BUTTON_GROUP,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = button_group_create,
|
||||
.on_paint_self = button_group_on_paint_self};
|
||||
|
||||
|
@ -164,7 +164,7 @@ static ret_t calibration_win_on_paint_self(widget_t* widget, canvas_t* c) {
|
||||
TK_DECL_VTABLE(calibration_win) = {.size = sizeof(calibration_win_t),
|
||||
.type = WIDGET_TYPE_CALIBRATION_WIN,
|
||||
.is_window = TRUE,
|
||||
.parent = TK_PARENT_VTABLE(window_base),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(window_base),
|
||||
.create = calibration_win_create,
|
||||
.on_event = calibration_win_on_event,
|
||||
.set_prop = window_base_set_prop,
|
||||
|
@ -169,7 +169,7 @@ TK_DECL_VTABLE(check_button) = {
|
||||
.return_key_to_activate = TRUE,
|
||||
.clone_properties = s_check_button_properties,
|
||||
.persistent_properties = s_check_button_properties,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = check_button_create,
|
||||
.on_event = check_button_on_event,
|
||||
.on_paint_self = check_button_on_paint_self,
|
||||
@ -184,7 +184,7 @@ TK_DECL_VTABLE(radio_button) = {
|
||||
.space_key_to_activate = TRUE,
|
||||
.return_key_to_activate = TRUE,
|
||||
.clone_properties = s_check_button_properties,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = check_button_create_radio,
|
||||
.on_event = check_button_on_event,
|
||||
.on_paint_self = check_button_on_paint_self,
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
TK_DECL_VTABLE(clip_view) = {.size = sizeof(clip_view_t),
|
||||
.type = WIDGET_TYPE_CLIP_VIEW,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = clip_view_create,
|
||||
.on_paint_children = widget_on_paint_children_clip};
|
||||
|
||||
|
@ -167,7 +167,7 @@ static const char* const s_color_tile_properties[] = {WIDGET_PROP_BG_COLOR,
|
||||
WIDGET_PROP_BORDER_COLOR, NULL};
|
||||
TK_DECL_VTABLE(color_tile) = {.size = sizeof(color_tile_t),
|
||||
.type = WIDGET_TYPE_COLOR_TILE,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = color_tile_create,
|
||||
.clone_properties = s_color_tile_properties,
|
||||
.persistent_properties = s_color_tile_properties,
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
TK_DECL_VTABLE(column) = {.size = sizeof(column_t),
|
||||
.type = WIDGET_TYPE_COLUMN,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = column_create};
|
||||
|
||||
widget_t* column_create(widget_t* parent, xy_t x, xy_t y, wh_t w, wh_t h) {
|
||||
|
@ -499,7 +499,7 @@ TK_DECL_VTABLE(combo_box) = {.size = sizeof(combo_box_t),
|
||||
.return_key_to_activate = TRUE,
|
||||
.clone_properties = s_combo_box_properties,
|
||||
.persistent_properties = s_combo_box_properties,
|
||||
.parent = TK_PARENT_VTABLE(edit),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(edit),
|
||||
.create = combo_box_create_self,
|
||||
.on_paint_self = edit_on_paint_self,
|
||||
.set_prop = combo_box_set_prop,
|
||||
|
@ -108,7 +108,7 @@ TK_DECL_VTABLE(combo_box_item) = {.size = sizeof(combo_box_item_t),
|
||||
.on_event = combo_box_item_on_event,
|
||||
.get_prop = combo_box_item_get_prop,
|
||||
.set_prop = combo_box_item_set_prop,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = combo_box_item_create};
|
||||
|
||||
widget_t* combo_box_item_create(widget_t* parent, xy_t x, xy_t y, wh_t w, wh_t h) {
|
||||
|
@ -29,7 +29,7 @@ static ret_t dialog_client_on_paint_self(widget_t* widget, canvas_t* c) {
|
||||
|
||||
TK_DECL_VTABLE(dialog_client) = {.size = sizeof(dialog_client_t),
|
||||
.type = WIDGET_TYPE_DIALOG_CLIENT,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = dialog_client_create,
|
||||
.on_paint_self = dialog_client_on_paint_self};
|
||||
|
||||
|
@ -32,7 +32,7 @@ static ret_t dialog_title_on_paint_self(widget_t* widget, canvas_t* c) {
|
||||
|
||||
TK_DECL_VTABLE(dialog_title) = {.size = sizeof(dialog_title_t),
|
||||
.type = WIDGET_TYPE_DIALOG_TITLE,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = dialog_title_create,
|
||||
.on_paint_self = dialog_title_on_paint_self};
|
||||
|
||||
|
@ -131,7 +131,7 @@ TK_DECL_VTABLE(digit_clock) = {.size = sizeof(digit_clock_t),
|
||||
.type = WIDGET_TYPE_DIGIT_CLOCK,
|
||||
.clone_properties = s_digit_clock_properties,
|
||||
.persistent_properties = s_digit_clock_properties,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = digit_clock_create,
|
||||
.on_paint_self = widget_on_paint_self_default,
|
||||
.set_prop = digit_clock_set_prop,
|
||||
|
@ -169,7 +169,7 @@ static const char* const s_dragger_clone_properties[] = {
|
||||
TK_DECL_VTABLE(dragger) = {.size = sizeof(dragger_t),
|
||||
.type = WIDGET_TYPE_DRAGGER,
|
||||
.clone_properties = s_dragger_clone_properties,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = dragger_create,
|
||||
.set_prop = dragger_set_prop,
|
||||
.get_prop = dragger_get_prop,
|
||||
|
@ -1865,7 +1865,7 @@ TK_DECL_VTABLE(edit) = {.size = sizeof(edit_t),
|
||||
.pointer_cursor = WIDGET_CURSOR_EDIT,
|
||||
.clone_properties = s_edit_properties,
|
||||
.persistent_properties = s_edit_properties,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = edit_create,
|
||||
.on_re_translate = edit_on_re_translate,
|
||||
.on_paint_self = edit_on_paint_self,
|
||||
|
@ -413,7 +413,7 @@ TK_DECL_VTABLE(grid) = {.size = sizeof(grid_t),
|
||||
.type = WIDGET_TYPE_GRID,
|
||||
.clone_properties = s_grid_properties,
|
||||
.persistent_properties = s_grid_properties,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = grid_create,
|
||||
.on_paint_self = grid_on_paint_self,
|
||||
.set_prop = grid_set_prop,
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
TK_DECL_VTABLE(grid_item) = {.size = sizeof(grid_item_t),
|
||||
.type = WIDGET_TYPE_ROW,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = grid_item_create};
|
||||
|
||||
widget_t* grid_item_create(widget_t* parent, xy_t x, xy_t y, wh_t w, wh_t h) {
|
||||
|
@ -28,7 +28,7 @@ static ret_t group_box_on_paint_self(widget_t* widget, canvas_t* c) {
|
||||
|
||||
TK_DECL_VTABLE(group_box) = {.size = sizeof(group_box_t),
|
||||
.type = WIDGET_TYPE_GROUP_BOX,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = group_box_create,
|
||||
.on_paint_self = group_box_on_paint_self};
|
||||
|
||||
|
@ -125,7 +125,7 @@ TK_DECL_VTABLE(image) = {.size = sizeof(image_t),
|
||||
.return_key_to_activate = TRUE,
|
||||
.clone_properties = s_image_properties,
|
||||
.persistent_properties = s_image_properties,
|
||||
.parent = TK_PARENT_VTABLE(image_base),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(image_base),
|
||||
.create = image_create,
|
||||
.on_copy = image_on_copy,
|
||||
.on_destroy = image_base_on_destroy,
|
||||
@ -151,7 +151,7 @@ TK_DECL_VTABLE(icon) = {.size = sizeof(image_t),
|
||||
.return_key_to_activate = TRUE,
|
||||
.clone_properties = s_image_properties,
|
||||
.persistent_properties = s_image_properties,
|
||||
.parent = TK_PARENT_VTABLE(image_base),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(image_base),
|
||||
.create = image_create,
|
||||
.on_copy = image_on_copy,
|
||||
.on_destroy = image_base_on_destroy,
|
||||
|
@ -324,7 +324,7 @@ static const char* const s_label_properties[] = {WIDGET_PROP_LENGTH, WIDGET_PROP
|
||||
|
||||
TK_DECL_VTABLE(label) = {.size = sizeof(label_t),
|
||||
.type = WIDGET_TYPE_LABEL,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.clone_properties = s_label_properties,
|
||||
.persistent_properties = s_label_properties,
|
||||
.create = label_create,
|
||||
|
@ -83,7 +83,7 @@ static ret_t overlay_on_copy(widget_t* widget, widget_t* other) {
|
||||
TK_DECL_VTABLE(overlay) = {.type = WIDGET_TYPE_OVERLAY,
|
||||
.size = sizeof(overlay_t),
|
||||
.is_window = TRUE,
|
||||
.parent = TK_PARENT_VTABLE(window_base),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(window_base),
|
||||
.create = overlay_create,
|
||||
.clone_properties = s_overlay_properties,
|
||||
.on_copy = overlay_on_copy,
|
||||
|
@ -266,7 +266,7 @@ TK_DECL_VTABLE(pages) = {.size = sizeof(pages_t),
|
||||
.type = WIDGET_TYPE_PAGES,
|
||||
.get_only_active_children = pages_get_only_active_children,
|
||||
.clone_properties = s_pages_clone_properties,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = pages_create,
|
||||
.on_paint_self = widget_on_paint_null,
|
||||
.on_paint_children = widget_on_paint_children_clip,
|
||||
|
@ -169,7 +169,7 @@ TK_DECL_VTABLE(popup) = {.size = sizeof(popup_t),
|
||||
.is_window = TRUE,
|
||||
.clone_properties = s_popup_properties,
|
||||
.persistent_properties = s_popup_properties,
|
||||
.parent = TK_PARENT_VTABLE(window_base),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(window_base),
|
||||
.create = popup_create,
|
||||
.on_copy = popup_on_copy,
|
||||
.get_prop = popup_get_prop,
|
||||
|
@ -224,7 +224,7 @@ static const char* s_progress_bar_clone_properties[] = {WIDGET_PROP_VALUE, W
|
||||
TK_DECL_VTABLE(progress_bar) = {.size = sizeof(progress_bar_t),
|
||||
.type = WIDGET_TYPE_PROGRESS_BAR,
|
||||
.clone_properties = s_progress_bar_clone_properties,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = progress_bar_create,
|
||||
.on_paint_self = progress_bar_on_paint_self,
|
||||
.on_paint_background = widget_on_paint_null,
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
TK_DECL_VTABLE(row) = {.size = sizeof(row_t),
|
||||
.type = WIDGET_TYPE_ROW,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = row_create};
|
||||
|
||||
widget_t* row_create(widget_t* parent, xy_t x, xy_t y, wh_t w, wh_t h) {
|
||||
|
@ -712,7 +712,7 @@ TK_DECL_VTABLE(slider) = {.size = sizeof(slider_t),
|
||||
.inputable = TRUE,
|
||||
.clone_properties = s_slider_properties,
|
||||
.persistent_properties = s_slider_properties,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = slider_create,
|
||||
.on_event = slider_on_event,
|
||||
.on_paint_self = slider_on_paint_self,
|
||||
|
@ -128,7 +128,7 @@ TK_DECL_VTABLE(spin_box) = {.size = sizeof(spin_box_t),
|
||||
.pointer_cursor = WIDGET_CURSOR_EDIT,
|
||||
.clone_properties = s_spin_box_properties,
|
||||
.persistent_properties = s_spin_box_properties,
|
||||
.parent = TK_PARENT_VTABLE(edit),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(edit),
|
||||
.create = spin_box_create_self,
|
||||
.on_paint_self = edit_on_paint_self,
|
||||
.set_prop = spin_box_set_prop,
|
||||
|
@ -140,7 +140,7 @@ TK_DECL_VTABLE(system_bar) = {.size = sizeof(system_bar_t),
|
||||
.is_window = TRUE,
|
||||
.clone_properties = s_system_bar_properties,
|
||||
.persistent_properties = s_system_bar_properties,
|
||||
.parent = TK_PARENT_VTABLE(window_base),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(window_base),
|
||||
.create = system_bar_create,
|
||||
.on_copy = system_bar_on_copy,
|
||||
.on_event = system_bar_on_event,
|
||||
@ -165,7 +165,7 @@ TK_DECL_VTABLE(system_bar_bottom) = {.size = sizeof(system_bar_t),
|
||||
.is_window = TRUE,
|
||||
.clone_properties = s_system_bar_properties,
|
||||
.persistent_properties = s_system_bar_properties,
|
||||
.parent = TK_PARENT_VTABLE(window_base),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(window_base),
|
||||
.create = system_bar_create,
|
||||
.on_event = system_bar_on_event,
|
||||
.set_prop = window_base_set_prop,
|
||||
|
@ -301,7 +301,7 @@ TK_DECL_VTABLE(tab_button) = {.size = sizeof(tab_button_t),
|
||||
.space_key_to_activate = TRUE,
|
||||
.return_key_to_activate = TRUE,
|
||||
.clone_properties = s_tab_button_clone_properties,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = tab_button_create,
|
||||
.on_event = tab_button_on_event,
|
||||
.on_paint_self = tab_button_on_paint_self,
|
||||
|
@ -263,7 +263,7 @@ static ret_t tab_button_group_on_remove_child(widget_t* widget, widget_t* child)
|
||||
TK_DECL_VTABLE(tab_button_group) = {.size = sizeof(tab_button_group_t),
|
||||
.type = WIDGET_TYPE_TAB_BUTTON_GROUP,
|
||||
.scrollable = TRUE,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = tab_button_group_create,
|
||||
.set_prop = tab_button_group_set_prop,
|
||||
.get_prop = tab_button_group_get_prop,
|
||||
|
@ -28,7 +28,7 @@ static ret_t tab_control_on_paint_self(widget_t* widget, canvas_t* c) {
|
||||
|
||||
TK_DECL_VTABLE(tab_control) = {.size = sizeof(tab_control_t),
|
||||
.type = WIDGET_TYPE_TAB_CONTROL,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.create = tab_control_create,
|
||||
.on_paint_self = tab_control_on_paint_self};
|
||||
|
||||
|
@ -55,7 +55,7 @@ static ret_t view_on_destroy(widget_t* widget) {
|
||||
|
||||
TK_DECL_VTABLE(view) = {.size = sizeof(view_t),
|
||||
.type = WIDGET_TYPE_VIEW,
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.get_parent_vt = TK_GET_PARENT_VTABLE(widget),
|
||||
.set_prop = view_set_prop,
|
||||
.get_prop = view_get_prop,
|
||||
.on_destroy = view_on_destroy,
|
||||
|
@ -34,7 +34,7 @@ ret_t window_design_get_prop(widget_t* widget, const char* name, value_t* v) {
|
||||
TK_DECL_VTABLE(window_design) = {.type = WIDGET_TYPE_NORMAL_WINDOW,
|
||||
.size = sizeof(window_t),
|
||||
.is_window = TRUE,
|
||||
.parent = TK_PARENT_VTABLE(window_base),
|
||||
.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,
|
||||
|
@ -310,7 +310,6 @@ class IDLGen {
|
||||
let start = 0;
|
||||
let end = 0;
|
||||
let str = content;
|
||||
|
||||
do {
|
||||
start = str.indexOf('/**');
|
||||
if (start >= 0) {
|
||||
@ -340,6 +339,19 @@ class IDLGen {
|
||||
|
||||
} while (start >= 0 && end >= 0)
|
||||
|
||||
// 特殊处理导出控件的虚表函数
|
||||
let name_list = filename.split('/')
|
||||
let clase_name = name_list[name_list.length - 1].replace('.h', '');
|
||||
start = content.indexOf('TK_EXTERN_VTABLE(' + clase_name + ')');
|
||||
if (start >= 0) {
|
||||
let comment = '/** \n';
|
||||
comment += ' * @method ' + clase_name + '_get_widget_vtable \n'
|
||||
comment += ' * 获取 ' + clase_name + ' 虚表。 \n'
|
||||
comment += ' * \n'
|
||||
comment += ' * @return {const widget_vtable_t*} 成功返回 ' + clase_name + ' 虚表。 \n'
|
||||
comment += ' */ \n'
|
||||
this.parseMethod(comment);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user