mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-12-02 03:58:33 +08:00
improve cast function
This commit is contained in:
parent
ab1bc536c1
commit
a0dcadb3cc
@ -159,7 +159,7 @@ widget_t* window_base_create(widget_t* parent, const widget_vtable_t* vt, xy_t x
|
||||
*/
|
||||
widget_t* window_base_cast(widget_t* widget);
|
||||
|
||||
#define WINDOW_BASE(widget) ((window_base_t*)(window_base_cast(widget)))
|
||||
#define WINDOW_BASE(widget) ((window_base_t*)(window_base_cast(WIDGET(widget))))
|
||||
|
||||
/*public for subclass and runtime type check*/
|
||||
TK_EXTERN_VTABLE(window_base);
|
||||
|
@ -159,7 +159,7 @@ ret_t button_set_repeat(widget_t* widget, int32_t repeat);
|
||||
*/
|
||||
ret_t button_set_enable_long_press(widget_t* widget, bool_t enable_long_press);
|
||||
|
||||
#define BUTTON(widget) ((button_t*)(button_cast(widget)))
|
||||
#define BUTTON(widget) ((button_t*)(button_cast(WIDGET(widget))))
|
||||
|
||||
/*public for subclass and runtime type check*/
|
||||
TK_EXTERN_VTABLE(button);
|
||||
|
@ -85,7 +85,7 @@ widget_t* button_group_create(widget_t* parent, xy_t x, xy_t y, wh_t w, wh_t h);
|
||||
*/
|
||||
widget_t* button_group_cast(widget_t* widget);
|
||||
|
||||
#define BUTTON_GROUP(widget) ((button_group_t*)(button_group_cast(widget)))
|
||||
#define BUTTON_GROUP(widget) ((button_group_t*)(button_group_cast(WIDGET(widget))))
|
||||
|
||||
/*public for subclass and runtime type check*/
|
||||
TK_EXTERN_VTABLE(button_group);
|
||||
|
@ -127,7 +127,7 @@ ret_t calibration_win_set_on_click(widget_t* widget, calibration_win_on_click_t
|
||||
*/
|
||||
widget_t* calibration_win_cast(widget_t* widget);
|
||||
|
||||
#define CALIBRATION_WIN(widget) ((calibration_win_t*)(calibration_win_cast(widget)))
|
||||
#define CALIBRATION_WIN(widget) ((calibration_win_t*)(calibration_win_cast(WIDGET(widget))))
|
||||
|
||||
/*public for subclass and runtime type check*/
|
||||
TK_EXTERN_VTABLE(calibration_win);
|
||||
|
@ -160,7 +160,7 @@ ret_t check_button_set_value(widget_t* widget, bool_t value);
|
||||
*/
|
||||
widget_t* check_button_cast(widget_t* widget);
|
||||
|
||||
#define CHECK_BUTTON(widget) ((check_button_t*)(check_button_cast(widget)))
|
||||
#define CHECK_BUTTON(widget) ((check_button_t*)(check_button_cast(WIDGET(widget))))
|
||||
|
||||
/*public for subclass and runtime type check*/
|
||||
TK_EXTERN_VTABLE(check_button);
|
||||
|
@ -132,7 +132,7 @@ ret_t color_tile_set_border_color(widget_t* widget, const char* color);
|
||||
*/
|
||||
ret_t color_tile_set_value(widget_t* widget, color_t color);
|
||||
|
||||
#define COLOR_TILE(widget) ((color_tile_t*)(color_tile_cast(widget)))
|
||||
#define COLOR_TILE(widget) ((color_tile_t*)(color_tile_cast(WIDGET(widget))))
|
||||
|
||||
/*public for subclass and runtime type check*/
|
||||
TK_EXTERN_VTABLE(color_tile);
|
||||
|
@ -85,7 +85,7 @@ widget_t* column_create(widget_t* parent, xy_t x, xy_t y, wh_t w, wh_t h);
|
||||
*/
|
||||
widget_t* column_cast(widget_t* widget);
|
||||
|
||||
#define COLUMN(widget) ((column_t*)(column_cast(widget)))
|
||||
#define COLUMN(widget) ((column_t*)(column_cast(WIDGET(widget))))
|
||||
|
||||
/*public for subclass and runtime type check*/
|
||||
TK_EXTERN_VTABLE(column);
|
||||
|
@ -285,7 +285,7 @@ int32_t combo_box_get_value(widget_t* widget);
|
||||
*/
|
||||
const char* combo_box_get_text(widget_t* widget);
|
||||
|
||||
#define COMBO_BOX(widget) ((combo_box_t*)(combo_box_cast(widget)))
|
||||
#define COMBO_BOX(widget) ((combo_box_t*)(combo_box_cast(WIDGET(widget))))
|
||||
|
||||
/*public for subclass and runtime type check*/
|
||||
TK_EXTERN_VTABLE(combo_box);
|
||||
|
@ -111,7 +111,7 @@ ret_t combo_box_item_set_checked(widget_t* widget, bool_t checked);
|
||||
*/
|
||||
ret_t combo_box_item_set_value(widget_t* widget, int32_t value);
|
||||
|
||||
#define COMBO_BOX_ITEM(widget) ((combo_box_item_t*)(combo_box_item_cast(widget)))
|
||||
#define COMBO_BOX_ITEM(widget) ((combo_box_item_t*)(combo_box_item_cast(WIDGET(widget))))
|
||||
|
||||
/*public for subclass and runtime type check*/
|
||||
TK_EXTERN_VTABLE(combo_box_item);
|
||||
|
@ -242,7 +242,7 @@ uint32_t dialog_modal(widget_t* widget);
|
||||
*/
|
||||
ret_t dialog_quit(widget_t* widget, uint32_t code);
|
||||
|
||||
#define DIALOG(widget) ((dialog_t*)(dialog_cast(widget)))
|
||||
#define DIALOG(widget) ((dialog_t*)(dialog_cast(WIDGET(widget))))
|
||||
|
||||
/*public for subclass and runtime type check*/
|
||||
TK_EXTERN_VTABLE(dialog);
|
||||
|
@ -82,7 +82,7 @@ widget_t* dialog_client_create(widget_t* parent, xy_t x, xy_t y, wh_t w, wh_t h)
|
||||
*/
|
||||
widget_t* dialog_client_cast(widget_t* widget);
|
||||
|
||||
#define DIALOG_CLIENT(widget) ((dialog_client_t*)(dialog_client_cast(widget)))
|
||||
#define DIALOG_CLIENT(widget) ((dialog_client_t*)(dialog_client_cast(WIDGET(widget))))
|
||||
|
||||
/*public for subclass and runtime type check*/
|
||||
TK_EXTERN_VTABLE(dialog_client);
|
||||
|
@ -82,7 +82,7 @@ widget_t* dialog_title_create(widget_t* parent, xy_t x, xy_t y, wh_t w, wh_t h);
|
||||
*/
|
||||
widget_t* dialog_title_cast(widget_t* widget);
|
||||
|
||||
#define DIALOG_TITLE(widget) ((dialog_title_t*)(dialog_title_cast(widget)))
|
||||
#define DIALOG_TITLE(widget) ((dialog_title_t*)(dialog_title_cast(WIDGET(widget))))
|
||||
|
||||
/*public for subclass and runtime type check*/
|
||||
TK_EXTERN_VTABLE(dialog_title);
|
||||
|
@ -108,7 +108,7 @@ widget_t* dragger_cast(widget_t* widget);
|
||||
*/
|
||||
ret_t dragger_set_range(widget_t* widget, xy_t x_min, xy_t y_min, xy_t x_max, xy_t y_max);
|
||||
|
||||
#define DRAGGER(widget) ((dragger_t*)(dragger_cast(widget)))
|
||||
#define DRAGGER(widget) ((dragger_t*)(dragger_cast(WIDGET(widget))))
|
||||
|
||||
/*public for subclass and runtime type check*/
|
||||
TK_EXTERN_VTABLE(dragger);
|
||||
|
@ -373,7 +373,7 @@ ret_t edit_set_input_tips(widget_t* widget, const char* tips);
|
||||
*/
|
||||
ret_t edit_set_password_visible(widget_t* widget, bool_t password_visible);
|
||||
|
||||
#define EDIT(widget) ((edit_t*)(edit_cast(widget)))
|
||||
#define EDIT(widget) ((edit_t*)(edit_cast(WIDGET(widget))))
|
||||
|
||||
/*public for subclass and runtime type check*/
|
||||
TK_EXTERN_VTABLE(edit);
|
||||
|
@ -86,7 +86,7 @@ widget_t* grid_create(widget_t* parent, xy_t x, xy_t y, wh_t w, wh_t h);
|
||||
*/
|
||||
widget_t* grid_cast(widget_t* widget);
|
||||
|
||||
#define GRID(widget) ((grid_t*)(grid_cast(widget)))
|
||||
#define GRID(widget) ((grid_t*)(grid_cast(WIDGET(widget))))
|
||||
|
||||
/*public for subclass and runtime type check*/
|
||||
TK_EXTERN_VTABLE(grid);
|
||||
|
@ -92,7 +92,7 @@ widget_t* grid_item_create(widget_t* parent, xy_t x, xy_t y, wh_t w, wh_t h);
|
||||
*/
|
||||
widget_t* grid_item_cast(widget_t* widget);
|
||||
|
||||
#define GRID_ITEM(widget) ((grid_item_t*)(grid_item_cast(widget)))
|
||||
#define GRID_ITEM(widget) ((grid_item_t*)(grid_item_cast(WIDGET(widget))))
|
||||
|
||||
/*public for subclass and runtime type check*/
|
||||
TK_EXTERN_VTABLE(grid_item);
|
||||
|
@ -86,7 +86,7 @@ widget_t* group_box_create(widget_t* parent, xy_t x, xy_t y, wh_t w, wh_t h);
|
||||
*/
|
||||
widget_t* group_box_cast(widget_t* widget);
|
||||
|
||||
#define GROUP_BOX(widget) ((group_box_t*)(group_box_cast(widget)))
|
||||
#define GROUP_BOX(widget) ((group_box_t*)(group_box_cast(WIDGET(widget))))
|
||||
|
||||
/*public for subclass and runtime type check*/
|
||||
TK_EXTERN_VTABLE(group_box);
|
||||
|
@ -120,7 +120,7 @@ ret_t label_set_length(widget_t* widget, int32_t length);
|
||||
*/
|
||||
widget_t* label_cast(widget_t* widget);
|
||||
|
||||
#define LABEL(widget) ((label_t*)(label_cast(widget)))
|
||||
#define LABEL(widget) ((label_t*)(label_cast(WIDGET(widget))))
|
||||
|
||||
/*public for subclass and runtime type check*/
|
||||
TK_EXTERN_VTABLE(label);
|
||||
|
@ -106,7 +106,7 @@ widget_t* spin_box_create(widget_t* parent, xy_t x, xy_t y, wh_t w, wh_t h);
|
||||
*/
|
||||
widget_t* spin_box_cast(widget_t* widget);
|
||||
|
||||
#define SPIN_BOX(widget) ((spin_box_t*)(spin_box_cast(widget)))
|
||||
#define SPIN_BOX(widget) ((spin_box_t*)(spin_box_cast(WIDGET(widget))))
|
||||
|
||||
/*public for subclass and runtime type check*/
|
||||
TK_EXTERN_VTABLE(spin_box);
|
||||
|
@ -129,7 +129,7 @@ ret_t window_close(widget_t* widget);
|
||||
*/
|
||||
widget_t* window_cast(widget_t* widget);
|
||||
|
||||
#define WINDOW(widget) ((window_t*)(window_cast(widget)))
|
||||
#define WINDOW(widget) ((window_t*)(window_cast(WIDGET(widget))))
|
||||
|
||||
/*public for subclass and runtime type check*/
|
||||
TK_EXTERN_VTABLE(window);
|
||||
|
Loading…
Reference in New Issue
Block a user