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