1 /***************************************************************************
2  * Copyright (c) 2024 Microsoft Corporation
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the MIT License which is available at
6  * https://opensource.org/licenses/MIT.
7  *
8  * SPDX-License-Identifier: MIT
9  **************************************************************************/
10 
11 
12 /**************************************************************************/
13 /**************************************************************************/
14 /**                                                                       */
15 /** GUIX Component                                                        */
16 /**                                                                       */
17 /**   Window Management (Window)                                          */
18 /**                                                                       */
19 /**************************************************************************/
20 
21 #define GX_SOURCE_CODE
22 
23 
24 /* Include necessary system files.  */
25 
26 #include "gx_api.h"
27 #include "gx_system.h"
28 #include "gx_window.h"
29 
30 /* Bring in externs for caller checking code.  */
31 GX_CALLER_CHECKING_EXTERNS
32 /**************************************************************************/
33 /*                                                                        */
34 /*  FUNCTION                                               RELEASE        */
35 /*                                                                        */
36 /*    _gxe_window_root_create                             PORTABLE C      */
37 /*                                                           6.1          */
38 /*  AUTHOR                                                                */
39 /*                                                                        */
40 /*    Kenneth Maxwell, Microsoft Corporation                              */
41 /*                                                                        */
42 /*  DESCRIPTION                                                           */
43 /*                                                                        */
44 /*    This function checks for errors in window root create function call.*/
45 /*                                                                        */
46 /*  INPUT                                                                 */
47 /*                                                                        */
48 /*    root_window                           Root window control block     */
49 /*    name                                  Name of window                */
50 /*    canvas                                Canvas this root window       */
51 /*                                            belongs to                  */
52 /*    style                                 Style of window               */
53 /*    Id                                    User-specified root window ID */
54 /*    size                                  Window size                   */
55 /*                                                                        */
56 /*  OUTPUT                                                                */
57 /*                                                                        */
58 /*    status                                Completion status             */
59 /*                                                                        */
60 /*  CALLS                                                                 */
61 /*                                                                        */
62 /*    _gx_window_root_create                Actual root window create call*/
63 /*                                                                        */
64 /*  CALLED BY                                                             */
65 /*                                                                        */
66 /*    Application Code                                                    */
67 /*                                                                        */
68 /*  RELEASE HISTORY                                                       */
69 /*                                                                        */
70 /*    DATE              NAME                      DESCRIPTION             */
71 /*                                                                        */
72 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
73 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
74 /*                                            resulting in version 6.1    */
75 /*                                                                        */
76 /**************************************************************************/
_gxe_window_root_create(GX_WINDOW_ROOT * root_window,GX_CONST GX_CHAR * name,GX_CANVAS * canvas,ULONG style,USHORT Id,GX_CONST GX_RECTANGLE * size,UINT root_window_control_block_size)77 UINT  _gxe_window_root_create(GX_WINDOW_ROOT *root_window,
78                               GX_CONST GX_CHAR *name, GX_CANVAS *canvas,
79                               ULONG style, USHORT Id, GX_CONST GX_RECTANGLE *size, UINT root_window_control_block_size)
80 {
81 UINT status;
82 
83     /* Check for appropriate caller.  */
84     GX_INIT_AND_THREADS_CALLER_CHECKING
85 
86     /* Check for invalid input pointers.  */
87     if ((root_window == GX_NULL) || (size == GX_NULL))
88     {
89         return(GX_PTR_ERROR);
90     }
91 
92     /* Check for invalid input pointers.  */
93     if (canvas == GX_NULL)
94     {
95         return(GX_PTR_ERROR);
96     }
97 
98     /* Check for invalid widget control block size.  */
99     if (root_window_control_block_size != sizeof(GX_WINDOW_ROOT))
100     {
101         return(GX_INVALID_SIZE);
102     }
103 
104     /* Check for widget already created.  */
105     if (root_window -> gx_widget_type != 0)
106     {
107         return(GX_ALREADY_CREATED);
108     }
109 
110     /* Call actual root window create function. */
111     status = _gx_window_root_create(root_window, name, canvas, style, Id, size);
112 
113     return(status);
114 }
115 
116