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 /** Button Management (Button) */ 18 /** */ 19 /**************************************************************************/ 20 21 #define GX_SOURCE_CODE 22 23 24 /* Include necessary system files. */ 25 26 #include "gx_api.h" 27 #include "gx_button.h" 28 #include "gx_system.h" 29 #include "gx_widget.h" 30 31 32 /**************************************************************************/ 33 /* */ 34 /* FUNCTION RELEASE */ 35 /* */ 36 /* _gx_button_background_draw PORTABLE C */ 37 /* 6.1 */ 38 /* AUTHOR */ 39 /* */ 40 /* Kenneth Maxwell, Microsoft Corporation */ 41 /* */ 42 /* DESCRIPTION */ 43 /* */ 44 /* This function draws the specified button, which is a special type */ 45 /* of widget. */ 46 /* */ 47 /* INPUT */ 48 /* */ 49 /* button Button control block */ 50 /* */ 51 /* OUTPUT */ 52 /* */ 53 /* None */ 54 /* */ 55 /* CALLS */ 56 /* */ 57 /* _gx_widget_border_style_set Set the border style */ 58 /* _gx_widget_border_draw Draw the border */ 59 /* */ 60 /* CALLED BY */ 61 /* */ 62 /* Application Code */ 63 /* _gx_button_draw */ 64 /* _gx_icon_button_draw */ 65 /* _gx_text_button_draw */ 66 /* */ 67 /* RELEASE HISTORY */ 68 /* */ 69 /* DATE NAME DESCRIPTION */ 70 /* */ 71 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ 72 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */ 73 /* resulting in version 6.1 */ 74 /* */ 75 /**************************************************************************/ _gx_button_background_draw(GX_BUTTON * button)76VOID _gx_button_background_draw(GX_BUTTON *button) 77 { 78 GX_RESOURCE_ID fill1; 79 GX_RESOURCE_ID fill2; 80 GX_WIDGET *widget = (GX_WIDGET *)button; 81 82 /* Draw button background. */ 83 if (button -> gx_widget_style & GX_STYLE_ENABLED) 84 { 85 if (button -> gx_widget_style & GX_STYLE_BUTTON_PUSHED) 86 { 87 if ((button -> gx_widget_style & GX_STYLE_BORDER_MASK) == GX_STYLE_BORDER_RAISED) 88 { 89 _gx_widget_border_style_set(widget, GX_STYLE_BORDER_RECESSED); 90 } 91 fill1 = widget -> gx_widget_normal_fill_color; 92 fill2 = widget -> gx_widget_selected_fill_color; 93 } 94 else 95 { 96 if ((button -> gx_widget_style & GX_STYLE_BORDER_MASK) == GX_STYLE_BORDER_RECESSED) 97 { 98 _gx_widget_border_style_set(widget, GX_STYLE_BORDER_RAISED); 99 } 100 fill1 = widget -> gx_widget_selected_fill_color; 101 fill2 = widget -> gx_widget_normal_fill_color; 102 } 103 } 104 else 105 { 106 fill1 = widget -> gx_widget_disabled_fill_color; 107 fill2 = widget -> gx_widget_disabled_fill_color; 108 } 109 110 _gx_widget_border_draw(widget, GX_COLOR_ID_BUTTON_BORDER, fill1, fill2, GX_TRUE); 111 } 112 113