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_widget.h"
28 
29 /**************************************************************************/
30 /*                                                                        */
31 /*  FUNCTION                                               RELEASE        */
32 /*                                                                        */
33 /*    _gx_first_client_child_get                          PORTABLE C      */
34 /*                                                           6.1          */
35 /*  AUTHOR                                                                */
36 /*                                                                        */
37 /*    Kenneth Maxwell, Microsoft Corporation                              */
38 /*                                                                        */
39 /*  DESCRIPTION                                                           */
40 /*                                                                        */
41 /*    This function get the first client child.                           */
42 /*                                                                        */
43 /*  INPUT                                                                 */
44 /*                                                                        */
45 /*    parent                                Pointer to parent widget      */
46 /*                                                                        */
47 /*  OUTPUT                                                                */
48 /*                                                                        */
49 /*    test                                  First client child            */
50 /*                                                                        */
51 /*  CALLS                                                                 */
52 /*                                                                        */
53 /*    None                                                                */
54 /*                                                                        */
55 /*  CALLED BY                                                             */
56 /*                                                                        */
57 /*    _gx_drop_list_event_process                                         */
58 /*    _gx_horizontal_list_event_process                                   */
59 /*    _gx_horizontal_list_left_wrap                                       */
60 /*    _gx_horizontal_list_right_wrap                                      */
61 /*    _gx_horizontal_list_scroll_info_get                                 */
62 /*    _gx_horizontal_list_slide_back_check                                */
63 /*    _gx_vertical_list_down_wrap                                         */
64 /*    _gx_vertical_list_event_process                                     */
65 /*    _gx_vertical_list_scroll_info_get                                   */
66 /*    _gx_vertical_list_slide_back_check                                  */
67 /*    _gx_vertical_list_up_wrap                                           */
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_widget_first_client_child_get(GX_WIDGET * parent)78 GX_WIDGET *_gx_widget_first_client_child_get(GX_WIDGET *parent)
79 {
80 GX_WIDGET *test = parent -> gx_widget_first_child;
81 
82     while (test && (test -> gx_widget_status & GX_STATUS_NONCLIENT))
83     {
84         test = test -> gx_widget_next;
85     }
86     return test;
87 }
88 
89 /**************************************************************************/
90 /*                                                                        */
91 /*  FUNCTION                                               RELEASE        */
92 /*                                                                        */
93 /*    _gx_first_visible_client_child_get                  PORTABLE C      */
94 /*                                                           6.1.7        */
95 /*  AUTHOR                                                                */
96 /*                                                                        */
97 /*    Ting Zhu, Microsoft Corporation                                     */
98 /*                                                                        */
99 /*  DESCRIPTION                                                           */
100 /*                                                                        */
101 /*    This function get the first client child that is visible.           */
102 /*                                                                        */
103 /*  INPUT                                                                 */
104 /*                                                                        */
105 /*    parent                                Pointer to parent widget      */
106 /*                                                                        */
107 /*  OUTPUT                                                                */
108 /*                                                                        */
109 /*    test                                  First visible client child    */
110 /*                                                                        */
111 /*  CALLS                                                                 */
112 /*                                                                        */
113 /*    None                                                                */
114 /*                                                                        */
115 /*  CALLED BY                                                             */
116 /*                                                                        */
117 /*    GUIX Internal Code                                                  */
118 /*                                                                        */
119 /*  RELEASE HISTORY                                                       */
120 /*                                                                        */
121 /*    DATE              NAME                      DESCRIPTION             */
122 /*                                                                        */
123 /*  06-02-2021     Ting Zhu                 Initial Version 6.1.7         */
124 /*                                                                        */
125 /**************************************************************************/
_gx_widget_first_visible_client_child_get(GX_WIDGET * parent)126 GX_WIDGET *_gx_widget_first_visible_client_child_get(GX_WIDGET *parent)
127 {
128 GX_WIDGET *test = parent -> gx_widget_first_child;
129 
130     while (test)
131     {
132         if (!(test -> gx_widget_status & GX_STATUS_NONCLIENT) &&
133             (test -> gx_widget_status & GX_STATUS_VISIBLE))
134         {
135 
136             /* Find the first child that is client and visible. */
137             return test;
138         }
139 
140         test = test -> gx_widget_next;
141     }
142 
143     return GX_NULL;
144 }
145 
146