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 |
|
|
/** Tree View Management (Menu) */ |
19 |
|
|
/** */ |
20 |
|
|
/**************************************************************************/ |
21 |
|
|
|
22 |
|
|
#define GX_SOURCE_CODE |
23 |
|
|
|
24 |
|
|
|
25 |
|
|
/* Include necessary system files. */ |
26 |
|
|
|
27 |
|
|
#include "gx_api.h" |
28 |
|
|
#include "gx_tree_view.h" |
29 |
|
|
|
30 |
|
|
/**************************************************************************/ |
31 |
|
|
/* */ |
32 |
|
|
/* FUNCTION RELEASE */ |
33 |
|
|
/* */ |
34 |
|
|
/* _gx_tree_view_scroll_info_get PORTABLE C */ |
35 |
|
|
/* 6.1 */ |
36 |
|
|
/* AUTHOR */ |
37 |
|
|
/* */ |
38 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
39 |
|
|
/* */ |
40 |
|
|
/* DESCRIPTION */ |
41 |
|
|
/* */ |
42 |
|
|
/* This function gets the tree view scroll information. */ |
43 |
|
|
/* */ |
44 |
|
|
/* INPUT */ |
45 |
|
|
/* */ |
46 |
|
|
/* tree Pointer to tree view control */ |
47 |
|
|
/* block */ |
48 |
|
|
/* type GX_SCROLLBAR_HORIZONTAL */ |
49 |
|
|
/* or GX_SCROLLBAR_VERTICAL */ |
50 |
|
|
/* info Pointer to destination for */ |
51 |
|
|
/* scroll info */ |
52 |
|
|
/* */ |
53 |
|
|
/* OUTPUT */ |
54 |
|
|
/* */ |
55 |
|
|
/* status Completion status */ |
56 |
|
|
/* */ |
57 |
|
|
/* CALLS */ |
58 |
|
|
/* */ |
59 |
|
|
/* _gx_tree_view_scroll Scroll tree view client area */ |
60 |
|
|
/* */ |
61 |
|
|
/* CALLED BY */ |
62 |
|
|
/* */ |
63 |
|
|
/* GUIX Internal Code */ |
64 |
|
|
/* */ |
65 |
|
|
/**************************************************************************/ |
66 |
|
280 |
UINT _gx_tree_view_scroll_info_get(GX_TREE_VIEW *tree, ULONG type, GX_SCROLL_INFO *info) |
67 |
|
|
{ |
68 |
|
|
GX_RECTANGLE *client; |
69 |
|
|
INT shift; |
70 |
|
|
INT value; |
71 |
|
|
|
72 |
|
280 |
client = &tree -> gx_window_client; |
73 |
|
|
|
74 |
✓✓ |
280 |
if (type & GX_SCROLLBAR_VERTICAL) |
75 |
|
|
{ |
76 |
|
119 |
info -> gx_scroll_minimum = client -> gx_rectangle_top; |
77 |
|
119 |
info -> gx_scroll_maximum = info -> gx_scroll_minimum + tree -> gx_tree_view_tree_height - 1; |
78 |
|
119 |
info -> gx_scroll_visible = (GX_VALUE)(client -> gx_rectangle_bottom - client -> gx_rectangle_top + 1); |
79 |
|
|
|
80 |
✓✓ |
119 |
if (tree -> gx_tree_view_tree_height < info -> gx_scroll_visible) |
81 |
|
|
{ |
82 |
|
106 |
info -> gx_scroll_maximum = info -> gx_scroll_minimum + info -> gx_scroll_visible - 1; |
83 |
|
|
} |
84 |
|
|
|
85 |
|
119 |
shift = tree -> gx_tree_view_y_shift; |
86 |
|
119 |
value = client -> gx_rectangle_top - shift; |
87 |
|
|
|
88 |
✓✓ |
119 |
if (value < info -> gx_scroll_minimum) |
89 |
|
|
{ |
90 |
|
1 |
value = info -> gx_scroll_minimum; |
91 |
|
|
} |
92 |
✓✓ |
118 |
else if (value > info -> gx_scroll_maximum - info -> gx_scroll_visible + 1) |
93 |
|
|
{ |
94 |
|
5 |
value = info -> gx_scroll_maximum - info -> gx_scroll_visible + 1; |
95 |
|
|
} |
96 |
|
|
|
97 |
|
119 |
shift = client -> gx_rectangle_top - value; |
98 |
|
|
|
99 |
✓✓ |
119 |
if (shift != tree -> gx_tree_view_y_shift) |
100 |
|
|
{ |
101 |
|
6 |
_gx_tree_view_scroll(tree, 0, (GX_VALUE)(shift - tree->gx_tree_view_y_shift)); |
102 |
|
|
} |
103 |
|
|
|
104 |
|
119 |
info -> gx_scroll_value = value; |
105 |
|
|
} |
106 |
|
|
else |
107 |
|
|
{ |
108 |
|
161 |
info -> gx_scroll_minimum = client -> gx_rectangle_left; |
109 |
|
161 |
info -> gx_scroll_maximum = info -> gx_scroll_minimum + tree -> gx_tree_view_tree_width - 1; |
110 |
|
161 |
info -> gx_scroll_visible = (GX_VALUE)(client -> gx_rectangle_right - client -> gx_rectangle_left + 1); |
111 |
|
|
|
112 |
✓✓ |
161 |
if (tree -> gx_tree_view_tree_width < info -> gx_scroll_visible) |
113 |
|
|
{ |
114 |
|
143 |
info -> gx_scroll_maximum = info -> gx_scroll_minimum + info -> gx_scroll_visible - 1; |
115 |
|
|
} |
116 |
|
|
|
117 |
|
161 |
shift = tree -> gx_tree_view_x_shift; |
118 |
|
161 |
value = client -> gx_rectangle_left - shift; |
119 |
|
|
|
120 |
✓✓ |
161 |
if (value < info -> gx_scroll_minimum) |
121 |
|
|
{ |
122 |
|
1 |
value = info -> gx_scroll_minimum; |
123 |
|
|
} |
124 |
✓✓ |
160 |
else if (value > info -> gx_scroll_maximum - info -> gx_scroll_visible + 1) |
125 |
|
|
{ |
126 |
|
1 |
value = info -> gx_scroll_maximum - info -> gx_scroll_visible + 1; |
127 |
|
|
} |
128 |
|
|
|
129 |
|
161 |
shift = client -> gx_rectangle_left - value; |
130 |
✓✓ |
161 |
if (shift != tree -> gx_tree_view_x_shift) |
131 |
|
|
{ |
132 |
|
2 |
_gx_tree_view_scroll(tree, (GX_VALUE)(shift - tree->gx_tree_view_x_shift), 0); |
133 |
|
|
} |
134 |
|
161 |
info -> gx_scroll_value = value; |
135 |
|
|
} |
136 |
|
|
|
137 |
|
280 |
info -> gx_scroll_increment = (GX_VALUE)(info -> gx_scroll_maximum - info -> gx_scroll_minimum) / 10; |
138 |
|
|
|
139 |
|
280 |
return(GX_SUCCESS); |
140 |
|
|
} |
141 |
|
|
|