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 /**   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_slider.h"
30 
31 
32 /**************************************************************************/
33 /*                                                                        */
34 /*  FUNCTION                                               RELEASE        */
35 /*                                                                        */
36 /*    _gx_pixelmap_slider_create                          PORTABLE C      */
37 /*                                                           6.1          */
38 /*  AUTHOR                                                                */
39 /*                                                                        */
40 /*    Kenneth Maxwell, Microsoft Corporation                              */
41 /*                                                                        */
42 /*  DESCRIPTION                                                           */
43 /*                                                                        */
44 /*    This function creates a pixelmap slider, which is a type of widget  */
45 /*    for displaying a user-adjustable value in graphical fashion.        */
46 /*                                                                        */
47 /*  INPUT                                                                 */
48 /*                                                                        */
49 /*    slider                                Slider control block          */
50 /*    name                                  Name of prompt                */
51 /*    parent                                Parent widget control block   */
52 /*    info                                  Pointer to a GX_SLIDER_INFO   */
53 /*    pixelmap_info                         Pointer to the pixelmap       */
54 /*                                            info block                  */
55 /*    style                                 Style of slider               */
56 /*    pixelmap_slider_id                    Application-defined ID of     */
57 /*                                            pixelmap slider             */
58 /*    size                                  Dimensions of pixelmap prompt */
59 /*                                                                        */
60 /*  OUTPUT                                                                */
61 /*                                                                        */
62 /*    status                                Completion status             */
63 /*                                                                        */
64 /*  CALLS                                                                 */
65 /*                                                                        */
66 /*    _gx_widget_create                     Create the underlying widget  */
67 /*    _gx_widget_link                       Link the widget to its parent */
68 /*                                                                        */
69 /*  CALLED BY                                                             */
70 /*                                                                        */
71 /*    Application Code                                                    */
72 /*                                                                        */
73 /*  RELEASE HISTORY                                                       */
74 /*                                                                        */
75 /*    DATE              NAME                      DESCRIPTION             */
76 /*                                                                        */
77 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
78 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
79 /*                                            resulting in version 6.1    */
80 /*                                                                        */
81 /**************************************************************************/
82 
_gx_pixelmap_slider_create(GX_PIXELMAP_SLIDER * slider,GX_CONST GX_CHAR * name,GX_WIDGET * parent,GX_SLIDER_INFO * info,GX_PIXELMAP_SLIDER_INFO * pixelmap_info,ULONG style,USHORT pixelmap_slider_id,GX_CONST GX_RECTANGLE * size)83 UINT  _gx_pixelmap_slider_create(GX_PIXELMAP_SLIDER *slider,
84                                  GX_CONST GX_CHAR *name,
85                                  GX_WIDGET *parent,
86                                  GX_SLIDER_INFO *info,
87                                  GX_PIXELMAP_SLIDER_INFO *pixelmap_info,
88                                  ULONG style,
89                                  USHORT pixelmap_slider_id,
90                                  GX_CONST GX_RECTANGLE *size)
91 {
92 
93     /* Call the widget create function.  */
94     _gx_widget_create((GX_WIDGET *)slider, name, GX_NULL, style, pixelmap_slider_id, size);
95 
96     /* Populate the rest of slider control block - overriding as necessary.  */
97     slider -> gx_widget_type = GX_TYPE_PIXELMAP_SLIDER;
98 
99     slider -> gx_widget_draw_function = (VOID (*)(GX_WIDGET *))_gx_pixelmap_slider_draw;
100     slider -> gx_widget_event_process_function = (UINT (*)(GX_WIDGET *, GX_EVENT *))_gx_pixelmap_slider_event_process;
101     slider -> gx_slider_info = *info;
102     slider -> gx_pixelmap_slider_pixelmap_info = *pixelmap_info;
103 
104     slider -> gx_slider_info.gx_slider_info_needle_height = 0;
105     slider -> gx_slider_info.gx_slider_info_needle_width = 0;
106 
107     /* Determine if a parent widget was provided.  */
108     if (parent)
109     {
110         _gx_widget_link(parent, (GX_WIDGET *)slider);
111     }
112 
113     /* Return the status from prompt create.  */
114     return(GX_SUCCESS);
115 }
116 
117