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