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 /**   System Management (System)                                          */
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_utility.h"
29 
30 
31 /**************************************************************************/
32 /*                                                                        */
33 /*  FUNCTION                                               RELEASE        */
34 /*                                                                        */
35 /*    _gx_system_view_add                                 PORTABLE C      */
36 /*                                                           6.1          */
37 /*  AUTHOR                                                                */
38 /*                                                                        */
39 /*    Kenneth Maxwell, Microsoft Corporation                              */
40 /*                                                                        */
41 /*  DESCRIPTION                                                           */
42 /*                                                                        */
43 /*    Link a view to window's view list                                   */
44 /*                                                                        */
45 /*                                                                        */
46 /*  INPUT                                                                 */
47 /*                                                                        */
48 /*    win                                   Window to add view to         */
49 /*    view                                  Rectangle defining new view   */
50 /*                                                                        */
51 /*  OUTPUT                                                                */
52 /*                                                                        */
53 /*    None                                                                */
54 /*                                                                        */
55 /*  CALLS                                                                 */
56 /*                                                                        */
57 /*   _gx_system_view_fold                   Combine views                 */
58 /*   _gx_system_free_view_get               Get free view from storage    */
59 /*                                                                        */
60 /*  CALLED BY                                                             */
61 /*                                                                        */
62 /*    _gx_system_root_view_add              Add a view to the root        */
63 /*                                            window                      */
64 /*                                                                        */
65 /*  RELEASE HISTORY                                                       */
66 /*                                                                        */
67 /*    DATE              NAME                      DESCRIPTION             */
68 /*                                                                        */
69 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
70 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
71 /*                                            resulting in version 6.1    */
72 /*                                                                        */
73 /**************************************************************************/
_gx_system_view_add(GX_WINDOW * win,GX_RECTANGLE * view)74 VOID _gx_system_view_add(GX_WINDOW *win, GX_RECTANGLE *view)
75 {
76 GX_VIEW *newview;
77 
78     if (_gx_system_view_fold(win, view))
79     {
80         return;
81     }
82     newview = _gx_system_free_view_get();
83 
84     if (newview)
85     {
86         newview -> gx_view_rectangle = *view;
87 
88         if (win -> gx_window_views)
89         {
90             newview -> gx_view_next = win -> gx_window_views;
91         }
92         else
93         {
94             newview -> gx_view_next = GX_NULL;
95         }
96         win -> gx_window_views = newview;
97     }
98 }
99 
100