GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_system_view_add.c Lines: 10 10 100.0 %
Date: 2024-12-05 08:52:37 Branches: 6 6 100.0 %

Line Branch Exec Source
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
/**************************************************************************/
74
7145
VOID _gx_system_view_add(GX_WINDOW *win, GX_RECTANGLE *view)
75
{
76
GX_VIEW *newview;
77
78
7145
    if (_gx_system_view_fold(win, view))
79
    {
80
75
        return;
81
    }
82
7070
    newview = _gx_system_free_view_get();
83
84
7070
    if (newview)
85
    {
86
7065
        newview -> gx_view_rectangle = *view;
87
88
7065
        if (win -> gx_window_views)
89
        {
90
3792
            newview -> gx_view_next = win -> gx_window_views;
91
        }
92
        else
93
        {
94
3273
            newview -> gx_view_next = GX_NULL;
95
        }
96
7065
        win -> gx_window_views = newview;
97
    }
98
}
99