mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-12-02 12:08:16 +08:00
refactoring window properties
This commit is contained in:
parent
ce63130489
commit
25ccae48e6
@ -43,13 +43,7 @@ static ret_t dialog_on_add_child(widget_t* widget, widget_t* child) {
|
||||
return RET_CONTINUE;
|
||||
}
|
||||
|
||||
static const char* const s_dialog_properties[] = {WIDGET_PROP_ANIM_HINT,
|
||||
WIDGET_PROP_OPEN_ANIM_HINT,
|
||||
WIDGET_PROP_MOVE_FOCUS_PREV_KEY,
|
||||
WIDGET_PROP_MOVE_FOCUS_NEXT_KEY,
|
||||
WIDGET_PROP_CLOSE_ANIM_HINT,
|
||||
WIDGET_PROP_THEME,
|
||||
NULL};
|
||||
static const char* const s_dialog_properties[] = {NULL};
|
||||
|
||||
static ret_t dialog_set_prop(widget_t* widget, const char* name, const value_t* v) {
|
||||
dialog_t* dialog = DIALOG(widget);
|
||||
|
@ -25,14 +25,7 @@
|
||||
#include "base/window.h"
|
||||
#include "base/window_manager.h"
|
||||
|
||||
static const char* s_window_properties[] = {WIDGET_PROP_ANIM_HINT,
|
||||
WIDGET_PROP_OPEN_ANIM_HINT,
|
||||
WIDGET_PROP_FULLSCREEN,
|
||||
WIDGET_PROP_CLOSE_ANIM_HINT,
|
||||
WIDGET_PROP_MOVE_FOCUS_PREV_KEY,
|
||||
WIDGET_PROP_MOVE_FOCUS_NEXT_KEY,
|
||||
WIDGET_PROP_THEME,
|
||||
NULL};
|
||||
static const char* s_window_properties[] = {WIDGET_PROP_FULLSCREEN, NULL};
|
||||
|
||||
static ret_t window_set_prop(widget_t* widget, const char* name, const value_t* v) {
|
||||
if (tk_str_eq(name, WIDGET_PROP_FULLSCREEN)) {
|
||||
|
@ -503,7 +503,34 @@ ret_t window_close(widget_t* widget) {
|
||||
return window_manager_close_window(widget->parent, widget);
|
||||
}
|
||||
|
||||
TK_DECL_VTABLE(window_base) = {.size = sizeof(window_base_t), .parent = TK_PARENT_VTABLE(widget)};
|
||||
static const char* s_window_base_properties[] = {WIDGET_PROP_ANIM_HINT,
|
||||
WIDGET_PROP_OPEN_ANIM_HINT,
|
||||
WIDGET_PROP_DISABLE_ANIM,
|
||||
WIDGET_PROP_NATIVE_WINDOW,
|
||||
WIDGET_PROP_CLOSE_ANIM_HINT,
|
||||
WIDGET_PROP_THEME,
|
||||
WIDGET_PROP_MOVE_FOCUS_PREV_KEY,
|
||||
WIDGET_PROP_MOVE_FOCUS_NEXT_KEY,
|
||||
WIDGET_PROP_MOVE_FOCUS_UP_KEY,
|
||||
WIDGET_PROP_MOVE_FOCUS_DOWN_KEY,
|
||||
WIDGET_PROP_MOVE_FOCUS_LEFT_KEY,
|
||||
WIDGET_PROP_MOVE_FOCUS_RIGHT_KEY,
|
||||
WIDGET_PROP_SINGLE_INSTANCE,
|
||||
WIDGET_PROP_DESIGN_W,
|
||||
WIDGET_PROP_DESIGN_H,
|
||||
WIDGET_PROP_AUTO_SCALE_CHILDREN_X,
|
||||
WIDGET_PROP_AUTO_SCALE_CHILDREN_Y,
|
||||
WIDGET_PROP_AUTO_SCALE_CHILDREN_W,
|
||||
WIDGET_PROP_AUTO_SCALE_CHILDREN_H,
|
||||
WIDGET_PROP_CLOSABLE,
|
||||
NULL};
|
||||
|
||||
TK_DECL_VTABLE(window_base) = {
|
||||
.size = sizeof(window_base_t),
|
||||
.parent = TK_PARENT_VTABLE(widget),
|
||||
.clone_properties = s_window_base_properties,
|
||||
.persistent_properties = s_window_base_properties,
|
||||
};
|
||||
|
||||
widget_t* window_base_cast(widget_t* widget) {
|
||||
return_value_if_fail(WIDGET_IS_INSTANCE_OF(widget, window_base), NULL);
|
||||
|
@ -72,9 +72,8 @@ static bool_t overlay_is_point_in(widget_t* widget, xy_t x, xy_t y) {
|
||||
}
|
||||
}
|
||||
|
||||
static const char* const s_overlay_properties[] = {
|
||||
WIDGET_PROP_MOVE_FOCUS_PREV_KEY, WIDGET_PROP_MOVE_FOCUS_NEXT_KEY, WIDGET_PROP_THEME,
|
||||
WIDGET_PROP_CLICK_THROUGH, WIDGET_PROP_ALWAYS_ON_TOP, NULL};
|
||||
static const char* const s_overlay_properties[] = {WIDGET_PROP_CLICK_THROUGH,
|
||||
WIDGET_PROP_ALWAYS_ON_TOP, NULL};
|
||||
|
||||
TK_DECL_VTABLE(overlay) = {.type = WIDGET_TYPE_OVERLAY,
|
||||
.size = sizeof(overlay_t),
|
||||
|
@ -168,15 +168,9 @@ static ret_t popup_on_event(widget_t* widget, event_t* e) {
|
||||
return window_base_on_event(widget, e);
|
||||
}
|
||||
|
||||
static const char* const s_popup_properties[] = {WIDGET_PROP_ANIM_HINT,
|
||||
WIDGET_PROP_OPEN_ANIM_HINT,
|
||||
WIDGET_PROP_CLOSE_ANIM_HINT,
|
||||
WIDGET_PROP_THEME,
|
||||
WIDGET_PROP_CLOSE_WHEN_CLICK,
|
||||
static const char* const s_popup_properties[] = {WIDGET_PROP_CLOSE_WHEN_CLICK,
|
||||
WIDGET_PROP_CLOSE_WHEN_CLICK_OUTSIDE,
|
||||
WIDGET_PROP_MOVE_FOCUS_PREV_KEY,
|
||||
WIDGET_PROP_MOVE_FOCUS_NEXT_KEY,
|
||||
NULL};
|
||||
WIDGET_PROP_CLOSE_WHEN_TIMEOUT, NULL};
|
||||
|
||||
TK_DECL_VTABLE(popup) = {.size = sizeof(popup_t),
|
||||
.type = WIDGET_TYPE_POPUP,
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "widgets/system_bar.h"
|
||||
#include "base/window_manager.h"
|
||||
|
||||
static const char* s_system_bar_properties[] = {WIDGET_PROP_THEME, NULL};
|
||||
static const char* s_system_bar_properties[] = {NULL};
|
||||
|
||||
static ret_t system_bar_on_request_close_window(void* ctx, event_t* e) {
|
||||
widget_t* widget = WIDGET(ctx);
|
||||
|
Loading…
Reference in New Issue
Block a user