Mercurial > molko
diff libui/ui/frame.h @ 152:1008a796a9e7
ui: make UI widgets usable as actions
While here add a example-ui program with move support.
author | David Demelier <markand@malikania.fr> |
---|---|
date | Thu, 15 Oct 2020 18:09:45 +0200 |
parents | b19d076856d2 |
children | 6992085d47fd |
line wrap: on
line diff
--- a/libui/ui/frame.h Thu Oct 15 14:01:24 2020 +0200 +++ b/libui/ui/frame.h Thu Oct 15 18:09:45 2020 +0200 @@ -22,8 +22,10 @@ /** * \file frame.h * \brief GUI frame. + * \ingroup ui */ +struct action; struct theme; /** @@ -66,4 +68,23 @@ void frame_draw(const struct frame *frame); +/** + * Convert the frame into an action. + * + * The following field will be set into the action: + * + * - act->data: points to frame (reference), + * - act->draw: a wrapper to checkbox_draw. + * + * The frame being an UI element is considered to never completes, as such + * you will need to handle this case or to use a custom update function. + * + * \pre frame != NULL + * \pre act != NULL + * \param frame the frame to reference + * \param act the action to fill + */ +void +frame_action(struct frame *frame, struct action *act); + #endif /* !MOLKO_FRAME_H */