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 /** Horizontal List (List) */ 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 #include "gx_system.h" 30 #include "gx_scrollbar.h" 31 32 /**************************************************************************/ 33 /* */ 34 /* FUNCTION RELEASE */ 35 /* */ 36 /* _gx_horizontal_list_selected_widget_get PORTABLE C */ 37 /* 6.1 */ 38 /* AUTHOR */ 39 /* */ 40 /* Kenneth Maxwell, Microsoft Corporation */ 41 /* */ 42 /* DESCRIPTION */ 43 /* */ 44 /* This service gets the list entry at the current list index. */ 45 /* */ 46 /* INPUT */ 47 /* */ 48 /* horizontal_list Horizontal list widget */ 49 /* control block */ 50 /* return_list_entry Destination for return list */ 51 /* entry widget */ 52 /* */ 53 /* OUTPUT */ 54 /* */ 55 /* status Completion status */ 56 /* */ 57 /* CALLS */ 58 /* */ 59 /* None */ 60 /* */ 61 /* CALLED BY */ 62 /* */ 63 /* Application Code */ 64 /* */ 65 /* RELEASE HISTORY */ 66 /* */ 67 /* DATE NAME DESCRIPTION */ 68 /* */ 69 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ 70 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */ 71 /* resulting in version 6.1 */ 72 /* */ 73 /**************************************************************************/ _gx_horizontal_list_selected_widget_get(GX_HORIZONTAL_LIST * horizontal_list,GX_WIDGET ** return_list_entry)74UINT _gx_horizontal_list_selected_widget_get(GX_HORIZONTAL_LIST *horizontal_list, 75 GX_WIDGET **return_list_entry) 76 { 77 INT page_index; 78 GX_WIDGET *child = _gx_widget_first_client_child_get((GX_WIDGET *)horizontal_list); 79 80 if (horizontal_list -> gx_horizontal_list_selected < horizontal_list -> gx_horizontal_list_top_index) 81 { 82 page_index = horizontal_list -> gx_horizontal_list_total_columns - horizontal_list -> gx_horizontal_list_top_index; 83 page_index += horizontal_list -> gx_horizontal_list_selected; 84 } 85 else 86 { 87 page_index = horizontal_list -> gx_horizontal_list_selected - horizontal_list -> gx_horizontal_list_top_index; 88 } 89 90 while (child && page_index > 0) 91 { 92 child = _gx_widget_next_client_child_get(child); 93 page_index--; 94 } 95 96 *return_list_entry = child; 97 98 if (child) 99 { 100 return GX_SUCCESS; 101 } 102 return GX_FAILURE; 103 } 104 105