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_widget.h"
28 #include "gx_scrollbar.h"
29 
30 GX_CALLER_CHECKING_EXTERNS
31 
32 /**************************************************************************/
33 /*                                                                        */
34 /*  FUNCTION                                               RELEASE        */
35 /*                                                                        */
36 /*    _gxe_horizontal_scrollbar_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 horizontal scrollbar create  */
45 /*    function call.                                                      */
46 /*                                                                        */
47 /*  INPUT                                                                 */
48 /*                                                                        */
49 /*    scrollbar                             scroll control block          */
50 /*    name                                  Name of scroll                */
51 /*    parent                                parent window                 */
52 /*    appearance                            style of scroll bar           */
53 /*                                                                        */
54 /*  OUTPUT                                                                */
55 /*                                                                        */
56 /*    status                                Completion status             */
57 /*                                                                        */
58 /*  CALLS                                                                 */
59 /*                                                                        */
60 /*    _gx_horizontal_scrollbar_create       Actual horizontal scrollbar   */
61 /*                                          create function               */
62 /*                                                                        */
63 /*  CALLED BY                                                             */
64 /*                                                                        */
65 /*    Application Code                                                    */
66 /*                                                                        */
67 /*  RELEASE HISTORY                                                       */
68 /*                                                                        */
69 /*    DATE              NAME                      DESCRIPTION             */
70 /*                                                                        */
71 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
72 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
73 /*                                            resulting in version 6.1    */
74 /*                                                                        */
75 /**************************************************************************/
_gxe_horizontal_scrollbar_create(GX_SCROLLBAR * scrollbar,GX_CONST GX_CHAR * name,GX_WINDOW * parent,GX_SCROLLBAR_APPEARANCE * appearance,ULONG style,UINT scrollbar_control_block_size)76 UINT  _gxe_horizontal_scrollbar_create(GX_SCROLLBAR *scrollbar, GX_CONST GX_CHAR *name,
77                                        GX_WINDOW *parent, GX_SCROLLBAR_APPEARANCE *appearance,
78                                        ULONG style, UINT scrollbar_control_block_size)
79 {
80 UINT status;
81 
82     /* Check for appropriate caller.  */
83     GX_INIT_AND_THREADS_CALLER_CHECKING
84 
85     /* Check for invalid input pointers.  */
86     if (scrollbar == GX_NULL)
87     {
88         return(GX_PTR_ERROR);
89     }
90 
91     if (scrollbar_control_block_size != sizeof(GX_SCROLLBAR))
92     {
93         return(GX_INVALID_SIZE);
94     }
95 
96     /* Check for id is created.  */
97     if (scrollbar -> gx_widget_type != 0)
98     {
99         return(GX_ALREADY_CREATED);
100     }
101 
102     /* Call the actual horizontal scroll*/
103     status = _gx_horizontal_scrollbar_create(scrollbar, name, parent, appearance, style);
104 
105     /* Return completion status.  */
106     return status;
107 }
108 
109