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_widget_client_index_get PORTABLE C */
36 /* 6.1 */
37 /* AUTHOR */
38 /* */
39 /* Kenneth Maxwell, Microsoft Corporation */
40 /* */
41 /* DESCRIPTION */
42 /* */
43 /* This function get the indexed position of a specified client child. */
44 /* */
45 /* INPUT */
46 /* */
47 /* parent Pointer to parent widget */
48 /* child Pointer to child widget */
49 /* */
50 /* OUTPUT */
51 /* */
52 /* index Position value to be retrieved*/
53 /* */
54 /* CALLS */
55 /* */
56 /* None */
57 /* */
58 /* CALLED BY */
59 /* */
60 /* _gx_drop_list_event_process */
61 /* _gx_horizontal_list_event_process */
62 /* _gx_horizontal_list_left_wrap */
63 /* _gx_horizontal_list_right_wrap */
64 /* _gx_horizontal_list_scroll_info_get */
65 /* _gx_horizontal_list_slide_back_check */
66 /* _gx_vertical_list_down_wrap */
67 /* _gx_vertical_list_event_process */
68 /* _gx_vertical_list_scroll_info_get */
69 /* _gx_vertical_list_slide_back_check */
70 /* _gx_vertical_list_up_wrap */
71 /* */
72 /* RELEASE HISTORY */
73 /* */
74 /* DATE NAME DESCRIPTION */
75 /* */
76 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
77 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */
78 /* resulting in version 6.1 */
79 /* */
80 /**************************************************************************/
_gx_widget_client_index_get(GX_WIDGET * parent,GX_WIDGET * child)81 INT _gx_widget_client_index_get(GX_WIDGET *parent, GX_WIDGET *child)
82 {
83 INT index = 0;
84 GX_WIDGET *test = parent -> gx_widget_first_child;
85
86 while (test && (test -> gx_widget_status & GX_STATUS_NONCLIENT))
87 {
88 test = test -> gx_widget_next;
89 }
90
91 while (test)
92 {
93 if (test == child)
94 {
95 break;
96 }
97 if (!(test -> gx_widget_status & GX_STATUS_NONCLIENT))
98 {
99 index++;
100 }
101 test = test -> gx_widget_next;
102 }
103 return index;
104 }
105
106