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 /**   Slider Management (Slider)                                          */
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_widget.h"
29 #include "gx_slider.h"
30 
31 /* Bring in externs for caller checking code.  */
32 GX_CALLER_CHECKING_EXTERNS
33 
34 /**************************************************************************/
35 /*                                                                        */
36 /*  FUNCTION                                               RELEASE        */
37 /*                                                                        */
38 /*    _gxe_pixelmap_slider_create                         PORTABLE C      */
39 /*                                                           6.1          */
40 /*  AUTHOR                                                                */
41 /*                                                                        */
42 /*    Kenneth Maxwell, Microsoft Corporation                              */
43 /*                                                                        */
44 /*  DESCRIPTION                                                           */
45 /*                                                                        */
46 /*    This function checks for error in pixelmap slider create call.      */
47 /*                                                                        */
48 /*  INPUT                                                                 */
49 /*                                                                        */
50 /*    slider                                Slider control block          */
51 /*    name                                  Name of prompt                */
52 /*    parent                                Parent widget control block   */
53 /*    info                                  Pointer to a GX_SLIDER_INFO   */
54 /*    pixelmap_info                         Pointer to the pixelmap       */
55 /*                                            info block                  */
56 /*    style                                 Style of the slider           */
57 /*    pixelmap_slider_id                    Application-defined ID of     */
58 /*                                            pixelmap slider             */
59 /*    size                                  Dimensions of pixelmap prompt */
60 /*    pixelmap_slider_control_block_size    Size of the pixelmap slider   */
61 /*                                            control block               */
62 /*                                                                        */
63 /*  OUTPUT                                                                */
64 /*                                                                        */
65 /*    status                                Completion status             */
66 /*                                                                        */
67 /*  CALLS                                                                 */
68 /*                                                                        */
69 /*    _gx_pixelmap_slider_create            The actual function           */
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 /**************************************************************************/
_gxe_pixelmap_slider_create(GX_PIXELMAP_SLIDER * slider,GX_CONST GX_CHAR * name,GX_WIDGET * parent,GX_SLIDER_INFO * info,GX_PIXELMAP_SLIDER_INFO * pixelmap_info,ULONG style,USHORT pixelmap_slider_id,GX_CONST GX_RECTANGLE * size,UINT pixelmap_slider_control_block_size)84 UINT  _gxe_pixelmap_slider_create(GX_PIXELMAP_SLIDER *slider,
85                                   GX_CONST GX_CHAR *name,
86                                   GX_WIDGET *parent,
87                                   GX_SLIDER_INFO *info,
88                                   GX_PIXELMAP_SLIDER_INFO *pixelmap_info,
89                                   ULONG style,
90                                   USHORT pixelmap_slider_id,
91                                   GX_CONST GX_RECTANGLE *size,
92                                   UINT pixelmap_slider_control_block_size)
93 {
94 
95 UINT status;
96 
97     /* Check for appropriate caller.  */
98     GX_INIT_AND_THREADS_CALLER_CHECKING
99 
100     /* Check error for valid pointer. */
101     if ((slider == GX_NULL) || (size == GX_NULL) ||
102         (info == GX_NULL) || (pixelmap_info == GX_NULL))
103     {
104         return(GX_PTR_ERROR);
105     }
106 
107     /* Check for invalid widget control block size. */
108     if (pixelmap_slider_control_block_size != sizeof(GX_PIXELMAP_SLIDER))
109     {
110         return(GX_INVALID_SIZE);
111     }
112 
113     /* Check for widget already created.  */
114     if (slider -> gx_widget_type != 0)
115     {
116         return(GX_ALREADY_CREATED);
117     }
118 
119     status = _gx_pixelmap_slider_create(slider, name, parent, info, pixelmap_info, style, pixelmap_slider_id, size);
120 
121     return(status);
122 }
123 
124