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_scrollbar.h" |
32 |
|
|
|
33 |
|
|
/**************************************************************************/ |
34 |
|
|
/* */ |
35 |
|
|
/* FUNCTION RELEASE */ |
36 |
|
|
/* */ |
37 |
|
|
/* _gx_vertical_list_slide_back_check PORTABLE C */ |
38 |
|
|
/* 6.1 */ |
39 |
|
|
/* AUTHOR */ |
40 |
|
|
/* */ |
41 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
42 |
|
|
/* */ |
43 |
|
|
/* DESCRIPTION */ |
44 |
|
|
/* */ |
45 |
|
|
/* This function checks the sliding back of the scrollbar. */ |
46 |
|
|
/* */ |
47 |
|
|
/* INPUT */ |
48 |
|
|
/* */ |
49 |
|
|
/* vertical_list Vertical list widget control */ |
50 |
|
|
/* block */ |
51 |
|
|
/* */ |
52 |
|
|
/* OUTPUT */ |
53 |
|
|
/* */ |
54 |
|
|
/* None */ |
55 |
|
|
/* */ |
56 |
|
|
/* CALLS */ |
57 |
|
|
/* */ |
58 |
|
|
/* _gx_first_client_child_get Get the first child widget */ |
59 |
|
|
/* _gx_system_timer_start Allocate a free timer and */ |
60 |
|
|
/* activate it */ |
61 |
|
|
/* _gx_last_client_child_get Get the last client child */ |
62 |
|
|
/* */ |
63 |
|
|
/* CALLED BY */ |
64 |
|
|
/* */ |
65 |
|
|
/* Application Code */ |
66 |
|
|
/* */ |
67 |
|
|
/**************************************************************************/ |
68 |
|
143 |
VOID _gx_vertical_list_slide_back_check(GX_VERTICAL_LIST *list) |
69 |
|
|
{ |
70 |
|
|
GX_WIDGET *child; |
71 |
|
|
INT page_index; |
72 |
|
|
|
73 |
✓✓ |
143 |
if (list -> gx_vertical_list_child_count <= 0) |
74 |
|
|
{ |
75 |
|
1 |
return; |
76 |
|
|
} |
77 |
|
|
|
78 |
|
|
/* Calculate page index. */ |
79 |
|
142 |
page_index = list -> gx_vertical_list_top_index; |
80 |
|
|
|
81 |
|
142 |
child = _gx_widget_first_client_child_get((GX_WIDGET *)list); |
82 |
|
|
|
83 |
✓✓✓✓
|
495 |
while (child && (child -> gx_widget_size.gx_rectangle_top <= list -> gx_widget_size.gx_rectangle_top)) |
84 |
|
|
{ |
85 |
|
353 |
page_index++; |
86 |
|
353 |
child = _gx_widget_next_client_child_get(child); |
87 |
|
|
} |
88 |
|
|
|
89 |
|
142 |
list -> gx_vertical_list_snap_back_distance = 0; |
90 |
|
|
|
91 |
✓✓ |
142 |
if (page_index == 0) |
92 |
|
|
{ |
93 |
|
19 |
child = _gx_widget_first_client_child_get((GX_WIDGET *)list); |
94 |
✓✗✓✓
|
19 |
if (child && (child -> gx_widget_size.gx_rectangle_top > list -> gx_window_client.gx_rectangle_top)) |
95 |
|
|
{ |
96 |
|
13 |
list -> gx_vertical_list_snap_back_distance = (GX_VALUE)(list -> gx_window_client.gx_rectangle_top - |
97 |
|
13 |
child -> gx_widget_size.gx_rectangle_top); |
98 |
|
13 |
_gx_system_timer_start((GX_WIDGET *)list, GX_SNAP_TIMER, 1, 1); |
99 |
|
|
} |
100 |
|
|
} |
101 |
|
|
else |
102 |
|
|
{ |
103 |
✓✓ |
123 |
if (list -> gx_vertical_list_top_index + list -> gx_vertical_list_child_count >= list -> gx_vertical_list_total_rows - 1) |
104 |
|
|
{ |
105 |
|
53 |
child = _gx_widget_last_client_child_get((GX_WIDGET *)list); |
106 |
✓✗✓✓
|
53 |
if (child && (child -> gx_widget_size.gx_rectangle_bottom < list -> gx_window_client.gx_rectangle_bottom)) |
107 |
|
|
{ |
108 |
|
8 |
list -> gx_vertical_list_snap_back_distance = (GX_VALUE)(list -> gx_window_client.gx_rectangle_bottom - |
109 |
|
8 |
child -> gx_widget_size.gx_rectangle_bottom); |
110 |
|
8 |
_gx_system_timer_start((GX_WIDGET *)list, GX_SNAP_TIMER, 1, 1); |
111 |
|
|
} |
112 |
|
|
} |
113 |
|
|
} |
114 |
|
|
} |
115 |
|
|
|