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 |
|
|
/** Scroll Wheel Management (Generic Scroll Wheel) */ |
18 |
|
|
/** */ |
19 |
|
|
/**************************************************************************/ |
20 |
|
|
|
21 |
|
|
#define GX_SOURCE_CODE |
22 |
|
|
|
23 |
|
|
|
24 |
|
|
/* Include necessary system files. */ |
25 |
|
|
|
26 |
|
|
#include "gx_api.h" |
27 |
|
|
#include "gx_window.h" |
28 |
|
|
#include "gx_scroll_wheel.h" |
29 |
|
|
#include "gx_widget.h" |
30 |
|
|
|
31 |
|
|
/**************************************************************************/ |
32 |
|
|
/* */ |
33 |
|
|
/* FUNCTION RELEASE */ |
34 |
|
|
/* */ |
35 |
|
|
/* _gx_generic_scroll_wheel_create PORTABLE C */ |
36 |
|
|
/* 6.1.7 */ |
37 |
|
|
/* AUTHOR */ |
38 |
|
|
/* */ |
39 |
|
|
/* Ting Zhu, Microsoft Corporation */ |
40 |
|
|
/* */ |
41 |
|
|
/* DESCRIPTION */ |
42 |
|
|
/* */ |
43 |
|
|
/* This function creates a generic 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 |
|
|
/* callback Callback function to create a */ |
52 |
|
|
/* widget row */ |
53 |
|
|
/* style Style of widget */ |
54 |
|
|
/* id Application-defined ID of the */ |
55 |
|
|
/* the widget */ |
56 |
|
|
/* size Widget size */ |
57 |
|
|
/* */ |
58 |
|
|
/* OUTPUT */ |
59 |
|
|
/* */ |
60 |
|
|
/* status Completion status */ |
61 |
|
|
/* */ |
62 |
|
|
/* CALLS */ |
63 |
|
|
/* */ |
64 |
|
|
/* _gx_scroll_wheel_create Create a scroll wheel widget */ |
65 |
|
|
/* _gx_widget_link Link a widget to its parent */ |
66 |
|
|
/* */ |
67 |
|
|
/* CALLED BY */ |
68 |
|
|
/* */ |
69 |
|
|
/* Application Code */ |
70 |
|
|
/* GUIX Internal Code */ |
71 |
|
|
/* */ |
72 |
|
|
/* RELEASE HISTORY */ |
73 |
|
|
/* */ |
74 |
|
|
/* DATE NAME DESCRIPTION */ |
75 |
|
|
/* */ |
76 |
|
|
/* 06-02-2021 Ting Zhu Initial Version 6.1.7 */ |
77 |
|
|
/* */ |
78 |
|
|
/**************************************************************************/ |
79 |
|
|
|
80 |
|
10 |
UINT _gx_generic_scroll_wheel_create(GX_GENERIC_SCROLL_WHEEL *wheel, |
81 |
|
|
GX_CONST GX_CHAR *name, |
82 |
|
|
GX_WIDGET *parent, |
83 |
|
|
INT total_rows, |
84 |
|
|
VOID (*callback)(GX_GENERIC_SCROLL_WHEEL *, GX_WIDGET *, INT), |
85 |
|
|
ULONG style, |
86 |
|
|
USHORT id, |
87 |
|
|
GX_CONST GX_RECTANGLE *size) |
88 |
|
|
{ |
89 |
|
|
|
90 |
|
|
/* Call default widget create. */ |
91 |
|
10 |
_gx_scroll_wheel_create((GX_SCROLL_WHEEL *)wheel, name, parent, total_rows, style, id, size); |
92 |
|
|
|
93 |
|
10 |
wheel -> gx_widget_type = GX_TYPE_GENERIC_SCROLL_WHEEL; |
94 |
|
10 |
wheel -> gx_generic_scroll_wheel_top_index = 0; |
95 |
|
10 |
wheel -> gx_generic_scroll_wheel_callback = callback; |
96 |
|
10 |
wheel -> gx_generic_scroll_wheel_child_count = 0; |
97 |
|
10 |
wheel -> gx_generic_scroll_wheel_visible_rows = 0; |
98 |
|
10 |
wheel -> gx_widget_event_process_function = (UINT (*)(GX_WIDGET *, GX_EVENT *))_gx_generic_scroll_wheel_event_process; |
99 |
|
10 |
wheel -> gx_widget_draw_function = (VOID (*)(GX_WIDGET *))_gx_generic_scroll_wheel_draw; |
100 |
|
10 |
wheel -> gx_scroll_wheel_scroll = (UINT(*)(GX_SCROLL_WHEEL*, GX_VALUE))_gx_generic_scroll_wheel_scroll; |
101 |
|
10 |
wheel -> gx_scroll_wheel_wrap_style_check = (GX_BOOL(*)(GX_SCROLL_WHEEL*))_gx_generic_scroll_wheel_wrap_style_check; |
102 |
|
|
|
103 |
|
|
/* Determine if a parent widget was provided. */ |
104 |
✓✓ |
10 |
if (parent) |
105 |
|
|
{ |
106 |
|
9 |
_gx_widget_link((GX_WIDGET *)parent, (GX_WIDGET *)wheel); |
107 |
|
|
} |
108 |
|
|
|
109 |
|
10 |
return GX_SUCCESS; |
110 |
|
|
} |
111 |
|
|
|