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 /** Radial Slider Management (Slider) */
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_radial_slider.h"
29
30 /**************************************************************************/
31 /* */
32 /* FUNCTION RELEASE */
33 /* */
34 /* _gx_radial_slider_create PORTABLE C */
35 /* 6.1 */
36 /* AUTHOR */
37 /* */
38 /* Kenneth Maxwell, Microsoft Corporation */
39 /* */
40 /* DESCRIPTION */
41 /* */
42 /* This function creates a radial slider, which is a special type of */
43 /* widget. */
44 /* */
45 /* INPUT */
46 /* */
47 /* slider Radial slider control block */
48 /* name Name of radial slider */
49 /* parent Parent widget control block */
50 /* info Pointer to radial slider info */
51 /* style Style of prompt */
52 /* slider_id Application-defined ID of */
53 /* radial slider */
54 /* size Widget size */
55 /* */
56 /* OUTPUT */
57 /* */
58 /* status Completion status */
59 /* */
60 /* CALLS */
61 /* */
62 /* _gx_widget_create Create the underlying widget */
63 /* _gx_widget_link Link the widget to its parent */
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 /**************************************************************************/
_gx_radial_slider_create(GX_RADIAL_SLIDER * slider,GX_CONST GX_CHAR * name,GX_WIDGET * parent,GX_RADIAL_SLIDER_INFO * info,ULONG style,USHORT slider_id,GX_CONST GX_RECTANGLE * size)78 UINT _gx_radial_slider_create(GX_RADIAL_SLIDER *slider, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
79 GX_RADIAL_SLIDER_INFO *info, ULONG style, USHORT slider_id, GX_CONST GX_RECTANGLE *size)
80 {
81
82 /* Call the widget create function. */
83 _gx_widget_create((GX_WIDGET *)slider, name, GX_NULL, style, slider_id, size);
84
85 /* Populate the rest of control block - overriding as necessary. */
86 slider -> gx_radial_slider_info = *info;
87 slider -> gx_widget_type = GX_TYPE_RADIAL_SLIDER;
88 slider -> gx_widget_draw_function = (VOID (*)(GX_WIDGET *))_gx_radial_slider_draw;
89 slider -> gx_widget_event_process_function = (UINT (*)(GX_WIDGET *, GX_EVENT *event_ptr))_gx_radial_slider_event_process;
90 slider -> gx_radial_slider_start_angle = 0;
91 slider -> gx_radial_slider_target_angle = 0;
92 slider -> gx_radial_slider_animation_total_steps = 15;
93 slider -> gx_radial_slider_animation_step = 0;
94 slider -> gx_radial_slider_animation_delay = 2;
95 slider -> gx_widget_status |= GX_STATUS_ANIMATION_NONE;
96 slider -> gx_radial_slider_animation_style = GX_ANIMATION_CIRC_EASE_IN_OUT;
97
98 /* Determine if a parent widget was provided. */
99 if (parent)
100 {
101 _gx_widget_link(parent, (GX_WIDGET *)slider);
102 }
103
104 /* Return the status from widget create. */
105 return(GX_SUCCESS);
106 }
107
108