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_window.h" |
29 |
|
|
#include "gx_scroll_wheel.h" |
30 |
|
|
|
31 |
|
|
/**************************************************************************/ |
32 |
|
|
/* */ |
33 |
|
|
/* FUNCTION RELEASE */ |
34 |
|
|
/* */ |
35 |
|
|
/* _gx_scroll_wheel_create PORTABLE C */ |
36 |
|
|
/* 6.1.7 */ |
37 |
|
|
/* AUTHOR */ |
38 |
|
|
/* */ |
39 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
40 |
|
|
/* */ |
41 |
|
|
/* DESCRIPTION */ |
42 |
|
|
/* */ |
43 |
|
|
/* This function creates a scroll wheel selector widget. */ |
44 |
|
|
/* */ |
45 |
|
|
/* INPUT */ |
46 |
|
|
/* */ |
47 |
|
|
/* wheel Scroll wheel control block */ |
48 |
|
|
/* name Name of widget */ |
49 |
|
|
/* parent Parent widget control block */ |
50 |
|
|
/* total_rows Total rows of the scroll wheel*/ |
51 |
|
|
/* style Style of widget */ |
52 |
|
|
/* Id Application-defined ID of the */ |
53 |
|
|
/* the widget */ |
54 |
|
|
/* size Widget size */ |
55 |
|
|
/* */ |
56 |
|
|
/* OUTPUT */ |
57 |
|
|
/* */ |
58 |
|
|
/* status Completion status */ |
59 |
|
|
/* */ |
60 |
|
|
/* CALLS */ |
61 |
|
|
/* */ |
62 |
|
|
/* _gx_window_create Create a window */ |
63 |
|
|
/* */ |
64 |
|
|
/* CALLED BY */ |
65 |
|
|
/* */ |
66 |
|
|
/* Application Code */ |
67 |
|
|
/* GUIX Internal Code */ |
68 |
|
|
/* */ |
69 |
|
|
/**************************************************************************/ |
70 |
|
|
|
71 |
|
472 |
UINT _gx_scroll_wheel_create(GX_SCROLL_WHEEL *wheel, GX_CONST GX_CHAR *name, |
72 |
|
|
GX_WIDGET *parent, INT total_rows, |
73 |
|
|
ULONG style, USHORT Id, GX_CONST GX_RECTANGLE *size) |
74 |
|
|
{ |
75 |
|
|
|
76 |
|
|
GX_PARAMETER_NOT_USED(parent); |
77 |
|
|
|
78 |
|
472 |
_gx_window_create((GX_WINDOW *)wheel, name, GX_NULL, style, Id, size); |
79 |
|
|
|
80 |
|
472 |
wheel -> gx_widget_type = GX_TYPE_SCROLL_WHEEL; |
81 |
|
472 |
wheel -> gx_scroll_wheel_total_rows = total_rows; |
82 |
|
472 |
wheel -> gx_scroll_wheel_row_height = 30; |
83 |
|
|
|
84 |
|
472 |
memset(&wheel -> gx_scroll_wheel_gradient, 0, sizeof(GX_GRADIENT)); |
85 |
|
|
|
86 |
|
472 |
wheel -> gx_scroll_wheel_selected_row = 0; |
87 |
|
472 |
wheel -> gx_scroll_wheel_selected_yshift = 0; |
88 |
|
472 |
wheel -> gx_scroll_wheel_shift_error = 0; |
89 |
|
472 |
wheel -> gx_scroll_wheel_animation_speed = 0; |
90 |
|
472 |
wheel -> gx_scroll_wheel_animation_end_speed = 0; |
91 |
|
472 |
wheel -> gx_scroll_wheel_animation_steps = 0; |
92 |
|
472 |
wheel -> gx_scroll_wheel_animation_max_steps = 10; |
93 |
|
472 |
wheel -> gx_scroll_wheel_animation_delay = 2; |
94 |
|
472 |
wheel -> gx_scroll_wheel_animation_start_speed_rate = GX_FIXED_VAL_MAKE(1); |
95 |
|
472 |
wheel -> gx_scroll_wheel_animation_end_speed_rate = 200; |
96 |
|
472 |
wheel -> gx_scroll_wheel_selected_background = GX_NULL; |
97 |
|
472 |
wheel -> gx_widget_event_process_function = (UINT (*)(GX_WIDGET *, GX_EVENT *))_gx_scroll_wheel_event_process; |
98 |
|
472 |
wheel -> gx_scroll_wheel_scroll = _gx_scroll_wheel_scroll; |
99 |
|
472 |
wheel -> gx_scroll_wheel_wrap_style_check = _gx_scroll_wheel_wrap_style_check; |
100 |
|
|
|
101 |
|
472 |
return(GX_SUCCESS); |
102 |
|
|
} |
103 |
|
|
|