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 /** Button Management (Button) */ 19 /** */ 20 /**************************************************************************/ 21 22 #define GX_SOURCE_CODE 23 24 25 /* Include necessary system files. */ 26 27 #include "gx_api.h" 28 #include "gx_button.h" 29 #include "gx_system.h" 30 #include "gx_widget.h" 31 #include "gx_context.h" 32 #include "gx_canvas.h" 33 34 35 /**************************************************************************/ 36 /* */ 37 /* FUNCTION RELEASE */ 38 /* */ 39 /* _gx_monochrome_driver_disabled_button_line_draw PORTABLE C */ 40 /* 6.1 */ 41 /* AUTHOR */ 42 /* */ 43 /* Kenneth Maxwell, Microsoft Corporation */ 44 /* */ 45 /* DESCRIPTION */ 46 /* */ 47 /* This function draws a line over button text to indicate the */ 48 /* button is disabled. Used only for monochrome format. */ 49 /* */ 50 /* INPUT */ 51 /* */ 52 /* button Button control block */ 53 /* */ 54 /* OUTPUT */ 55 /* */ 56 /* None */ 57 /* */ 58 /* CALLS */ 59 /* */ 60 /* _gx_context_raw_line_color_set Set raw line color */ 61 /* _gx_context_color_get Get color associated with the */ 62 /* supplied color id */ 63 /* _gx_context_brush_width_set Set brush width */ 64 /* _gx_canvas_line_draw Draw a line */ 65 /* */ 66 /* CALLED BY */ 67 /* */ 68 /* _gx_text_button_draw */ 69 /* _gx_multi_line_text_button_draw */ 70 /* */ 71 /* RELEASE HISTORY */ 72 /* */ 73 /* DATE NAME DESCRIPTION */ 74 /* */ 75 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ 76 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */ 77 /* resulting in version 6.1 */ 78 /* */ 79 /**************************************************************************/ _gx_monochrome_driver_disabled_button_line_draw(GX_BUTTON * button)80VOID _gx_monochrome_driver_disabled_button_line_draw(GX_BUTTON *button) 81 { 82 GX_CANVAS *canvas; 83 INT display_format; 84 GX_VALUE start; 85 GX_VALUE end; 86 GX_VALUE yval; 87 GX_COLOR line_color; 88 89 90 canvas = _gx_system_current_draw_context -> gx_draw_context_canvas; 91 display_format = canvas -> gx_canvas_display -> gx_display_color_format; 92 93 if (display_format != GX_COLOR_FORMAT_MONOCHROME) 94 { 95 return; 96 } 97 98 /* Get fill color; */ 99 _gx_context_color_get(button -> gx_widget_normal_fill_color, &line_color); 100 101 /* Set line color. */ 102 line_color = ~line_color; 103 104 _gx_context_raw_line_color_set(line_color); 105 106 _gx_context_brush_width_set(2); 107 108 109 start = (GX_VALUE)(button -> gx_widget_size.gx_rectangle_left + 5); 110 end = (GX_VALUE)(button -> gx_widget_size.gx_rectangle_right - 5); 111 yval = (GX_VALUE)((button -> gx_widget_size.gx_rectangle_top + button -> gx_widget_size.gx_rectangle_bottom) >> 1); 112 113 _gx_canvas_line_draw((GX_VALUE)start, (GX_VALUE)yval, (GX_VALUE)end, (GX_VALUE)yval); 114 } 115 116