aboutsummaryrefslogtreecommitdiffstats
path: root/include/gwin/gwin.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/gwin/gwin.h')
-rw-r--r--include/gwin/gwin.h69
1 files changed, 68 insertions, 1 deletions
diff --git a/include/gwin/gwin.h b/include/gwin/gwin.h
index f97919e5..8385fe92 100644
--- a/include/gwin/gwin.h
+++ b/include/gwin/gwin.h
@@ -27,6 +27,9 @@
#if GFX_USE_GWIN || defined(__DOXYGEN__)
+/* Forward declaration */
+typedef struct GWindowObject *GHandle;
+
/**
* @brief A window object structure
* @note Do not access the members directly. Treat it as a black-box and use the method functions.
@@ -39,13 +42,18 @@ typedef struct GWindowObject {
#endif
const struct gwinVMT *vmt; // @< The VMT for this GWIN
GDisplay * display; // @< The display this window is on.
- coord_t x, y; // @< Screen relative position
+ coord_t x, y; // @< Position relative to parent
coord_t width, height; // @< Dimensions of this window
color_t color, bgcolor; // @< The current drawing colors
uint32_t flags; // @< Window flags (the meaning is private to the GWIN class)
#if GDISP_NEED_TEXT
font_t font; // @< The current font
#endif
+ #if GWIN_NEED_HIERARCHY
+ GHandle parent; // @< The parent widget
+ GHandle sibling; // @< The widget to its left (add right later as well)
+ GHandle child; // @< The child widget
+ #endif
} GWindowObject, * GHandle;
/* @} */
@@ -395,6 +403,65 @@ extern "C" {
*/
void gwinRedraw(GHandle gh);
+ #if GWIN_NEED_HIERARCHY
+ /**
+ * @brief Add a child widget to a parent one
+ *
+ * @param[in] parent The parent window (does not need to be parent yet)
+ * @param[in] child The child window
+ * @param[in] last Should the child window be added to the front or the back of the list?
+ *
+ * @api
+ */
+ void gwinAddChild(GHandle parent, GHandle child, bool_t last);
+
+ /**
+ * @brief Remove a child from a parent
+ *
+ * @note Other children of the same parent stay
+ * @note Children of the child are lost, they have to be reassigned manually if necessary.
+ *
+ * @param[in] child The child window
+ *
+ * @api
+ */
+ void gwinRemoveChild(GHandle child);
+
+ /**
+ * @brief Redraw only the children of a parent but not the parent itself
+ *
+ * @details This routine does exactly the same as @p gwinRedraw() but does not
+ * issue a redraw of the passed widget but only of it's children.
+ *
+ * @param[in] gh The widget
+ *
+ * @api
+ */
+ void gwinRedrawChildren(GHandle gh);
+
+ /**
+ * @brief Get first child of a widget
+ *
+ * @return The first child or NULL if the widget has no children
+ *
+ * @param[in] gh The parent widget
+ *
+ * @api
+ */
+ GHandle gwinGetFirstChild(GHandle gh);
+
+ /**
+ * @brief Get the next child of a widget
+ *
+ * @return The next child or NULL if no more childs
+ *
+ * @param[in] gh The parent widget
+ *
+ * @api
+ */
+ GHandle gwinGetNextChild(GHandle gh);
+ #endif
+
#if GWIN_NEED_WINDOWMANAGER || defined (__DOXYGEN__)
/**
* @brief Redraw a window