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