1 |
|
|
/*************************************************************************** |
2 |
|
|
* Copyright (c) 2024 Microsoft Corporation |
3 |
|
|
* Copyright (c) 2026-present Eclipse ThreadX contributors |
4 |
|
|
* |
5 |
|
|
* This program and the accompanying materials are made available under the |
6 |
|
|
* terms of the MIT License which is available at |
7 |
|
|
* https://opensource.org/licenses/MIT. |
8 |
|
|
* |
9 |
|
|
* SPDX-License-Identifier: MIT |
10 |
|
|
**************************************************************************/ |
11 |
|
|
|
12 |
|
|
|
13 |
|
|
/**************************************************************************/ |
14 |
|
|
/**************************************************************************/ |
15 |
|
|
/** */ |
16 |
|
|
/** GUIX Component */ |
17 |
|
|
/** */ |
18 |
|
|
/** Slider 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_value_calculate 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 value calculate call. */ |
45 |
|
|
/* */ |
46 |
|
|
/* INPUT */ |
47 |
|
|
/* */ |
48 |
|
|
/* slider Slider widget control block */ |
49 |
|
|
/* info Pointer to slider info */ |
50 |
|
|
/* new_position New slider position */ |
51 |
|
|
/* */ |
52 |
|
|
/* OUTPUT */ |
53 |
|
|
/* */ |
54 |
|
|
/* status Completion status */ |
55 |
|
|
/* */ |
56 |
|
|
/* CALLS */ |
57 |
|
|
/* */ |
58 |
|
|
/* _gx_slider_value_calculate Actual slider value calculate */ |
59 |
|
|
/* call */ |
60 |
|
|
/* CALLED BY */ |
61 |
|
|
/* */ |
62 |
|
|
/* Application Code */ |
63 |
|
|
/* */ |
64 |
|
|
/**************************************************************************/ |
65 |
|
10 |
UINT _gxe_slider_value_calculate(GX_SLIDER *slider, GX_SLIDER_INFO *info, INT new_position) |
66 |
|
|
{ |
67 |
|
|
UINT status; |
68 |
|
|
|
69 |
|
|
/* Check for invalid caller. */ |
70 |
✓✓✓✓ ✓✓ |
10 |
GX_INIT_AND_THREADS_CALLER_CHECKING |
71 |
|
|
|
72 |
|
|
/* Check for invalid pointer. */ |
73 |
✓✓✓✓
|
8 |
if ((slider == GX_NULL) || (info == GX_NULL)) |
74 |
|
|
{ |
75 |
|
2 |
return(GX_PTR_ERROR); |
76 |
|
|
} |
77 |
|
|
|
78 |
|
|
/* Check for invalid widget. */ |
79 |
✓✓ |
6 |
if (slider -> gx_widget_type == 0) |
80 |
|
|
{ |
81 |
|
1 |
return(GX_INVALID_WIDGET); |
82 |
|
|
} |
83 |
|
|
|
84 |
|
|
/* Check for invalid slider info. */ |
85 |
✓✓ |
5 |
if ((info -> gx_slider_info_current_val < info -> gx_slider_info_min_val) || |
86 |
✓✓ |
3 |
(info -> gx_slider_info_current_val > info -> gx_slider_info_max_val) || |
87 |
✓✓ |
2 |
(info -> gx_slider_info_min_val >= info -> gx_slider_info_max_val)) |
88 |
|
|
{ |
89 |
|
4 |
return(GX_INVALID_VALUE); |
90 |
|
|
} |
91 |
|
|
|
92 |
|
|
/* Call actual slider value caculate function. */ |
93 |
|
1 |
status = _gx_slider_value_calculate(slider, info, new_position); |
94 |
|
|
|
95 |
|
1 |
return(status); |
96 |
|
|
} |
97 |
|
|
|