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 /** Slider Management (Slider) */ 18 /** */ 19 /**************************************************************************/ 20 21 #define GX_SOURCE_CODE 22 23 /* Include necessary system files. */ 24 25 #include "gx_api.h" 26 #include "gx_system.h" 27 #include "gx_display.h" 28 #include "gx_context.h" 29 #include "gx_widget.h" 30 #include "gx_slider.h" 31 32 33 /**************************************************************************/ 34 /* */ 35 /* FUNCTION RELEASE */ 36 /* */ 37 /* _gx_slider_draw PORTABLE C */ 38 /* 6.1 */ 39 /* AUTHOR */ 40 /* */ 41 /* Kenneth Maxwell, Microsoft Corporation */ 42 /* */ 43 /* DESCRIPTION */ 44 /* */ 45 /* This service draws the specified slider. */ 46 /* */ 47 /* INPUT */ 48 /* */ 49 /* slider Widget control block */ 50 /* */ 51 /* OUTPUT */ 52 /* */ 53 /* None */ 54 /* */ 55 /* CALLS */ 56 /* */ 57 /* _gx_system_color_get Get the color by resource ID */ 58 /* _gx_widget_border_draw Draw border */ 59 /* _gx_slider_tickmarks_draw Draw tickmarks */ 60 /* _gx_slider_needle_draw Draw the slider needle */ 61 /* _gx_widget_children_draw Draw children widgets */ 62 /* */ 63 /* CALLED BY */ 64 /* */ 65 /* Application Code */ 66 /* GUIX Internal Code */ 67 /* */ 68 /* RELEASE HISTORY */ 69 /* */ 70 /* DATE NAME DESCRIPTION */ 71 /* */ 72 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ 73 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */ 74 /* resulting in version 6.1 */ 75 /* */ 76 /**************************************************************************/ _gx_slider_draw(GX_SLIDER * slider)77VOID _gx_slider_draw(GX_SLIDER *slider) 78 { 79 GX_RESOURCE_ID fill; 80 81 if (slider -> gx_widget_style & GX_STYLE_ENABLED) 82 { 83 if (slider -> gx_widget_style & GX_STYLE_DRAW_SELECTED) 84 { 85 fill = slider -> gx_widget_selected_fill_color; 86 } 87 else 88 { 89 fill = slider -> gx_widget_normal_fill_color; 90 } 91 } 92 else 93 { 94 fill = slider -> gx_widget_disabled_fill_color; 95 } 96 97 _gx_widget_border_draw((GX_WIDGET *)slider, GX_COLOR_ID_BUTTON_BORDER, fill, fill, GX_TRUE); 98 99 /* draw the scale */ 100 101 if (slider -> gx_widget_style & GX_STYLE_SHOW_TICKMARKS) 102 { 103 _gx_slider_tickmarks_draw((GX_SLIDER *)slider); 104 } 105 106 if (slider -> gx_widget_style & GX_STYLE_SHOW_NEEDLE) 107 { 108 _gx_slider_needle_draw((GX_SLIDER *)slider); 109 } 110 111 /* Draw children widgets of prompt widget. */ 112 _gx_widget_children_draw((GX_WIDGET *)slider); 113 } 114 115