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_context.h" 29 #include "gx_canvas.h" 30 #include "gx_radial_slider.h" 31 32 /**************************************************************************/ 33 /* */ 34 /* FUNCTION RELEASE */ 35 /* */ 36 /* _gx_radial_slider_draw PORTABLE C */ 37 /* 6.1 */ 38 /* AUTHOR */ 39 /* */ 40 /* Kenneth Maxwell, Microsoft Corporation */ 41 /* */ 42 /* DESCRIPTION */ 43 /* */ 44 /* This function draws a radial slider widget. */ 45 /* */ 46 /* INPUT */ 47 /* */ 48 /* slider Radial slider control block */ 49 /* */ 50 /* OUTPUT */ 51 /* */ 52 /* None */ 53 /* */ 54 /* CALLS */ 55 /* */ 56 /* _gx_widget_draw Default widget draw */ 57 /* _gx_context_pixelmap_get Retrieve pixelmap with */ 58 /* specified pixelmap id */ 59 /* _gx_canvas_pixelmap_draw Draw a pixelmap to canvas */ 60 /* _gx_widget_children_draw Draw widget children */ 61 /* _gx_radial_slider_needle_rectangle_get */ 62 /* Retrive needle bounding */ 63 /* rectangle */ 64 /* */ 65 /* CALLED BY */ 66 /* */ 67 /* GUIX Internal Code */ 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_draw(GX_RADIAL_SLIDER * slider)79VOID _gx_radial_slider_draw(GX_RADIAL_SLIDER *slider) 80 { 81 GX_PIXELMAP *map = GX_NULL; 82 GX_RECTANGLE size; 83 84 /* Call default widget draw. */ 85 _gx_widget_background_draw((GX_WIDGET *)slider); 86 87 _gx_context_pixelmap_get(slider -> gx_radial_slider_info.gx_radial_slider_info_background_pixelmap, &map); 88 89 _gx_widget_context_fill_set((GX_WIDGET *)slider); 90 91 if (map) 92 { 93 /* Draw background pixelmap. */ 94 _gx_canvas_pixelmap_draw(slider -> gx_widget_size.gx_rectangle_left, slider -> gx_widget_size.gx_rectangle_top, map); 95 } 96 97 /* Pick needle pixelmap. */ 98 _gx_context_pixelmap_get(slider -> gx_radial_slider_info.gx_radial_slider_info_needle_pixelmap, &map); 99 100 if (map) 101 { 102 /* Calcualte needle bounding rectangle. */ 103 _gx_radial_slider_needle_rectangle_calculate(slider, &size); 104 105 /* Draw needle. */ 106 _gx_canvas_pixelmap_draw(size.gx_rectangle_left, size.gx_rectangle_top, map); 107 } 108 109 /* Draw children widgets. */ 110 _gx_widget_children_draw((GX_WIDGET *)slider); 111 } 112 113