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_pixelmap_update                 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 /*    pixinfo                               Slider infomration block      */
51 /*                                                                        */
52 /*  OUTPUT                                                                */
53 /*                                                                        */
54 /*    status                                Completion status             */
55 /*                                                                        */
56 /*  CALLS                                                                 */
57 /*                                                                        */
58 /*    _gx_widget_pixelmap_get               Retrieve the pixelmap         */
59 /*    _gx_widget_status_add                 Add status flag               */
60 /*    _gx_system_dirty_mark                 Mark the widget as dirty      */
61 /*                                                                        */
62 /*  CALLED BY                                                             */
63 /*                                                                        */
64 /*    _gx_pixelmap_slider_event_process     Event process routine for     */
65 /*                                            pixelmap slider widget      */
66 /*    _gx_pixelmap_slider_pixelmap_set      Assign pixelmap to the        */
67 /*                                            pixelmap slider widget      */
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_pixelmap_slider_pixelmap_update(GX_PIXELMAP_SLIDER * slider)78 VOID _gx_pixelmap_slider_pixelmap_update(GX_PIXELMAP_SLIDER *slider)
79 {
80 GX_PIXELMAP_SLIDER_INFO *pixelmap_info = &slider -> gx_pixelmap_slider_pixelmap_info;
81 GX_WIDGET               *widget = (GX_WIDGET *)slider;
82 GX_PIXELMAP             *map;
83 
84     /* if any of my pixelmaps are transparent, give myself transparent status */
85 
86     if (pixelmap_info -> gx_pixelmap_slider_info_needle_pixelmap)
87     {
88         _gx_widget_pixelmap_get(widget, pixelmap_info -> gx_pixelmap_slider_info_needle_pixelmap, &map);
89 
90         if (map)
91         {
92             slider -> gx_slider_info.gx_slider_info_needle_height = map -> gx_pixelmap_height;
93             slider -> gx_slider_info.gx_slider_info_needle_width = map -> gx_pixelmap_width;
94 
95             if (PIXELMAP_IS_TRANSPARENT(map))
96             {
97                 _gx_widget_status_add((GX_WIDGET *)slider, GX_STATUS_TRANSPARENT);
98             }
99         }
100     }
101 
102     if (pixelmap_info -> gx_pixelmap_slider_info_lower_background_pixelmap)
103     {
104         _gx_widget_pixelmap_get(widget, pixelmap_info -> gx_pixelmap_slider_info_lower_background_pixelmap, &map);
105 
106         if (map && PIXELMAP_IS_TRANSPARENT(map))
107         {
108             _gx_widget_status_add((GX_WIDGET *)slider, GX_STATUS_TRANSPARENT);
109         }
110     }
111 }
112 
113