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