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 /** Prompt Management (Slider) */
18 /** */
19 /**************************************************************************/
20
21 #define GX_SOURCE_CODE
22
23 /* Include necessary system files. */
24
25 #include "gx_api.h"
26 #include "gx_slider.h"
27
28 /* Bring in externs for caller checking code. */
29 GX_CALLER_CHECKING_EXTERNS
30
31 /**************************************************************************/
32 /* */
33 /* FUNCTION RELEASE */
34 /* */
35 /* _gxe_slider_needle_position_get PORTABLE C */
36 /* 6.1 */
37 /* AUTHOR */
38 /* */
39 /* Kenneth Maxwell, Microsoft Corporation */
40 /* */
41 /* DESCRIPTION */
42 /* */
43 /* This function checks for errors in slider needle position get call. */
44 /* */
45 /* */
46 /* INPUT */
47 /* */
48 /* slider Slider widget control block */
49 /* slider_info Pointer to slider information */
50 /* structure defining the */
51 /* slider limits, needle size */
52 /* and offset, and other */
53 /* slider parameters. */
54 /* return_position Pointer to destination for */
55 /* needle position */
56 /* */
57 /* OUTPUT */
58 /* */
59 /* status Completion status */
60 /* */
61 /* CALLS */
62 /* */
63 /* _gx_slider_needle_position_get Actual slider needle position */
64 /* get call */
65 /* */
66 /* CALLED BY */
67 /* */
68 /* Application Code */
69 /* */
70 /* RELEASE HISTORY */
71 /* */
72 /* DATE NAME DESCRIPTION */
73 /* */
74 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
75 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */
76 /* resulting in version 6.1 */
77 /* */
78 /**************************************************************************/
_gxe_slider_needle_position_get(GX_SLIDER * slider,GX_SLIDER_INFO * slider_info,GX_RECTANGLE * return_position)79 UINT _gxe_slider_needle_position_get(GX_SLIDER *slider, GX_SLIDER_INFO *slider_info, GX_RECTANGLE *return_position)
80 {
81 UINT status;
82
83 /* Check for invalid caller. */
84 GX_INIT_AND_THREADS_CALLER_CHECKING
85
86 /* Check for invalid pointer. */
87 if ((slider == GX_NULL) || (slider_info == GX_NULL) || (return_position == GX_NULL))
88 {
89 return(GX_PTR_ERROR);
90 }
91
92 /* Check for invalid widget. */
93 if (slider -> gx_widget_type == 0)
94 {
95 return(GX_INVALID_WIDGET);
96 }
97
98 /* Check for invalid slider info. */
99 if ((slider_info -> gx_slider_info_current_val < slider_info -> gx_slider_info_min_val) ||
100 (slider_info -> gx_slider_info_current_val > slider_info -> gx_slider_info_max_val) ||
101 (slider_info -> gx_slider_info_min_val >= slider_info -> gx_slider_info_max_val))
102 {
103 return(GX_INVALID_VALUE);
104 }
105
106 /* Call actual slider needle position get call. */
107 status = _gx_slider_needle_position_get(slider, slider_info, return_position);
108
109 return(status);
110 }
111
112