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 |
|
|
/** Scroll Wheel Management (Generic Scroll Wheel) */ |
19 |
|
|
/** */ |
20 |
|
|
/**************************************************************************/ |
21 |
|
|
|
22 |
|
|
#define GX_SOURCE_CODE |
23 |
|
|
|
24 |
|
|
|
25 |
|
|
/* Include necessary system files. */ |
26 |
|
|
|
27 |
|
|
#include "gx_api.h" |
28 |
|
|
#include "gx_widget.h" |
29 |
|
|
#include "gx_utility.h" |
30 |
|
|
#include "gx_scroll_wheel.h" |
31 |
|
|
|
32 |
|
|
/**************************************************************************/ |
33 |
|
|
/* */ |
34 |
|
|
/* FUNCTION RELEASE */ |
35 |
|
|
/* */ |
36 |
|
|
/* _gx_generic_scroll_wheel_down_wrap PORTABLE C */ |
37 |
|
|
/* 6.1.7 */ |
38 |
|
|
/* AUTHOR */ |
39 |
|
|
/* */ |
40 |
|
|
/* Ting Zhu, Microsoft Corporation */ |
41 |
|
|
/* */ |
42 |
|
|
/* DESCRIPTION */ |
43 |
|
|
/* */ |
44 |
|
|
/* This function scrolls down the generic scroll wheel. */ |
45 |
|
|
/* */ |
46 |
|
|
/* INPUT */ |
47 |
|
|
/* */ |
48 |
|
|
/* wheel Generic scroll wheel control */ |
49 |
|
|
/* block */ |
50 |
|
|
/* */ |
51 |
|
|
/* OUTPUT */ |
52 |
|
|
/* */ |
53 |
|
|
/* None */ |
54 |
|
|
/* */ |
55 |
|
|
/* CALLS */ |
56 |
|
|
/* */ |
57 |
|
|
/* _gx_widget_first_visible_client_child_get */ |
58 |
|
|
/* Get the first visible client */ |
59 |
|
|
/* _gx_widget_last_visible_client_child_get */ |
60 |
|
|
/* Get the last visible client */ |
61 |
|
|
/* _gx_widget_detach Detach a widget from its */ |
62 |
|
|
/* parent */ |
63 |
|
|
/* _gx_utility_rectangle_shift Shift a rectangle */ |
64 |
|
|
/* _gx_widget_resize Resize a widget */ |
65 |
|
|
/* _gx_widget_back_attach Attach a widget to its parent */ |
66 |
|
|
/* [gx_generic_scroll_wheel_callback] Callback to create row item */ |
67 |
|
|
/* */ |
68 |
|
|
/* CALLED BY */ |
69 |
|
|
/* */ |
70 |
|
|
/* _gx_generic_scroll_wheel_scroll Generic scroll wheel scroll */ |
71 |
|
|
/* function */ |
72 |
|
|
/* */ |
73 |
|
|
/**************************************************************************/ |
74 |
|
85 |
VOID _gx_generic_scroll_wheel_down_wrap(GX_GENERIC_SCROLL_WHEEL *wheel) |
75 |
|
|
{ |
76 |
|
|
GX_WIDGET *test; |
77 |
|
|
GX_WIDGET *check; |
78 |
|
|
GX_RECTANGLE newpos; |
79 |
|
|
|
80 |
✓✓ |
134 |
while ((wheel -> gx_generic_scroll_wheel_top_index > 0) || |
81 |
✓✓ |
36 |
(wheel -> gx_widget_style & GX_STYLE_WRAP)) |
82 |
|
|
{ |
83 |
|
|
/* Scrolling down, see if my bottom widget can be moved to the top. */ |
84 |
|
110 |
test = _gx_widget_last_visible_client_child_get((GX_WIDGET *)wheel); |
85 |
|
|
|
86 |
✓✓✓✓
|
110 |
if (test && (test -> gx_widget_size.gx_rectangle_top > wheel -> gx_widget_size.gx_rectangle_bottom)) |
87 |
|
|
{ |
88 |
|
|
|
89 |
|
|
/* Bottom widget is below my client area, move it to the top. */ |
90 |
|
50 |
wheel -> gx_generic_scroll_wheel_top_index--; |
91 |
|
|
|
92 |
|
|
/* Wrap index. */ |
93 |
✓✓ |
50 |
if (wheel -> gx_generic_scroll_wheel_top_index < 0) |
94 |
|
|
{ |
95 |
|
9 |
wheel -> gx_generic_scroll_wheel_top_index = wheel -> gx_scroll_wheel_total_rows - 1; |
96 |
|
|
} |
97 |
|
|
|
98 |
|
50 |
check = _gx_widget_first_visible_client_child_get((GX_WIDGET *)wheel); |
99 |
|
|
|
100 |
✓✓ |
50 |
if (check) |
101 |
|
|
{ |
102 |
|
49 |
_gx_widget_detach(test); |
103 |
|
49 |
newpos = test -> gx_widget_size; |
104 |
|
49 |
_gx_utility_rectangle_shift(&newpos, 0, (GX_VALUE)(-(newpos.gx_rectangle_bottom - check -> gx_widget_size.gx_rectangle_top + 1))); |
105 |
|
49 |
_gx_widget_resize(test, &newpos); |
106 |
|
|
|
107 |
|
49 |
wheel -> gx_generic_scroll_wheel_callback(wheel, test, wheel -> gx_generic_scroll_wheel_top_index); |
108 |
|
49 |
_gx_widget_back_attach((GX_WIDGET *)wheel, test); |
109 |
|
|
} |
110 |
|
|
else |
111 |
|
|
{ |
112 |
|
1 |
break; |
113 |
|
|
} |
114 |
|
|
} |
115 |
|
|
else |
116 |
|
|
{ |
117 |
|
|
break; |
118 |
|
|
} |
119 |
|
|
} |
120 |
|
85 |
} |
121 |
|
|
|