1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

Merge pull request #586 from embeddedt/win_drag

Add `lv_win_set_drag` and `lv_win_get_drag`
This commit is contained in:
embeddedt 2018-11-26 07:18:41 -05:00 committed by GitHub
commit 097a0c4a90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 0 deletions

View File

@ -299,6 +299,18 @@ void lv_win_set_style(lv_obj_t * win, lv_win_style_t type, lv_style_t * style)
}
}
/**
* Set drag status of a window. If set to 'true' window can be dragged like on a PC.
* @param win pointer to a window object
* @param drag_en whether dragging is enabled
*/
void lv_win_set_drag(lv_obj_t *win, bool drag_en)
{
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
lv_obj_t * win_header = ext->header;
lv_obj_set_drag_parent(win_header, drag_en);
lv_obj_set_drag(win, drag_en);
}
/*=====================
* Getter functions

View File

@ -157,6 +157,12 @@ void lv_win_set_sb_mode(lv_obj_t *win, lv_sb_mode_t sb_mode);
*/
void lv_win_set_style(lv_obj_t *win, lv_win_style_t type, lv_style_t *style);
/**
* Set drag status of a window. If set to 'true' window can be dragged like on a PC.
* @param win pointer to a window object
* @param drag_en whether dragging is enabled
*/
void lv_win_set_drag(lv_obj_t *win, bool drag_en);
/*=====================
* Getter functions
@ -220,6 +226,16 @@ lv_coord_t lv_win_get_width(lv_obj_t * win);
*/
lv_style_t * lv_win_get_style(const lv_obj_t *win, lv_win_style_t type);
/**
* Get drag status of a window. If set to 'true' window can be dragged like on a PC.
* @param win pointer to a window object
* @return whether window is draggable
*/
static inline bool lv_win_get_drag(const lv_obj_t *win)
{
return lv_obj_get_drag(win);
}
/*=====================
* Other functions
*====================*/