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_button.h" |
30 |
|
|
#include "gx_slider.h" |
31 |
|
|
|
32 |
|
|
|
33 |
|
|
/**************************************************************************/ |
34 |
|
|
/* */ |
35 |
|
|
/* FUNCTION RELEASE */ |
36 |
|
|
/* */ |
37 |
|
|
/* _gx_slider_event_process PORTABLE C */ |
38 |
|
|
/* 6.1 */ |
39 |
|
|
/* AUTHOR */ |
40 |
|
|
/* */ |
41 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
42 |
|
|
/* */ |
43 |
|
|
/* DESCRIPTION */ |
44 |
|
|
/* */ |
45 |
|
|
/* This service processes a slider event. */ |
46 |
|
|
/* */ |
47 |
|
|
/* INPUT */ |
48 |
|
|
/* */ |
49 |
|
|
/* slider Slider widget control block */ |
50 |
|
|
/* event Pointer to event process */ |
51 |
|
|
/* */ |
52 |
|
|
/* OUTPUT */ |
53 |
|
|
/* */ |
54 |
|
|
/* status Completion status */ |
55 |
|
|
/* */ |
56 |
|
|
/* CALLS */ |
57 |
|
|
/* */ |
58 |
|
|
/* _gx_slider_value_calculate Calculate the slider value */ |
59 |
|
|
/* _gx_widget_event_process Default widget event process */ |
60 |
|
|
/* */ |
61 |
|
|
/* CALLED BY */ |
62 |
|
|
/* */ |
63 |
|
|
/* Application Code */ |
64 |
|
|
/* GUIX Internal Code */ |
65 |
|
|
/* */ |
66 |
|
|
/* RELEASE HISTORY */ |
67 |
|
|
/* */ |
68 |
|
|
/* DATE NAME DESCRIPTION */ |
69 |
|
|
/* */ |
70 |
|
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ |
71 |
|
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */ |
72 |
|
|
/* resulting in version 6.1 */ |
73 |
|
|
/* */ |
74 |
|
|
/**************************************************************************/ |
75 |
|
6620 |
UINT _gx_slider_event_process(GX_SLIDER *slider, GX_EVENT *event_ptr) |
76 |
|
|
{ |
77 |
|
|
UINT status; |
78 |
|
|
INT pos; |
79 |
|
|
|
80 |
|
|
/* Default status to success. */ |
81 |
|
6620 |
status = GX_SUCCESS; |
82 |
|
|
|
83 |
|
|
/* Process relative to the type of event. */ |
84 |
✓✓✓✓
|
6620 |
switch (event_ptr -> gx_event_type) |
85 |
|
|
{ |
86 |
|
1580 |
case GX_EVENT_PEN_DOWN: |
87 |
|
|
|
88 |
|
|
/* Set style for pen down. */ |
89 |
|
1580 |
slider -> gx_widget_style |= GX_STYLE_BUTTON_PUSHED; |
90 |
|
|
|
91 |
✓✓ |
1580 |
if (slider -> gx_widget_style & GX_STYLE_SLIDER_VERTICAL) |
92 |
|
|
{ |
93 |
|
362 |
pos = event_ptr -> gx_event_payload.gx_event_pointdata.gx_point_y; |
94 |
|
|
} |
95 |
|
|
else |
96 |
|
|
{ |
97 |
|
1218 |
pos = event_ptr -> gx_event_payload.gx_event_pointdata.gx_point_x; |
98 |
|
|
} |
99 |
|
|
|
100 |
|
1580 |
_gx_slider_value_calculate(slider, &slider -> gx_slider_info, pos); |
101 |
|
1580 |
break; |
102 |
|
|
|
103 |
|
44 |
case GX_EVENT_PEN_UP: |
104 |
|
|
|
105 |
|
|
/* Set style for pen down. */ |
106 |
|
44 |
slider -> gx_widget_style &= ~GX_STYLE_BUTTON_PUSHED; |
107 |
|
44 |
break; |
108 |
|
|
|
109 |
|
1417 |
case GX_EVENT_PEN_DRAG: |
110 |
|
|
/* move my needle */ |
111 |
✓✓ |
1417 |
if (slider -> gx_widget_style & GX_STYLE_BUTTON_PUSHED) |
112 |
|
|
{ |
113 |
✓✓ |
1416 |
if (slider -> gx_widget_style & GX_STYLE_SLIDER_VERTICAL) |
114 |
|
|
{ |
115 |
|
336 |
pos = event_ptr -> gx_event_payload.gx_event_pointdata.gx_point_y; |
116 |
|
|
} |
117 |
|
|
else |
118 |
|
|
{ |
119 |
|
1080 |
pos = event_ptr -> gx_event_payload.gx_event_pointdata.gx_point_x; |
120 |
|
|
} |
121 |
|
1416 |
_gx_slider_value_calculate(slider, &slider -> gx_slider_info, pos); |
122 |
|
|
} |
123 |
|
1417 |
break; |
124 |
|
|
|
125 |
|
3579 |
default: |
126 |
|
|
|
127 |
|
|
/* Call the widget default processing. */ |
128 |
|
3579 |
status = _gx_widget_event_process((GX_WIDGET *)slider, event_ptr); |
129 |
|
|
} |
130 |
|
|
|
131 |
|
|
/* Return completion status. */ |
132 |
|
6620 |
return(status); |
133 |
|
|
} |
134 |
|
|
|