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 /**   Text 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_system.h"
29 #include "gx_display.h"
30 #include "gx_context.h"
31 #include "gx_widget.h"
32 #include "gx_button.h"
33 
34 
35 /**************************************************************************/
36 /*                                                                        */
37 /*  FUNCTION                                               RELEASE        */
38 /*                                                                        */
39 /*    _gx_text_button_draw                                PORTABLE C      */
40 /*                                                           6.1          */
41 /*  AUTHOR                                                                */
42 /*                                                                        */
43 /*    Kenneth Maxwell, Microsoft Corporation                              */
44 /*                                                                        */
45 /*  DESCRIPTION                                                           */
46 /*                                                                        */
47 /*    This function draws the specified text button, which is a special   */
48 /*    type of widget.                                                     */
49 /*                                                                        */
50 /*  INPUT                                                                 */
51 /*                                                                        */
52 /*    button                                Text button control block     */
53 /*                                                                        */
54 /*  OUTPUT                                                                */
55 /*                                                                        */
56 /*    status                                Completion status             */
57 /*                                                                        */
58 /*  CALLS                                                                 */
59 /*                                                                        */
60 /*    _gx_button_background_draw            Draw button background        */
61 /*    _gx_widget_text_draw                  Draw text string              */
62 /*    _gx_widget_children_draw              Draw children widgets         */
63 /*                                                                        */
64 /*  CALLED BY                                                             */
65 /*                                                                        */
66 /*    Application Code                                                    */
67 /*    GUIX Internal Code                                                  */
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_text_button_draw(GX_TEXT_BUTTON * button)78 VOID  _gx_text_button_draw(GX_TEXT_BUTTON *button)
79 {
80 GX_WIDGET *widget;
81 
82     /* Setup the button.  */
83     widget =  (GX_WIDGET *)button;
84 
85     /* Draw button background. */
86     _gx_button_background_draw((GX_BUTTON *)button);
87 
88     /* draw the text */
89     _gx_text_button_text_draw(button);
90 
91     /* Draw button's children.  */
92     _gx_widget_children_draw(widget);
93 
94     if (!(button -> gx_widget_style & GX_STYLE_ENABLED))
95     {
96         /* Draw a line on the button to show it's disable for mono driver. */
97         _gx_monochrome_driver_disabled_button_line_draw((GX_BUTTON *)button);
98     }
99 }
100 
101