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 |
|
|
/** Scroll Wheel Management (Scroll Wheel) */ |
19 |
|
|
/** */ |
20 |
|
|
/**************************************************************************/ |
21 |
|
|
|
22 |
|
|
#define GX_SOURCE_CODE |
23 |
|
|
|
24 |
|
|
|
25 |
|
|
/* Include necessary system files. */ |
26 |
|
|
|
27 |
|
|
#include "gx_api.h" |
28 |
|
|
#include "gx_scroll_wheel.h" |
29 |
|
|
#include "gx_system.h" |
30 |
|
|
#include "gx_utility.h" |
31 |
|
|
#include "gx_widget.h" |
32 |
|
|
|
33 |
|
|
/**************************************************************************/ |
34 |
|
|
/* */ |
35 |
|
|
/* FUNCTION RELEASE */ |
36 |
|
|
/* */ |
37 |
|
|
/* _gx_scroll_wheel_gradient_create PORTABLE C */ |
38 |
|
|
/* 6.1.5 */ |
39 |
|
|
/* AUTHOR */ |
40 |
|
|
/* */ |
41 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
42 |
|
|
/* */ |
43 |
|
|
/* DESCRIPTION */ |
44 |
|
|
/* */ |
45 |
|
|
/* Create the gradient pixelmap used to overlay the scroll wheel */ |
46 |
|
|
/* widget drawing. */ |
47 |
|
|
/* */ |
48 |
|
|
/* INPUT */ |
49 |
|
|
/* */ |
50 |
|
|
/* wheel Scroll wheel control block */ |
51 |
|
|
/* */ |
52 |
|
|
/* OUTPUT */ |
53 |
|
|
/* */ |
54 |
|
|
/* status Completion status */ |
55 |
|
|
/* */ |
56 |
|
|
/* CALLS */ |
57 |
|
|
/* */ |
58 |
|
|
/* _gx_utility_gradient_create Create a gradient pixelmap */ |
59 |
|
|
/* _gx_utility_gradient_delete Delete a gradient */ |
60 |
|
|
/* */ |
61 |
|
|
/* CALLED BY */ |
62 |
|
|
/* */ |
63 |
|
|
/* GUIX Internal Code */ |
64 |
|
|
/* */ |
65 |
|
|
/**************************************************************************/ |
66 |
|
191 |
VOID _gx_scroll_wheel_gradient_create(GX_SCROLL_WHEEL *wheel) |
67 |
|
|
{ |
68 |
|
|
GX_UBYTE gradient_mode; |
69 |
|
|
INT height; |
70 |
|
|
GX_CANVAS *canvas; |
71 |
|
|
GX_DISPLAY *display; |
72 |
|
|
|
73 |
|
|
/* test to see if the scroll wheel has an alpha-mask overlay */ |
74 |
✓✓ |
191 |
if (wheel -> gx_scroll_wheel_gradient.gx_gradient_alpha_start || |
75 |
✓✓ |
13 |
wheel -> gx_scroll_wheel_gradient.gx_gradient_alpha_end) |
76 |
|
|
{ |
77 |
|
|
/* yes, test to see if it has been created */ |
78 |
✓✓ |
179 |
if (wheel -> gx_scroll_wheel_gradient.gx_gradient_pixelmap.gx_pixelmap_data == GX_NULL) |
79 |
|
|
{ |
80 |
|
155 |
_gx_widget_canvas_get((GX_WIDGET *)wheel, &canvas); |
81 |
|
|
|
82 |
✓✓ |
155 |
if (canvas) |
83 |
|
|
{ |
84 |
|
154 |
display = canvas -> gx_canvas_display; |
85 |
|
154 |
gradient_mode = GX_GRADIENT_TYPE_MIRROR | GX_GRADIENT_TYPE_ALPHA; |
86 |
|
154 |
height = wheel -> gx_widget_size.gx_rectangle_bottom - wheel -> gx_widget_size.gx_rectangle_top + 1; |
87 |
|
|
|
88 |
✓✓ |
154 |
if (display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_NONE || |
89 |
✓✓ |
72 |
display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_FLIP) |
90 |
|
|
{ |
91 |
|
85 |
_gx_utility_gradient_create(&wheel -> gx_scroll_wheel_gradient, 3, (GX_VALUE)height, |
92 |
|
|
gradient_mode | GX_GRADIENT_TYPE_VERTICAL, |
93 |
|
85 |
wheel -> gx_scroll_wheel_gradient.gx_gradient_alpha_start, |
94 |
|
85 |
wheel -> gx_scroll_wheel_gradient.gx_gradient_alpha_end); |
95 |
|
|
} |
96 |
|
|
else |
97 |
|
|
{ |
98 |
|
|
/* Generate rotated gradient map. */ |
99 |
|
69 |
_gx_utility_gradient_create(&wheel -> gx_scroll_wheel_gradient, (GX_VALUE)height, 3, |
100 |
|
|
gradient_mode, |
101 |
|
69 |
wheel -> gx_scroll_wheel_gradient.gx_gradient_alpha_start, |
102 |
|
69 |
wheel -> gx_scroll_wheel_gradient.gx_gradient_alpha_end); |
103 |
|
|
|
104 |
|
69 |
GX_SWAP_VALS(wheel -> gx_scroll_wheel_gradient.gx_gradient_pixelmap.gx_pixelmap_width, |
105 |
|
|
wheel -> gx_scroll_wheel_gradient.gx_gradient_pixelmap.gx_pixelmap_height); |
106 |
|
|
} |
107 |
|
|
} |
108 |
|
|
} |
109 |
|
|
} |
110 |
|
|
else |
111 |
|
|
{ |
112 |
|
|
/* gradient is not used, if it has been created then delete it */ |
113 |
|
12 |
_gx_utility_gradient_delete(&wheel -> gx_scroll_wheel_gradient); |
114 |
|
|
} |
115 |
|
191 |
} |
116 |
|
|
|