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