1 /**************************************************************************/
2 /*                                                                        */
3 /*       Copyright (c) Microsoft Corporation. All rights reserved.        */
4 /*                                                                        */
5 /*       This software is licensed under the Microsoft Software License   */
6 /*       Terms for Microsoft Azure RTOS. Full text of the license can be  */
7 /*       found in the LICENSE file at https://aka.ms/AzureRTOS_EULA       */
8 /*       and in the root directory of this software.                      */
9 /*                                                                        */
10 /**************************************************************************/
11 
12 
13 /**************************************************************************/
14 /**************************************************************************/
15 /**                                                                       */
16 /** GUIX Component                                                        */
17 /**                                                                       */
18 /**   Vertical List (List)                                                */
19 /**                                                                       */
20 /**************************************************************************/
21 
22 #define GX_SOURCE_CODE
23 
24 
25 /* Include necessary system files.  */
26 
27 #include "gx_api.h"
28 #include "gx_window.h"
29 
30 GX_CALLER_CHECKING_EXTERNS
31 
32 /**************************************************************************/
33 /*                                                                        */
34 /*  FUNCTION                                               RELEASE        */
35 /*                                                                        */
36 /*    _gxe_vertical_list_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 the vertical list create         */
45 /*    function call.                                                      */
46 /*                                                                        */
47 /*  INPUT                                                                 */
48 /*                                                                        */
49 /*    vertical_list                         Vertical list control block   */
50 /*    name                                  Name of vertical list         */
51 /*    parent                                Pointer to parent widget      */
52 /*    total_rows                            Total number of rows in       */
53 /*                                            vertical list               */
54 /*    callback                              User-specified Callback       */
55 /*                                            function                    */
56 /*    style                                 Style of scrollbar widget     */
57 /*    vertical_list_id                      Application-defined ID of     */
58 /*                                            vertical list               */
59 /*    size                                  Dimensions of vertical list   */
60 /*    vertical_list_control_block_size      Size of the vertical list     */
61 /*                                            control block               */
62 /*                                                                        */
63 /*  OUTPUT                                                                */
64 /*                                                                        */
65 /*    status                                Completion status             */
66 /*                                                                        */
67 /*  CALLS                                                                 */
68 /*                                                                        */
69 /*    _gx_vertical_list_create              Actual vertical list create   */
70 /*                                          function                      */
71 /*                                                                        */
72 /*  CALLED BY                                                             */
73 /*                                                                        */
74 /*    Application Code                                                    */
75 /*                                                                        */
76 /*  RELEASE HISTORY                                                       */
77 /*                                                                        */
78 /*    DATE              NAME                      DESCRIPTION             */
79 /*                                                                        */
80 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
81 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
82 /*                                            resulting in version 6.1    */
83 /*                                                                        */
84 /**************************************************************************/
_gxe_vertical_list_create(GX_VERTICAL_LIST * vertical_list,GX_CONST GX_CHAR * name,GX_WIDGET * parent,INT total_rows,VOID (* callback)(GX_VERTICAL_LIST *,GX_WIDGET *,INT),ULONG style,USHORT vertical_list_id,GX_CONST GX_RECTANGLE * size,UINT vertical_list_control_block_size)85 UINT  _gxe_vertical_list_create(GX_VERTICAL_LIST *vertical_list, GX_CONST GX_CHAR *name,
86                                 GX_WIDGET *parent, INT total_rows,
87                                 VOID (*callback)(GX_VERTICAL_LIST *, GX_WIDGET *, INT),
88                                 ULONG style, USHORT vertical_list_id, GX_CONST GX_RECTANGLE *size,
89                                 UINT vertical_list_control_block_size)
90 {
91 UINT status;
92 
93     /* Check for appropriate caller.  */
94     GX_INIT_AND_THREADS_CALLER_CHECKING
95 
96     /* Check for invalid input pointers.  */
97     if ((vertical_list == GX_NULL) || (size == GX_NULL))
98     {
99         return GX_PTR_ERROR;
100     }
101 
102     if (vertical_list_control_block_size != sizeof(GX_VERTICAL_LIST))
103     {
104         return(GX_INVALID_SIZE);
105     }
106 
107     /* Check for id is created.  */
108     if (vertical_list -> gx_widget_type != 0)
109     {
110         return(GX_ALREADY_CREATED);
111     }
112 
113     /* Check for valid number of rows .  */
114     if (total_rows <= 0)
115     {
116         return GX_INVALID_VALUE;
117     }
118 
119     /* Check for invalid widget. */
120     if (parent && (parent -> gx_widget_type == 0))
121     {
122         return GX_INVALID_WIDGET;
123     }
124 
125     /* Call the actual vertical list create function.  */
126     status = _gx_vertical_list_create(vertical_list, name, parent, total_rows, callback, style, vertical_list_id, size);
127 
128     /* Return completion status.  */
129     return status;
130 }
131 
132