µGFX  2.9
version 2.9
gwin_container.h
Go to the documentation of this file.
1 /*
2  * This file is subject to the terms of the GFX License. If a copy of
3  * the license was not distributed with this file, you can obtain one at:
4  *
5  * http://ugfx.io/license.html
6  */
7 
8 /**
9  * @file src/gwin/gwin_container.h
10  *
11  * @defgroup Container Container
12  * @ingroup Containers
13  *
14  * @brief Basic container.
15  *
16  * @details A Container is a GWindow that supports child windows. It is also
17  * a widget in its own right and therefore can accept user input directly.
18  *
19  * @pre GFX_USE_GWIN and GWIN_NEED_CONTAINERS must be set to GFXON in your gfxconf.h
20  * @{
21  */
22 
23 #ifndef _GCONTAINER_H
24 #define _GCONTAINER_H
25 
26 /* This file is included within "src/gwin/gwin.h" */
27 
28 /**
29  * @brief The GWIN Container structure
30  * @note A container is a GWIN widget that can have children.
31  * @note Do not access the members directly. Treat it as a black-box and use the method functions.
32  *
33  * @{
34  */
36 /** @} */
37 
38 /**
39  * A comment/rant on the above structure:
40  * We would really like the GWidgetObject member to be anonymous. While this is
41  * allowed under the C11, C99, GNU and various other standards which have been
42  * around forever - compiler support often requires special flags e.g
43  * gcc requires the -fms-extensions flag (no wonder the language and compilers have
44  * not really progressed in 30 years). As portability is a key requirement
45  * we unfortunately won't use this useful feature in case we get a compiler that
46  * won't support it even with special flags.
47  */
48 
49 /**
50  * @brief Get the first child window
51  *
52  * @return The first child or NULL if are no children windows
53  *
54  * @param[in] gh The parent container or NULL to get the first top level window
55  *
56  * @api
57  */
59 
60 /**
61  * @brief Get the next child window in the z-order
62  *
63  * @return The next window or NULL if no more children
64  *
65  * @param[in] gh The window to obtain the next sibling of.
66  *
67  * @note This returns the next window under the current parent window.
68  * Unlike @p gwinGetNextWindow() it will only return windows that
69  * have the same parent as the supplied window.
70  *
71  * @api
72  */
74 
75 /**
76  * @brief Get the inner width of a container window
77  *
78  * @return The inner width of a container window or zero if this is not a container
79  *
80  * @param[in] gh The window
81  *
82  * @api
83  */
85 
86 /**
87  * @brief Get the inner height of a container window
88  *
89  * @return The inner height of a container window or zero if this is not a container
90  *
91  * @param[in] gh The window
92  *
93  * @api
94  */
96 
97 
98 /**
99  * @brief Flags for gwinContainerCreate()
100  * @{
101  */
102 #define GWIN_CONTAINER_BORDER 0x00000001
103 /** @} */
104 
105 /**
106  * @brief Create a simple container.
107  * @return NULL if there is no resultant drawing area, otherwise a window handle.
108  *
109  * @param[in] g The GDisplay to display this window on
110  * @param[in] gw The GContainerObject structure to initialise. If this is NULL the structure is dynamically allocated.
111  * @param[in] pInit The initialisation parameters
112  * @param[in] flags Some flags, see notes
113  *
114  * @api
115  */
116 GHandle gwinGContainerCreate(GDisplay *g, GContainerObject *gw, const GWidgetInit *pInit, gU32 flags);
117 #define gwinContainerCreate(gc, pInit, flags) gwinGContainerCreate(GDISP, gc, pInit, flags)
118 
119 
120 /**
121  * @defgroup Renderings_Container Renderings
122  *
123  * @brief Built-in rendering functions for the container widget.
124  *
125  * @details These function may be passed to @p gwinSetCustomDraw() to get different container drawing styles.
126  *
127  * @note In your custom container drawing function you may optionally call these
128  * standard functions and then draw your extra details on top.
129  * @note These custom drawing routines don't have to worry about setting clipping as the framework
130  * sets clipping to the object window prior to calling these routines.
131  *
132  * @{
133  */
134 
135 /**
136  * @brief The default rendering function for the container widget.
137  *
138  * @details Fills the client area with the background color.
139  *
140  * @param[in] gw The widget object (must be a container object).
141  * @param[in] param A parameter passed in from the user. Ignored by this function.
142  *
143  * @api
144  */
145 void gwinContainerDraw_Std(GWidgetObject *gw, void *param);
146 
147 /**
148  * @brief Renders the container but leaves the client area transparent.
149  *
150  * @details Will not fill the client area at all.
151  *
152  * @param[in] gw The widget object (must be a container object).
153  * @param[in] param A parameter passed in from the user. Ignored by this function.
154  *
155  * @api
156  */
158 
159 #if GDISP_NEED_IMAGE || defined(__DOXYGEN__)
160  /**
161  * @brief Renders the container and uses the specified image for the client area.
162  *
163  * @details The image will be tiled throghout the client area. Therefore, to archive the best looking result the
164  * supplied image needs to be of the same size as the client area size of the container widget (inner size).
165  *
166  * @param[in] gw The widget object (must be a container object).
167  * @param[in] param A parameter passed in from the user. Must be an image handle. See note below.
168  *
169  * @note The image must be already opened before calling @p gwinSetCustomDraw(). The handle is passed as the parameter
170  * to this function.
171  *
172  * @pre GDISP_NEED_IMAGE must be set to GFXON
173  *
174  * @api
175  */
176  void gwinContainerDraw_Image(GWidgetObject *gw, void *param);
177 #endif /* GDISP_NEED_IMAGE */
178 
179 /** @} */
180 
181 /* Include extra container types */
182 #if GWIN_NEED_FRAME || defined(__DOXYGEN__)
183  #include "gwin_frame.h"
184 #endif
185 #if GWIN_NEED_TABSET || defined(__DOXYGEN__)
186  #include "gwin_tabset.h"
187 #endif
188 
189 #endif /* _GCONTAINER_H */
190 /** @} */
GHandle gwinGContainerCreate(GDisplay *g, GContainerObject *gw, const GWidgetInit *pInit, gU32 flags)
Create a simple container.
gCoord gwinGetInnerHeight(GHandle gh)
Get the inner height of a container window.
GWidgetObject GContainerObject
The GWIN Container structure.
GHandle gwinGetFirstChild(GHandle gh)
Get the first child window.
GHandle gwinGetSibling(GHandle gh)
Get the next child window in the z-order.
gCoord gwinGetInnerWidth(GHandle gh)
Get the inner width of a container window.
gI16 gCoord
The type for a coordinate or length on the screen.
Definition: gdisp.h:39
void gwinContainerDraw_Transparent(GWidgetObject *gw, void *param)
Renders the container but leaves the client area transparent.
void gwinContainerDraw_Image(GWidgetObject *gw, void *param)
Renders the container and uses the specified image for the client area.
void gwinContainerDraw_Std(GWidgetObject *gw, void *param)
The default rendering function for the container widget.
GWIN Graphic window subsystem header file.
GWIN Graphic window subsystem header file.
The structure to initialise a widget.
Definition: gwin_widget.h:97
The GWIN Widget structure.
Definition: gwin_widget.h:118
A window object structure.
Definition: gwin.h:40