GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gxe_vertical_scrollbar_create.c Lines: 12 12 100.0 %
Date: 2024-12-05 08:52:37 Branches: 16 16 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
/**   Scrollbar Management (Scrollbar)                                    */
18
/**                                                                       */
19
/**************************************************************************/
20
21
#define GX_SOURCE_CODE
22
23
24
/* Include necessary system files.  */
25
26
#include "gx_api.h"
27
#include "gx_scrollbar.h"
28
29
GX_CALLER_CHECKING_EXTERNS
30
31
/**************************************************************************/
32
/*                                                                        */
33
/*  FUNCTION                                               RELEASE        */
34
/*                                                                        */
35
/*    _gxe_vertical_scrollbar_create                      PORTABLE C      */
36
/*                                                           6.1          */
37
/*  AUTHOR                                                                */
38
/*                                                                        */
39
/*    Kenneth Maxwell, Microsoft Corporation                              */
40
/*                                                                        */
41
/*  DESCRIPTION                                                           */
42
/*                                                                        */
43
/*    This function checks for errors in the vertical scrollbar create    */
44
/*    function call.                                                      */
45
/*                                                                        */
46
/*  INPUT                                                                 */
47
/*                                                                        */
48
/*    scrollbar                             Scrollbar control block       */
49
/*    name                                  Name of scrollbar             */
50
/*    parent                                Pointer to parent widget      */
51
/*    appearance                            Appearance of vertical        */
52
/*                                          scrollbar widget              */
53
/*    scrollbar_control_block_size          Size of the scrollbar control */
54
/*                                            block                       */
55
/*                                                                        */
56
/*  OUTPUT                                                                */
57
/*                                                                        */
58
/*    status                                Completion status             */
59
/*                                                                        */
60
/*  CALLS                                                                 */
61
/*                                                                        */
62
/*    _gx_vertical_scrollbar_create         Actual vertical scrollbar     */
63
/*                                          create function               */
64
/*                                                                        */
65
/*  CALLED BY                                                             */
66
/*                                                                        */
67
/*    Application Code                                                    */
68
/*                                                                        */
69
/*  RELEASE HISTORY                                                       */
70
/*                                                                        */
71
/*    DATE              NAME                      DESCRIPTION             */
72
/*                                                                        */
73
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
74
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
75
/*                                            resulting in version 6.1    */
76
/*                                                                        */
77
/**************************************************************************/
78
1610
UINT  _gxe_vertical_scrollbar_create(GX_SCROLLBAR *scrollbar, GX_CONST GX_CHAR *name,
79
                                     GX_WINDOW *parent,
80
                                     GX_SCROLLBAR_APPEARANCE *appearance,
81
                                     ULONG style, UINT scrollbar_control_block_size)
82
{
83
UINT status;
84
85
    /* Check for appropriate caller.  */
86

1610
    GX_INIT_AND_THREADS_CALLER_CHECKING
87
88
    /* Check for invalid input pointers.  */
89
1608
    if (scrollbar == GX_NULL)
90
    {
91
1
        return GX_PTR_ERROR;
92
    }
93
94
    /* Check for invalid control block size. */
95
1607
    if (scrollbar_control_block_size != sizeof(GX_SCROLLBAR))
96
    {
97
1
        return(GX_INVALID_SIZE);
98
    }
99
100
    /* Check for widget already created.  */
101
1606
    if (scrollbar -> gx_widget_type != 0)
102
    {
103
2
        return(GX_ALREADY_CREATED);
104
    }
105
106
    /* Check for invalid parent widget. */
107

1604
    if (parent && (parent -> gx_widget_type == 0))
108
    {
109
1
        return(GX_INVALID_WIDGET);
110
    }
111
112
    /* Call the actual vertical list create function.  */
113
1603
    status = _gx_vertical_scrollbar_create(scrollbar, name, parent, appearance, style);
114
115
    /* Return completion status.  */
116
1603
    return status;
117
}
118