GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gxe_drop_list_create.c Lines: 10 10 100.0 %
Date: 2024-12-05 08:52:37 Branches: 14 14 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
/**   Drop List (List)                                                    */
18
/**                                                                       */
19
/**************************************************************************/
20
21
#define GX_SOURCE_CODE
22
23
24
/* Include necessary system files.  */
25
26
#include "gx_api.h"
27
#include "gx_widget.h"
28
#include "gx_system.h"
29
#include "gx_drop_list.h"
30
31
/* Bring in externs for caller checking code.  */
32
GX_CALLER_CHECKING_EXTERNS
33
/**************************************************************************/
34
/*                                                                        */
35
/*  FUNCTION                                               RELEASE        */
36
/*                                                                        */
37
/*    _gxe_drop_list_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 drop list create function    */
46
/*    call.                                                               */
47
/*                                                                        */
48
/*  INPUT                                                                 */
49
/*                                                                        */
50
/*    drop_list                             Drop list control block       */
51
/*    name                                  Name of drop list             */
52
/*    parent                                Pointer to parent widget      */
53
/*    total_rows                            Total number of rows in       */
54
/*                                            drop list                   */
55
/*    open_height                           Height of the vertical list   */
56
/*    callback                              Callback function             */
57
/*    style                                 Style of scrollbar widget     */
58
/*    drop_list_id                          Application-defined ID of     */
59
/*                                            the drop list               */
60
/*    size                                  Dimensions of the drop list   */
61
/*    drop_list_control_block_size          Control block size            */
62
/*                                                                        */
63
/*  OUTPUT                                                                */
64
/*                                                                        */
65
/*    status                                Completion status             */
66
/*                                                                        */
67
/*  CALLS                                                                 */
68
/*                                                                        */
69
/*    _gx_drop_list_create                  Actual drop list create call  */
70
/*                                                                        */
71
/*  CALLED BY                                                             */
72
/*                                                                        */
73
/*    Application Code                                                    */
74
/*                                                                        */
75
/*  RELEASE HISTORY                                                       */
76
/*                                                                        */
77
/*    DATE              NAME                      DESCRIPTION             */
78
/*                                                                        */
79
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
80
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
81
/*                                            resulting in version 6.1    */
82
/*                                                                        */
83
/**************************************************************************/
84
568
UINT  _gxe_drop_list_create(GX_DROP_LIST *drop_list, GX_CONST GX_CHAR *name,
85
                            GX_WIDGET *parent, INT total_rows, INT open_height,
86
                            VOID (*callback)(GX_VERTICAL_LIST *, GX_WIDGET *, INT),
87
                            ULONG style, USHORT drop_list_id, GX_CONST GX_RECTANGLE *size, UINT drop_list_control_block_size)
88
{
89
UINT status;
90
91
    /* Check for appropriate caller.  */
92

568
    GX_INIT_AND_THREADS_CALLER_CHECKING
93
94
    /* Check for invalid input pointers.  */
95

566
    if (!drop_list || !size)
96
    {
97
2
        return(GX_PTR_ERROR);
98
    }
99
100
    /* Check for control block size. */
101
564
    if (drop_list_control_block_size != sizeof(GX_DROP_LIST))
102
    {
103
1
        return(GX_INVALID_SIZE);
104
    }
105
106
    /* Check for widget already created.  */
107
563
    if (drop_list -> gx_widget_type != 0)
108
    {
109
1
        return(GX_ALREADY_CREATED);
110
    }
111
112
    /* Call actual widget hide function.  */
113
562
    status = _gx_drop_list_create(drop_list, name, parent, total_rows, open_height,
114
                                  callback, style, drop_list_id, size);
115
116
562
    return(status);
117
}
118