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