version 2.8
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.org/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 TRUE in your gfxconf.h
21  * @pre GWIN_NEED_FRAME must be set to TRUE 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 #ifdef __cplusplus
54 extern "C" {
55 #endif
56 
57 /**
58  * @brief Create a frame widget
59  *
60  * @details This widget provides a window like we know it from desktop systems.
61  *
62  * @param[in] g The GDisplay to display this window on
63  * @param[in] fo The GFrameObject structure to initialize. If this is NULL the structure is dynamically allocated.
64  * @param[in] pInit The initialization parameters
65  * @param[in] flags Some flags, see notes.
66  *
67  * @note Possible flags are: GWIN_FRAME_CLOSE_BTN, GWIN_FRAME_MINMAX_BTN.
68  * @note These frame buttons are processed internally. The close button will invoke a gwinDestroy() which will
69  * destroy the window itself and EVERY child it contains (also children of children).
70  *
71  * @return NULL if there is no resulting widget. A valid GHandle otherwise.
72  *
73  * @api
74  */
75 GHandle gwinGFrameCreate(GDisplay *g, GFrameObject *fo, GWidgetInit *pInit, uint32_t flags);
76 #define gwinFrameCreate(fo, pInit, flags) gwinGFrameCreate(GDISP, fo, pInit, flags);
77 
78 /**
79  * @defgroup Renderings_Frame Renderings
80  *
81  * @brief Built-in rendering functions for the frame widget.
82  *
83  * @details These function may be passed to @p gwinSetCustomDraw() to get different frame drawing styles.
84  *
85  * @note In your custom frame drawing function you may optionally call these
86  * standard functions and then draw your extra details on top.
87  * @note These custom drawing routines don't have to worry about setting clipping as the framework
88  * sets clipping to the object window prior to calling these routines.
89  *
90  * @{
91  */
92 
93 /**
94  * @brief The default rendering function for the frame widget.
95  *
96  * @details Fills the client area with the background color.
97  *
98  * @param[in] gw The widget object (must be a frame widget).
99  * @param[in] param A parameter passed in from the user. Ignored by this function.
100  *
101  * @api
102  */
103 void gwinFrameDraw_Std(GWidgetObject *gw, void *param);
104 
105 /**
106  * @brief Renders the frame widget with a transparent client area.
107  *
108  * @details Will not fill the client area at all.
109  *
110  * @param[in] gw The widget object (must be a frame object).
111  * @param[in] param A parameter passed in from the user. Ignored by this function.
112  *
113  * @note The image custom draw function @p gwinFrameDraw_Image() uses param to pass in the gdispImage pointer.
114  * The image must be already opened before calling @p gwinSetCustomDraw().
115  *
116  * @api
117  */
118 void gwinFrameDraw_Transparent(GWidgetObject *gw, void *param);
119 
120 #if GDISP_NEED_IMAGE || defined(__DOXYGEN__)
121  /**
122  * @brief Renders the frame widget and uses the specified image for the client area.
123  *
124  * @details The image will be tiled throghout the client area. Therefore, to archive the best looking result the
125  * supplied image needs to be of the same size as the client area size of the frame widget (inner size).
126  *
127  * @param[in] gw The widget object (must be a frame object).
128  * @param[in] param A parameter passed in from the user. Must be an image handle. See note below.
129  *
130  * @note The image must be already opened before calling @p gwinSetCustomDraw(). The handle is passed as the parameter
131  * to this function.
132  *
133  * @pre GDISP_NEED_IMAGE must be set to TRUE
134  *
135  * @api
136  */
137  void gwinFrameDraw_Image(GWidgetObject *gw, void *param);
138 #endif /* GDISP_NEED_IMAGE */
139 /** @} */
140 
141 #ifdef __cplusplus
142 }
143 #endif
144 
145 #endif /* _GWIN_FRAME_H */
146 /** @} */
147 
The structure to initialise a widget.
Definition: gwin_widget.h:97
void gwinFrameDraw_Image(GWidgetObject *gw, void *param)
Renders the frame widget and uses the specified image for the client area.
The GWIN Widget structure.
Definition: gwin_widget.h:118
A window object structure.
Definition: gwin.h:40
GHandle gwinGFrameCreate(GDisplay *g, GFrameObject *fo, GWidgetInit *pInit, uint32_t 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.