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_system.h" |
28 |
|
|
#include "gx_display.h" |
29 |
|
|
#include "gx_context.h" |
30 |
|
|
#include "gx_widget.h" |
31 |
|
|
#include "gx_utility.h" |
32 |
|
|
#include "gx_slider.h" |
33 |
|
|
|
34 |
|
|
|
35 |
|
|
|
36 |
|
|
/**************************************************************************/ |
37 |
|
|
/* */ |
38 |
|
|
/* FUNCTION RELEASE */ |
39 |
|
|
/* */ |
40 |
|
|
/* _gx_slider_value_set PORTABLE C */ |
41 |
|
|
/* 6.1 */ |
42 |
|
|
/* AUTHOR */ |
43 |
|
|
/* */ |
44 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
45 |
|
|
/* */ |
46 |
|
|
/* DESCRIPTION */ |
47 |
|
|
/* */ |
48 |
|
|
/* This service sets the slider value. */ |
49 |
|
|
/* */ |
50 |
|
|
/* */ |
51 |
|
|
/* INPUT */ |
52 |
|
|
/* */ |
53 |
|
|
/* slider Slider widget control block */ |
54 |
|
|
/* info Pointer to slider info */ |
55 |
|
|
/* new_value New slider value */ |
56 |
|
|
/* */ |
57 |
|
|
/* OUTPUT */ |
58 |
|
|
/* */ |
59 |
|
|
/* status Completion status */ |
60 |
|
|
/* */ |
61 |
|
|
/* CALLS */ |
62 |
|
|
/* */ |
63 |
|
|
/* _gx_slider_needle_position_get Get the slider needle */ |
64 |
|
|
/* position */ |
65 |
|
|
/* _gx_utility_rectangle_combine Combine the first and second */ |
66 |
|
|
/* rectangle into the first */ |
67 |
|
|
/* rectangle */ |
68 |
|
|
/* _gx_system_dirty_partial_add Mark the partial area of this */ |
69 |
|
|
/* widget as dirty */ |
70 |
|
|
/* _gx_widget_event_generate Generate an event and send it */ |
71 |
|
|
/* to the parent widget */ |
72 |
|
|
/* */ |
73 |
|
|
/* CALLED BY */ |
74 |
|
|
/* */ |
75 |
|
|
/* Application Code */ |
76 |
|
|
/* GUIX Internal Code */ |
77 |
|
|
/* */ |
78 |
|
|
/**************************************************************************/ |
79 |
|
11201 |
UINT _gx_slider_value_set(GX_SLIDER *slider, GX_SLIDER_INFO *info, INT new_value) |
80 |
|
|
{ |
81 |
|
|
GX_RECTANGLE oldpos; |
82 |
|
|
GX_RECTANGLE newpos; |
83 |
|
|
|
84 |
✓✓ |
11201 |
if (new_value != info -> gx_slider_info_current_val) |
85 |
|
|
{ |
86 |
|
|
/* get the old need position */ |
87 |
|
9798 |
_gx_slider_needle_position_get(slider, info, &oldpos); |
88 |
|
|
|
89 |
|
|
/* assign slider value */ |
90 |
|
9798 |
info -> gx_slider_info_current_val = new_value; |
91 |
|
|
|
92 |
|
|
/* get the new needle position */ |
93 |
|
|
|
94 |
|
9798 |
_gx_slider_needle_position_get(slider, info, &newpos); |
95 |
|
|
|
96 |
|
|
/* combine old and new needle positions */ |
97 |
|
9798 |
_gx_utility_rectangle_combine(&newpos, &oldpos); |
98 |
|
|
|
99 |
✓✓ |
9798 |
if (slider -> gx_widget_type == GX_TYPE_PIXELMAP_SLIDER) |
100 |
|
|
{ |
101 |
|
1064 |
newpos.gx_rectangle_left = slider -> gx_widget_size.gx_rectangle_left; |
102 |
|
1064 |
newpos.gx_rectangle_right = slider -> gx_widget_size.gx_rectangle_right; |
103 |
|
|
} |
104 |
|
|
|
105 |
|
|
/* mark as dirty so that I get redrawn */ |
106 |
|
9798 |
_gx_system_dirty_partial_add((GX_WIDGET *)slider, &newpos); |
107 |
|
|
|
108 |
|
|
/* notify my parent of my new value */ |
109 |
|
9798 |
_gx_widget_event_generate((GX_WIDGET *)slider, GX_EVENT_SLIDER_VALUE, new_value); |
110 |
|
|
} |
111 |
|
11201 |
return(GX_SUCCESS); |
112 |
|
|
} |
113 |
|
|
|