µGFX  2.9
version 2.9
gwin_frame.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_frame.h
10  * @brief GWIN Graphic window subsystem header file.
11  *
12  * @defgroup Frame Frame
13  * @ingroup Containers
14  *
15  * @brief Container with window decoration.
16  *
17  * @details A frame is a rectangular window that can have optional border as well as buttons to
18  * close, maximize and minimize it. The main purpose of this widget is to contain children.
19  *
20  * @pre GFX_USE_GWIN must be set to GFXON in your gfxconf.h
21  * @pre GWIN_NEED_FRAME must be set to GFXON in your gfxconf.h
22  * @{
23  */
24 
25 #ifndef _GWIN_FRAME_H
26 #define _GWIN_FRAME_H
27 
28 /* This file is included from src/gwin/gwin_container.h */
29 
30 /**
31  * @brief Flags for gwinFrameCreate()
32  * @{
33  */
34 #define GWIN_FRAME_BORDER 0x00000000 /**< Deprecated. A border is always shown with a frame window now. */
35 #define GWIN_FRAME_CLOSE_BTN 0x00000001 /**< Should a close button be shown? */
36 #define GWIN_FRAME_MINMAX_BTN 0x00000002 /**< Should minimize and maximize buttons be shown? */
37 #define GWIN_FRAME_KEEPONCLOSE 0x00000004 /**< Don't automatically destroy the frame on close */
38 /** @} */
39 
40 /**
41  * @brief The internal frame flags
42  * @note Used only for writing a custom draw routine.
43  * @{
44  */
45 #define GWIN_FRAME_CLOSE_PRESSED 0x00000008
46 #define GWIN_FRAME_MIN_PRESSED 0x00000010
47 #define GWIN_FRAME_MAX_PRESSED 0x00000020
48 #define GWIN_FRAME_REDRAW_FRAME 0x00000040 // Only redraw the frame
49 /** @} */
50 
52 
53 /**
54  * @brief Create a frame widget
55  *
56  * @details This widget provides a window like we know it from desktop systems.
57  *
58  * @param[in] g The GDisplay to display this window on
59  * @param[in] fo The GFrameObject structure to initialize. If this is NULL the structure is dynamically allocated.
60  * @param[in] pInit The initialization parameters
61  * @param[in] flags Some flags, see notes.
62  *
63  * @note Possible flags are: GWIN_FRAME_CLOSE_BTN, GWIN_FRAME_MINMAX_BTN.
64  * @note These frame buttons are processed internally. The close button will invoke a gwinDestroy() which will
65  * destroy the window itself and EVERY child it contains (also children of children).
66  *
67  * @return NULL if there is no resulting widget. A valid GHandle otherwise.
68  *
69  * @api
70  */
71 GHandle gwinGFrameCreate(GDisplay *g, GFrameObject *fo, GWidgetInit *pInit, gU32 flags);
72 #define gwinFrameCreate(fo, pInit, flags) gwinGFrameCreate(GDISP, fo, pInit, flags);
73 
74 /**
75  * @defgroup Renderings_Frame Renderings
76  *
77  * @brief Built-in rendering functions for the frame widget.
78  *
79  * @details These function may be passed to @p gwinSetCustomDraw() to get different frame drawing styles.
80  *
81  * @note In your custom frame drawing function you may optionally call these
82  * standard functions and then draw your extra details on top.
83  * @note These custom drawing routines don't have to worry about setting clipping as the framework
84  * sets clipping to the object window prior to calling these routines.
85  *
86  * @{
87  */
88 
89 /**
90  * @brief The default rendering function for the frame widget.
91  *
92  * @details Fills the client area with the background color.
93  *
94  * @param[in] gw The widget object (must be a frame widget).
95  * @param[in] param A parameter passed in from the user. Ignored by this function.
96  *
97  * @api
98  */
99 void gwinFrameDraw_Std(GWidgetObject *gw, void *param);
100 
101 /**
102  * @brief Renders the frame widget with a transparent client area.
103  *
104  * @details Will not fill the client area at all.
105  *
106  * @param[in] gw The widget object (must be a frame object).
107  * @param[in] param A parameter passed in from the user. Ignored by this function.
108  *
109  * @note The image custom draw function @p gwinFrameDraw_Image() uses param to pass in the gImage pointer.
110  * The image must be already opened before calling @p gwinSetCustomDraw().
111  *
112  * @api
113  */
115 
116 #if GDISP_NEED_IMAGE || defined(__DOXYGEN__)
117  /**
118  * @brief Renders the frame widget and uses the specified image for the client area.
119  *
120  * @details The image will be tiled throghout the client area. Therefore, to archive the best looking result the
121  * supplied image needs to be of the same size as the client area size of the frame widget (inner size).
122  *
123  * @param[in] gw The widget object (must be a frame object).
124  * @param[in] param A parameter passed in from the user. Must be an image handle. See note below.
125  *
126  * @note The image must be already opened before calling @p gwinSetCustomDraw(). The handle is passed as the parameter
127  * to this function.
128  *
129  * @pre GDISP_NEED_IMAGE must be set to GFXON
130  *
131  * @api
132  */
133  void gwinFrameDraw_Image(GWidgetObject *gw, void *param);
134 #endif /* GDISP_NEED_IMAGE */
135 /** @} */
136 
137 #endif /* _GWIN_FRAME_H */
138 /** @} */
139 
GHandle gwinGFrameCreate(GDisplay *g, GFrameObject *fo, GWidgetInit *pInit, gU32 flags)
Create a frame widget.
void gwinFrameDraw_Std(GWidgetObject *gw, void *param)
The default rendering function for the frame widget.
void gwinFrameDraw_Transparent(GWidgetObject *gw, void *param)
Renders the frame widget with a transparent client area.
void gwinFrameDraw_Image(GWidgetObject *gw, void *param)
Renders the frame widget and uses the specified image for the client area.
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