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 |
|
|
/** Horizontal List (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_horizontal_list_right_wrap PORTABLE C */ |
38 |
|
|
/* 6.1 */ |
39 |
|
|
/* AUTHOR */ |
40 |
|
|
/* */ |
41 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
42 |
|
|
/* */ |
43 |
|
|
/* DESCRIPTION */ |
44 |
|
|
/* */ |
45 |
|
|
/* This function scrolls down the horizontal list. */ |
46 |
|
|
/* */ |
47 |
|
|
/* INPUT */ |
48 |
|
|
/* */ |
49 |
|
|
/* list horizontal list widget control*/ |
50 |
|
|
/* block */ |
51 |
|
|
/* */ |
52 |
|
|
/* OUTPUT */ |
53 |
|
|
/* */ |
54 |
|
|
/* None */ |
55 |
|
|
/* */ |
56 |
|
|
/* CALLS */ |
57 |
|
|
/* */ |
58 |
|
|
/* _gx_last_client_child_get Get the last client child */ |
59 |
|
|
/* _gx_first_client_child_get Get the first client child */ |
60 |
|
|
/* _gx_widget_back_attach Attach a widget to the back */ |
61 |
|
|
/* _gx_widget_shift Relocate a widget */ |
62 |
|
|
/* [gx_horizontal_list_callback] Horizontal list callback */ |
63 |
|
|
/* */ |
64 |
|
|
/* CALLED BY */ |
65 |
|
|
/* */ |
66 |
|
|
/* _gx_horizontal_list_scroll */ |
67 |
|
|
/* */ |
68 |
|
|
/**************************************************************************/ |
69 |
|
167 |
VOID _gx_horizontal_list_right_wrap(GX_HORIZONTAL_LIST *list) |
70 |
|
|
{ |
71 |
|
|
GX_WIDGET *test; |
72 |
|
|
GX_WIDGET *check; |
73 |
|
167 |
GX_BOOL moving = GX_TRUE; |
74 |
|
|
GX_RECTANGLE newpos; |
75 |
|
|
|
76 |
✓✓ |
575 |
while (moving) |
77 |
|
|
{ |
78 |
|
409 |
moving = GX_FALSE; |
79 |
|
|
|
80 |
✓✓ |
409 |
if ((list -> gx_horizontal_list_top_index > 0) || |
81 |
✓✓ |
53 |
(list -> gx_widget_style & GX_STYLE_WRAP)) |
82 |
|
|
{ |
83 |
|
|
/* scrolling down, see if my bottom widget can be moved to the top: */ |
84 |
|
366 |
test = _gx_widget_last_client_child_get((GX_WIDGET *)list); |
85 |
|
|
|
86 |
✓✗ |
366 |
if (test) |
87 |
|
|
{ |
88 |
✓✓ |
366 |
if (test -> gx_widget_size.gx_rectangle_left > list -> gx_widget_size.gx_rectangle_right) |
89 |
|
|
{ |
90 |
|
|
/* right widget is to the right of my client area, move it to the top: */ |
91 |
|
243 |
moving = GX_TRUE; |
92 |
|
243 |
list -> gx_horizontal_list_top_index--; |
93 |
|
|
|
94 |
|
|
/* Wrap index. */ |
95 |
✓✓ |
243 |
if (list -> gx_horizontal_list_top_index < 0) |
96 |
|
|
{ |
97 |
|
9 |
list -> gx_horizontal_list_top_index = list -> gx_horizontal_list_total_columns - 1; |
98 |
|
|
} |
99 |
|
|
|
100 |
|
243 |
check = _gx_widget_first_client_child_get((GX_WIDGET *)list); |
101 |
|
|
|
102 |
✓✓ |
243 |
if (check) |
103 |
|
|
{ |
104 |
|
242 |
_gx_widget_detach(test); |
105 |
|
242 |
newpos = test -> gx_widget_size; |
106 |
|
242 |
_gx_utility_rectangle_shift(&newpos, |
107 |
|
242 |
(GX_VALUE)(-(newpos.gx_rectangle_right - |
108 |
|
242 |
check -> gx_widget_size.gx_rectangle_left + 1)), 0); |
109 |
|
242 |
_gx_widget_resize(test, &newpos); |
110 |
|
|
|
111 |
|
242 |
list -> gx_horizontal_list_callback(list, test, list -> gx_horizontal_list_top_index); |
112 |
✓✓ |
242 |
if (list -> gx_horizontal_list_selected == list -> gx_horizontal_list_top_index) |
113 |
|
|
{ |
114 |
|
11 |
test -> gx_widget_style |= GX_STYLE_DRAW_SELECTED; |
115 |
|
|
} |
116 |
|
|
else |
117 |
|
|
{ |
118 |
|
231 |
test -> gx_widget_style &= ~GX_STYLE_DRAW_SELECTED; |
119 |
|
|
} |
120 |
|
242 |
_gx_widget_back_attach((GX_WIDGET *)list, test); |
121 |
|
|
} |
122 |
|
|
else |
123 |
|
|
{ |
124 |
|
1 |
break; |
125 |
|
|
} |
126 |
|
|
} |
127 |
|
|
} |
128 |
|
|
} |
129 |
|
|
} |
130 |
|
167 |
} |
131 |
|
|
|