1 /**************************************************************************/
2 /* */
3 /* Copyright (c) Microsoft Corporation. All rights reserved. */
4 /* */
5 /* This software is licensed under the Microsoft Software License */
6 /* Terms for Microsoft Azure RTOS. Full text of the license can be */
7 /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
8 /* and in the root directory of this software. */
9 /* */
10 /**************************************************************************/
11
12
13 /**************************************************************************/
14 /**************************************************************************/
15 /** */
16 /** GUIX Component */
17 /** */
18 /** Numeric 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_widget.h"
29 #include "gx_scroll_wheel.h"
30
31 /**************************************************************************/
32 /* */
33 /* FUNCTION RELEASE */
34 /* */
35 /* _gx_numeric_scroll_wheel_create PORTABLE C */
36 /* 6.1.6 */
37 /* AUTHOR */
38 /* */
39 /* Kenneth Maxwell, Microsoft Corporation */
40 /* */
41 /* DESCRIPTION */
42 /* */
43 /* This function creates a numeric 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 /* start_val Start value of numeric range */
51 /* end_val End value of numeric range */
52 /* style Style of widget */
53 /* Id Application-defined ID of the */
54 /* the widget */
55 /* size Widget size */
56 /* */
57 /* OUTPUT */
58 /* */
59 /* status Completion status */
60 /* */
61 /* CALLS */
62 /* */
63 /* _gx_text_scroll_wheel_create Create a text scroll wheel */
64 /* _gx_widget_link Link a widget to parent */
65 /* */
66 /* CALLED BY */
67 /* */
68 /* Application Code */
69 /* */
70 /* RELEASE HISTORY */
71 /* */
72 /* DATE NAME DESCRIPTION */
73 /* */
74 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
75 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */
76 /* resulting in version 6.1 */
77 /* 04-02-2021 Kenneth Maxwell Modified comment(s), */
78 /* replace usage of abs(), */
79 /* resulting in version 6.1.6 */
80 /* */
81 /**************************************************************************/
_gx_numeric_scroll_wheel_create(GX_NUMERIC_SCROLL_WHEEL * wheel,GX_CONST GX_CHAR * name,GX_WIDGET * parent,INT start_val,INT end_val,ULONG style,USHORT Id,GX_CONST GX_RECTANGLE * size)82 UINT _gx_numeric_scroll_wheel_create(GX_NUMERIC_SCROLL_WHEEL *wheel,
83 GX_CONST GX_CHAR *name,
84 GX_WIDGET *parent, INT start_val, INT end_val,
85 ULONG style, USHORT Id, GX_CONST GX_RECTANGLE *size)
86 {
87
88 /* Call text scroll wheel create. */
89 _gx_text_scroll_wheel_create((GX_TEXT_SCROLL_WHEEL *)wheel, name, GX_NULL, GX_ABS(start_val - end_val) + 1, style, Id, size);
90
91 wheel -> gx_widget_type = GX_TYPE_NUMERIC_SCROLL_WHEEL;
92 wheel -> gx_numeric_scroll_wheel_start_val = start_val;
93 wheel -> gx_numeric_scroll_wheel_end_val = end_val;
94
95 wheel -> gx_text_scroll_wheel_text_get = (UINT (*)(GX_TEXT_SCROLL_WHEEL *, INT, GX_STRING *))_gx_numeric_scroll_wheel_text_get;
96
97 /* Determine if a parent widget was provided. */
98 if (parent)
99 {
100 _gx_widget_link(parent, (GX_WIDGET *)wheel);
101 }
102
103 /* Return completion status. */
104 return(GX_SUCCESS);
105 }
106
107