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 /**   Multi Line Text View Management (Multi Line Text View)              */
18 /**                                                                       */
19 /**************************************************************************/
20 
21 #define GX_SOURCE_CODE
22 
23 
24 /* Include necessary system files.  */
25 
26 #include "gx_api.h"
27 #include "gx_multi_line_text_view.h"
28 #include "gx_window.h"
29 #include "gx_widget.h"
30 
31 /**************************************************************************/
32 /*                                                                        */
33 /*  FUNCTION                                               RELEASE        */
34 /*                                                                        */
35 /*    _gx_multi_line_text_view_draw                       PORTABLE C      */
36 /*                                                           6.1          */
37 /*  AUTHOR                                                                */
38 /*                                                                        */
39 /*    Kenneth Maxwell, Microsoft Corporation                              */
40 /*                                                                        */
41 /*  DESCRIPTION                                                           */
42 /*                                                                        */
43 /*    This function draws a multi-line-text-view widget.                  */
44 /*                                                                        */
45 /*  INPUT                                                                 */
46 /*                                                                        */
47 /*    text_view                              Multi-line_text_view widget  */
48 /*                                           control block                */
49 /*  OUTPUT                                                                */
50 /*                                                                        */
51 /*    None                                                                */
52 /*                                                                        */
53 /*  CALLS                                                                 */
54 /*                                                                        */
55 /*    _gx_window_border_draw                Draw window background with   */
56 /*                                            specified fill color        */
57 /*    _gx_multi_line_text_view_text_draw    Draw text                     */
58 /*    _gx_widget_children_draw              Draw children widgets         */
59 /*                                                                        */
60 /*  CALLED BY                                                             */
61 /*                                                                        */
62 /*    Application Code                                                    */
63 /*    GUIX Internal Code                                                  */
64 /*                                                                        */
65 /*  RELEASE HISTORY                                                       */
66 /*                                                                        */
67 /*    DATE              NAME                      DESCRIPTION             */
68 /*                                                                        */
69 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
70 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
71 /*                                            resulting in version 6.1    */
72 /*                                                                        */
73 /**************************************************************************/
_gx_multi_line_text_view_draw(GX_MULTI_LINE_TEXT_VIEW * text_view)74 VOID  _gx_multi_line_text_view_draw(GX_MULTI_LINE_TEXT_VIEW *text_view)
75 {
76 GX_RESOURCE_ID text_color;
77 
78     /* Set the brush color, font, width. */
79     if (text_view -> gx_widget_style & GX_STYLE_ENABLED)
80     {
81         if (text_view -> gx_widget_style & GX_STYLE_DRAW_SELECTED)
82         {
83             text_color = text_view -> gx_multi_line_text_view_selected_text_color;
84         }
85         else
86         {
87             text_color = text_view -> gx_multi_line_text_view_normal_text_color;
88         }
89     }
90     else
91     {
92         text_color = text_view -> gx_multi_line_text_view_disabled_text_color;
93     }
94 
95     /* Draw window background. */
96     _gx_window_background_draw((GX_WINDOW *)text_view);
97 
98     /* Draw text. */
99     _gx_multi_line_text_view_text_draw(text_view, text_color);
100 
101     /* Draw widget's children.  */
102     _gx_widget_children_draw((GX_WIDGET *)text_view);
103 }
104 
105