1 /**************************************************************************/
2 /*                                                                        */
3 /*       Copyright (c) Microsoft Corporation. All rights reserved.        */
4 /*                                                                        */
5 /*       This software is licensed under the Microsoft Software License   */
6 /*       Terms for Microsoft Azure RTOS. Full text of the license can be  */
7 /*       found in the LICENSE file at https://aka.ms/AzureRTOS_EULA       */
8 /*       and in the root directory of this software.                      */
9 /*                                                                        */
10 /**************************************************************************/
11 
12 
13 /**************************************************************************/
14 /**************************************************************************/
15 /**                                                                       */
16 /** GUIX Component                                                        */
17 /**                                                                       */
18 /**   Window Management (Window)                                          */
19 /**                                                                       */
20 /**************************************************************************/
21 
22 #define GX_SOURCE_CODE
23 
24 
25 /* Include necessary system files.  */
26 
27 #include "gx_api.h"
28 #include "gx_window.h"
29 
30 /* Bring in externs for caller checking code.  */
31 GX_CALLER_CHECKING_EXTERNS
32 
33 /**************************************************************************/
34 /*                                                                        */
35 /*  FUNCTION                                               RELEASE        */
36 /*                                                                        */
37 /*    _gxe_window_create                                  PORTABLE C      */
38 /*                                                           6.1          */
39 /*  AUTHOR                                                                */
40 /*                                                                        */
41 /*    Kenneth Maxwell, Microsoft Corporation                              */
42 /*                                                                        */
43 /*  DESCRIPTION                                                           */
44 /*                                                                        */
45 /*    This function checks for errors in the window create function call. */
46 /*                                                                        */
47 /*  INPUT                                                                 */
48 /*                                                                        */
49 /*    window                                Pointer to window control     */
50 /*                                           block                        */
51 /*    name                                  Logical name of window        */
52 /*    parent                                Pointer to parent window      */
53 /*    style                                 Window Style                  */
54 /*    window_id                             Application-defined ID of the */
55 /*                                            window                      */
56 /*    size                                  Size of the window            */
57 /*    window_control_block_size             Size of the window control    */
58 /*                                            block                       */
59 /*                                                                        */
60 /*  OUTPUT                                                                */
61 /*                                                                        */
62 /*    status                                Completion status             */
63 /*                                                                        */
64 /*  CALLS                                                                 */
65 /*                                                                        */
66 /*    _gx_window_create                     Actual window create function */
67 /*                                                                        */
68 /*  CALLED BY                                                             */
69 /*                                                                        */
70 /*    Application Code                                                    */
71 /*                                                                        */
72 /*  RELEASE HISTORY                                                       */
73 /*                                                                        */
74 /*    DATE              NAME                      DESCRIPTION             */
75 /*                                                                        */
76 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
77 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
78 /*                                            resulting in version 6.1    */
79 /*                                                                        */
80 /**************************************************************************/
_gxe_window_create(GX_WINDOW * window,GX_CONST GX_CHAR * name,GX_WIDGET * parent,ULONG style,USHORT window_id,GX_CONST GX_RECTANGLE * size,UINT window_control_block_size)81 UINT  _gxe_window_create(GX_WINDOW *window, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
82                          ULONG style, USHORT window_id, GX_CONST GX_RECTANGLE *size,
83                          UINT window_control_block_size)
84 {
85 UINT status;
86 
87     /* Check for appropriate caller.  */
88     GX_INIT_AND_THREADS_CALLER_CHECKING
89 
90     /* Check for invalid input pointers.  */
91     if ((window == GX_NULL) || (size == GX_NULL))
92     {
93         return(GX_PTR_ERROR);
94     }
95 
96     /* Check for widget already created.  */
97     if (window -> gx_widget_type != 0)
98     {
99         return(GX_ALREADY_CREATED);
100     }
101 
102     /* Check for invalid widget control block size. */
103     if (window_control_block_size != sizeof(GX_WINDOW))
104     {
105         return(GX_INVALID_SIZE);
106     }
107 
108     /* Check for invalid parent widget. */
109     if (parent && (parent -> gx_widget_type == 0))
110     {
111         return(GX_INVALID_WIDGET);
112     }
113 
114     /* Call actual window create function.  */
115     status = _gx_window_create(window, name, parent, style, window_id, size);
116 
117     /* Return completion status.  */
118     return(status);
119 }
120 
121