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 /** System Management (System) */
18 /** */
19 /**************************************************************************/
20
21 #define GX_SOURCE_CODE
22
23
24 /* Include necessary system files. */
25
26 #include "gx_api.h"
27 #include "gx_utility.h"
28 #include "gx_system.h"
29 #include "gx_widget.h"
30
31
32 /**************************************************************************/
33 /* */
34 /* FUNCTION RELEASE */
35 /* */
36 /* _gx_system_widget_find PORTABLE C */
37 /* 6.1 */
38 /* AUTHOR */
39 /* */
40 /* Kenneth Maxwell, Microsoft Corporation */
41 /* */
42 /* DESCRIPTION */
43 /* */
44 /* This service searches for the specified widget ID. */
45 /* */
46 /* INPUT */
47 /* */
48 /* widget_id Widget ID to search for */
49 /* search_level Specifies the depth of the */
50 /* search */
51 /* return_search_result Pointer to destination for */
52 /* widget found */
53 /* */
54 /* OUTPUT */
55 /* */
56 /* status Completion status */
57 /* */
58 /* CALLS */
59 /* */
60 /* _gx_widget_find Search throught its children */
61 /* */
62 /* CALLED BY */
63 /* */
64 /* GUIX Application Code */
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_system_widget_find(USHORT widget_id,INT search_level,GX_WIDGET ** return_search_result)75 UINT _gx_system_widget_find(USHORT widget_id, INT search_level, GX_WIDGET **return_search_result)
76 {
77
78 GX_WIDGET *test;
79
80 /* start at first root window */
81 test = (GX_WIDGET *)_gx_system_root_window_created_list;
82
83 while (test)
84 {
85 /* check to see if they are looking for a root window */
86 if (test -> gx_widget_id == widget_id)
87 {
88 *return_search_result = test;
89 return GX_SUCCESS;
90 }
91 /* check the children of this root window */
92 if (test -> gx_widget_first_child)
93 {
94 /* yes, check to see if the requested Id is a child */
95 if (_gx_widget_find(test, widget_id, search_level, return_search_result) == GX_SUCCESS)
96 {
97 return GX_SUCCESS;
98 }
99 }
100 /* advance to next entry in list */
101 test = test -> gx_widget_next;
102 }
103 return GX_NOT_FOUND;
104 }
105
106