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 /**   Widget Management (Widget)                                          */
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_widget.h"
30 #include "gx_window.h"
31 
32 
33 /**************************************************************************/
34 /*                                                                        */
35 /*  FUNCTION                                               RELEASE        */
36 /*                                                                        */
37 /*    _gx_widget_show                                     PORTABLE C      */
38 /*                                                           6.1          */
39 /*  AUTHOR                                                                */
40 /*                                                                        */
41 /*    Kenneth Maxwell, Microsoft Corporation                              */
42 /*                                                                        */
43 /*  DESCRIPTION                                                           */
44 /*                                                                        */
45 /*    This function shows the widget.                                     */
46 /*                                                                        */
47 /*  INPUT                                                                 */
48 /*                                                                        */
49 /*    widget                                Pointer to widget             */
50 /*                                                                        */
51 /*  OUTPUT                                                                */
52 /*                                                                        */
53 /*    status                                Completion status             */
54 /*                                                                        */
55 /*  CALLS                                                                 */
56 /*                                                                        */
57 /*    [gx_widget_event_process_function]    Call widget event processing  */
58 /*    _gx_widget_clipping_update            Update the clipping area      */
59 /*    _gx_system_dirty_mark                 Mark a widget as dirty        */
60 /*    _gx_window_view_update_detect         Detect window view area for   */
61 /*                                            update                      */
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_widget_show(GX_WIDGET * widget)77 UINT  _gx_widget_show(GX_WIDGET *widget)
78 {
79 GX_EVENT   show_event;
80 GX_WINDOW *win;
81 
82     show_event.gx_event_target = GX_NULL;
83     widget -> gx_widget_status &= ~GX_STATUS_HIDDEN;
84 
85     if (!(widget -> gx_widget_status & GX_STATUS_VISIBLE))
86     {
87         /* Send a GX_SHOW event to widget and all children of the widget.  */
88         show_event.gx_event_type = GX_EVENT_SHOW;
89 
90         /* Call widget's event processing.  */
91         widget -> gx_widget_event_process_function(widget, &show_event);
92 
93         /* update the clipping for this widget */
94         _gx_widget_clipping_update(widget);
95 
96         _gx_system_dirty_mark(widget);
97 
98         if (widget -> gx_widget_type >= GX_TYPE_WINDOW)
99         {
100             win = (GX_WINDOW *)widget;
101             if (win -> gx_window_views)
102             {
103                 _gx_system_views_free(win -> gx_window_views);
104                 win -> gx_window_views = GX_NULL;
105             }
106             _gx_window_view_update_detect(win);
107         }
108 
109         if ((widget -> gx_widget_status & GX_STATUS_ACCEPTS_FOCUS) &&
110             widget -> gx_widget_parent)
111         {
112         	/* if this widget was part of navigation order, re-create nav order list */
113             _gx_widget_nav_order_initialize(widget -> gx_widget_parent);
114         }
115     }
116 
117     /* Return successful completion.  */
118     return(GX_SUCCESS);
119 }
120 
121