1 |
|
|
/*************************************************************************** |
2 |
|
|
* Copyright (c) 2024 Microsoft Corporation |
3 |
|
|
* |
4 |
|
|
* This program and the accompanying materials are made available under the |
5 |
|
|
* terms of the MIT License which is available at |
6 |
|
|
* https://opensource.org/licenses/MIT. |
7 |
|
|
* |
8 |
|
|
* SPDX-License-Identifier: MIT |
9 |
|
|
**************************************************************************/ |
10 |
|
|
|
11 |
|
|
|
12 |
|
|
/**************************************************************************/ |
13 |
|
|
/**************************************************************************/ |
14 |
|
|
/** */ |
15 |
|
|
/** GUIX Component */ |
16 |
|
|
/** */ |
17 |
|
|
/** Window Management (Window) */ |
18 |
|
|
/** */ |
19 |
|
|
/**************************************************************************/ |
20 |
|
|
|
21 |
|
|
#define GX_SOURCE_CODE |
22 |
|
|
|
23 |
|
|
|
24 |
|
|
/* Include necessary system files. */ |
25 |
|
|
|
26 |
|
|
#include "gx_api.h" |
27 |
|
|
#include "gx_widget.h" |
28 |
|
|
#include "gx_window.h" |
29 |
|
|
#include "gx_system.h" |
30 |
|
|
#include "gx_display.h" |
31 |
|
|
#include "gx_canvas.h" |
32 |
|
|
#include "gx_utility.h" |
33 |
|
|
#include "gx_scrollbar.h" |
34 |
|
|
|
35 |
|
|
/**************************************************************************/ |
36 |
|
|
/* */ |
37 |
|
|
/* FUNCTION RELEASE */ |
38 |
|
|
/* */ |
39 |
|
|
/* _gx_window_scroll PORTABLE C */ |
40 |
|
|
/* 6.1 */ |
41 |
|
|
/* AUTHOR */ |
42 |
|
|
/* */ |
43 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
44 |
|
|
/* */ |
45 |
|
|
/* DESCRIPTION */ |
46 |
|
|
/* */ |
47 |
|
|
/* This service scrolls the window client area by the specified amount */ |
48 |
|
|
/* */ |
49 |
|
|
/* */ |
50 |
|
|
/* INPUT */ |
51 |
|
|
/* */ |
52 |
|
|
/* window Pointer to window */ |
53 |
|
|
/* x_scroll Amount to scroll on x-axis */ |
54 |
|
|
/* y_scroll Amount to scroll on y-axis */ |
55 |
|
|
/* */ |
56 |
|
|
/* OUTPUT */ |
57 |
|
|
/* */ |
58 |
|
|
/* status Completion status */ |
59 |
|
|
/* */ |
60 |
|
|
/* CALLS */ |
61 |
|
|
/* */ |
62 |
|
|
/* _gx_widget_scroll_shift Widget scroll shift */ |
63 |
|
|
/* _gx_widget_block_move Widget block move */ |
64 |
|
|
/* */ |
65 |
|
|
/* CALLED BY */ |
66 |
|
|
/* */ |
67 |
|
|
/* Application Code */ |
68 |
|
|
/* */ |
69 |
|
|
/* RELEASE HISTORY */ |
70 |
|
|
/* */ |
71 |
|
|
/* DATE NAME DESCRIPTION */ |
72 |
|
|
/* */ |
73 |
|
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ |
74 |
|
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */ |
75 |
|
|
/* resulting in version 6.1 */ |
76 |
|
|
/* */ |
77 |
|
|
/**************************************************************************/ |
78 |
|
1627 |
UINT _gx_window_scroll(GX_WINDOW *window, GX_VALUE x_scroll, GX_VALUE y_scroll) |
79 |
|
|
{ |
80 |
|
1627 |
GX_WIDGET *child = window -> gx_widget_first_child; |
81 |
|
1627 |
GX_BOOL has_transparent_nonclient_children = GX_FALSE; |
82 |
|
|
|
83 |
|
|
/* if this window is not visible than nothing to do */ |
84 |
|
|
|
85 |
✓✓ |
1627 |
if (!(window -> gx_widget_status & GX_STATUS_VISIBLE)) |
86 |
|
|
{ |
87 |
|
12 |
return(GX_SUCCESS); |
88 |
|
|
} |
89 |
|
|
|
90 |
|
|
/* test to determine if transparent non-client children exist */ |
91 |
|
|
|
92 |
✓✓ |
6428 |
while (child) |
93 |
|
|
{ |
94 |
✓✓ |
4842 |
if (child -> gx_widget_status & GX_STATUS_NONCLIENT) |
95 |
|
|
{ |
96 |
✓✓ |
3228 |
if (child -> gx_widget_style & GX_STYLE_TRANSPARENT) |
97 |
|
|
{ |
98 |
|
29 |
has_transparent_nonclient_children = GX_TRUE; |
99 |
|
29 |
break; |
100 |
|
|
} |
101 |
|
|
} |
102 |
|
4813 |
child = child -> gx_widget_next; |
103 |
|
|
} |
104 |
|
|
|
105 |
|
|
/* reset to first child */ |
106 |
|
1615 |
child = window -> gx_widget_first_child; |
107 |
|
|
|
108 |
✓✓ |
6457 |
while (child) |
109 |
|
|
{ |
110 |
✓✓ |
4842 |
if (!(child -> gx_widget_status & GX_STATUS_NONCLIENT)) |
111 |
|
|
{ |
112 |
|
1614 |
_gx_widget_scroll_shift(child, x_scroll, y_scroll, GX_TRUE); |
113 |
|
|
} |
114 |
|
4842 |
child = child -> gx_widget_next; |
115 |
|
|
} |
116 |
|
|
|
117 |
✓✓ |
1615 |
if (has_transparent_nonclient_children) |
118 |
|
|
{ |
119 |
|
|
/* In this case we cannot use block-move. Just shift all child widgets */ |
120 |
|
29 |
_gx_system_dirty_partial_add((GX_WIDGET *)window, &window -> gx_window_client); |
121 |
|
|
} |
122 |
|
|
else |
123 |
|
|
{ |
124 |
|
|
/* here if we can do faster scrolling using block-move function */ |
125 |
|
1586 |
_gx_widget_block_move((GX_WIDGET *)window, &window -> gx_window_client, x_scroll, y_scroll); |
126 |
|
|
} |
127 |
|
|
|
128 |
|
1615 |
return(GX_SUCCESS); |
129 |
|
|
} |
130 |
|
|
|