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 |
|
|
/** List Management (List) */ |
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_window.h" |
30 |
|
|
#include "gx_system.h" |
31 |
|
|
#include "gx_utility.h" |
32 |
|
|
|
33 |
|
|
/**************************************************************************/ |
34 |
|
|
/* */ |
35 |
|
|
/* FUNCTION RELEASE */ |
36 |
|
|
/* */ |
37 |
|
|
/* _gx_vertical_list_up_wrap PORTABLE C */ |
38 |
|
|
/* 6.1 */ |
39 |
|
|
/* AUTHOR */ |
40 |
|
|
/* */ |
41 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
42 |
|
|
/* */ |
43 |
|
|
/* DESCRIPTION */ |
44 |
|
|
/* */ |
45 |
|
|
/* This function scrolls up the vertical list. */ |
46 |
|
|
/* */ |
47 |
|
|
/* INPUT */ |
48 |
|
|
/* */ |
49 |
|
|
/* vertical_list Vertical list control block */ |
50 |
|
|
/* */ |
51 |
|
|
/* OUTPUT */ |
52 |
|
|
/* */ |
53 |
|
|
/* None */ |
54 |
|
|
/* */ |
55 |
|
|
/* CALLS */ |
56 |
|
|
/* */ |
57 |
|
|
/* _gx_first_client_child_get Get the first client child */ |
58 |
|
|
/* _gx_last_client_child_get Get the last client child */ |
59 |
|
|
/* _gx_utility_rectangle_shift Move a rectangle */ |
60 |
|
|
/* [gx_vertical_list_callback] Invoke the list callback */ |
61 |
|
|
/* routine */ |
62 |
|
|
/* _gx_widget_resize Resize a widget */ |
63 |
|
|
/* _gx_widget_attach Attach a widget to its parent */ |
64 |
|
|
/* */ |
65 |
|
|
/* CALLED BY */ |
66 |
|
|
/* */ |
67 |
|
|
/* _gx_vertical_list_scroll Vertical list scroll function */ |
68 |
|
|
/* */ |
69 |
|
|
/**************************************************************************/ |
70 |
|
500 |
VOID _gx_vertical_list_up_wrap(GX_VERTICAL_LIST *list) |
71 |
|
|
{ |
72 |
|
|
GX_WIDGET *test; |
73 |
|
|
GX_WIDGET *check; |
74 |
|
500 |
GX_BOOL moving = GX_TRUE; |
75 |
|
|
GX_RECTANGLE newpos; |
76 |
|
|
INT index; |
77 |
|
|
|
78 |
✓✓ |
1384 |
while (moving) |
79 |
|
|
{ |
80 |
|
884 |
moving = GX_FALSE; |
81 |
|
|
|
82 |
✓✓ |
884 |
if ((list -> gx_vertical_list_top_index + list -> gx_vertical_list_child_count < list -> gx_vertical_list_total_rows) || |
83 |
✓✓ |
151 |
(list -> gx_widget_style & GX_STYLE_WRAP)) |
84 |
|
|
{ |
85 |
|
|
/* scrolling up. See if my top widget is already above my |
86 |
|
|
client area: */ |
87 |
|
|
|
88 |
|
836 |
test = _gx_widget_first_client_child_get((GX_WIDGET *)list); |
89 |
✓✗ |
836 |
if (test) |
90 |
|
|
{ |
91 |
✓✓ |
836 |
if (test -> gx_widget_size.gx_rectangle_bottom < list -> gx_widget_size.gx_rectangle_top) |
92 |
|
|
{ |
93 |
|
|
/* top widget is above my client area, move it to the bottom: */ |
94 |
|
384 |
moving = GX_TRUE; |
95 |
|
384 |
check = _gx_widget_last_client_child_get((GX_WIDGET *)list); |
96 |
|
|
|
97 |
|
384 |
_gx_widget_detach(test); |
98 |
|
|
|
99 |
|
384 |
newpos = test -> gx_widget_size; |
100 |
|
384 |
_gx_utility_rectangle_shift(&newpos, 0, (GX_VALUE)(check -> gx_widget_size.gx_rectangle_bottom - newpos.gx_rectangle_top + 1)); |
101 |
|
384 |
_gx_widget_resize(test, &newpos); |
102 |
|
|
|
103 |
|
384 |
index = list -> gx_vertical_list_top_index + list -> gx_vertical_list_child_count; |
104 |
|
|
|
105 |
|
|
/* Wrap index. */ |
106 |
✓✓ |
384 |
if (index >= list -> gx_vertical_list_total_rows) |
107 |
|
|
{ |
108 |
|
73 |
index -= list -> gx_vertical_list_total_rows; |
109 |
|
|
} |
110 |
|
|
|
111 |
|
384 |
list -> gx_vertical_list_callback(list, test, index); |
112 |
✓✓ |
384 |
if (index == list -> gx_vertical_list_selected) |
113 |
|
|
{ |
114 |
|
13 |
test -> gx_widget_style |= GX_STYLE_DRAW_SELECTED; |
115 |
|
|
} |
116 |
|
|
else |
117 |
|
|
{ |
118 |
|
371 |
test -> gx_widget_style &= ~GX_STYLE_DRAW_SELECTED; |
119 |
|
|
} |
120 |
|
384 |
_gx_widget_attach((GX_WIDGET *)list, test); |
121 |
|
384 |
list -> gx_vertical_list_top_index++; |
122 |
|
|
|
123 |
|
|
/* Wrao page index. */ |
124 |
✓✓ |
384 |
if (list -> gx_vertical_list_top_index >= list -> gx_vertical_list_total_rows) |
125 |
|
|
{ |
126 |
|
2 |
list -> gx_vertical_list_top_index -= list -> gx_vertical_list_total_rows; |
127 |
|
|
} |
128 |
|
|
} |
129 |
|
|
} |
130 |
|
|
} |
131 |
|
|
} |
132 |
|
500 |
} |
133 |
|
|
|