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