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 /** Window Management (Window) */ 18 /** */ 19 /**************************************************************************/ 20 /**************************************************************************/ 21 22 23 /**************************************************************************/ 24 /* */ 25 /* COMPONENT DEFINITION RELEASE */ 26 /* */ 27 /* gx_window.h PORTABLE C */ 28 /* 6.1 */ 29 /* AUTHOR */ 30 /* */ 31 /* Kenneth Maxwell, Microsoft Corporation */ 32 /* */ 33 /* DESCRIPTION */ 34 /* */ 35 /* This file defines the GUIX window management component, */ 36 /* including all data types and external references. It is assumed */ 37 /* that gx_api.h and gx_port.h have already been included. */ 38 /* */ 39 /* RELEASE HISTORY */ 40 /* */ 41 /* DATE NAME DESCRIPTION */ 42 /* */ 43 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ 44 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */ 45 /* resulting in version 6.1 */ 46 /* */ 47 /**************************************************************************/ 48 49 #ifndef GX_WINDOW_H 50 #define GX_WINDOW_H 51 52 #define LIST_CHILD_ID_START 4096 53 #define GX_SNAP_TIMER 1000 54 #define GX_FLICK_TIMER 1001 55 56 /* Define vertical list management function prototypes. */ 57 58 UINT _gx_horizontal_list_children_position(GX_HORIZONTAL_LIST *list); 59 UINT _gx_horizontal_list_create(GX_HORIZONTAL_LIST *horizontal_list, GX_CONST GX_CHAR *name, 60 GX_WIDGET *parent, INT total_columns, 61 VOID (*callback)(GX_HORIZONTAL_LIST *, GX_WIDGET *, INT), 62 ULONG style, USHORT horizontal_list_id, GX_CONST GX_RECTANGLE *size); 63 64 UINT _gx_horizontal_list_event_process(GX_HORIZONTAL_LIST *list, GX_EVENT *event_ptr); 65 VOID _gx_horizontal_list_left_wrap(GX_HORIZONTAL_LIST *list); 66 UINT _gx_horizontal_list_page_index_set(GX_HORIZONTAL_LIST *list, INT index); 67 VOID _gx_horizontal_list_right_wrap(GX_HORIZONTAL_LIST *list); 68 UINT _gx_horizontal_list_selected_index_get(GX_HORIZONTAL_LIST *horizontal_list, INT *return_index); 69 UINT _gx_horizontal_list_selected_widget_get(GX_HORIZONTAL_LIST *horizontal_list, GX_WIDGET **return_list_entry); 70 UINT _gx_horizontal_list_selected_set(GX_HORIZONTAL_LIST *horizontal_list, INT entry); 71 VOID _gx_horizontal_list_selected_visible(GX_HORIZONTAL_LIST *list, GX_WIDGET *child); 72 VOID _gx_horizontal_list_scroll(GX_HORIZONTAL_LIST *list, INT amount); 73 VOID _gx_horizontal_list_scroll_info_get(GX_WINDOW *win, ULONG style, GX_SCROLL_INFO *info); 74 VOID _gx_horizontal_list_slide_back_check(GX_HORIZONTAL_LIST *list); 75 UINT _gx_horizontal_list_total_columns_set(GX_HORIZONTAL_LIST *list, INT count); 76 77 UINT _gx_popup_list_event_process(GX_POPUP_LIST *popup_list, GX_EVENT *event_ptr); 78 79 UINT _gx_vertical_list_children_position(GX_VERTICAL_LIST *list); 80 UINT _gx_vertical_list_create(GX_VERTICAL_LIST *vertical_list, GX_CONST GX_CHAR *name, 81 GX_WIDGET *parent, INT total_rows, 82 VOID (*callback)(GX_VERTICAL_LIST *, GX_WIDGET *, INT), 83 ULONG style, USHORT vertical_list_id, GX_CONST GX_RECTANGLE *size); 84 85 UINT _gx_vertical_list_event_process(GX_VERTICAL_LIST *list, GX_EVENT *event_ptr); 86 VOID _gx_vertical_list_down_wrap(GX_VERTICAL_LIST *list); 87 UINT _gx_vertical_list_page_index_set(GX_VERTICAL_LIST *list, INT index); 88 UINT _gx_vertical_list_selected_index_get(GX_VERTICAL_LIST *vertical_list, INT *return_index); 89 UINT _gx_vertical_list_selected_widget_get(GX_VERTICAL_LIST *vertical_list, GX_WIDGET **return_list_entry); 90 UINT _gx_vertical_list_selected_set(GX_VERTICAL_LIST *vertical_list, INT index); 91 VOID _gx_vertical_list_selected_visible(GX_VERTICAL_LIST *list, GX_WIDGET *child); 92 VOID _gx_vertical_list_scroll(GX_VERTICAL_LIST *list, INT amount); 93 VOID _gx_vertical_list_scroll_info_get(GX_VERTICAL_LIST *list, ULONG style, GX_SCROLL_INFO *info); 94 VOID _gx_vertical_list_slide_back_check(GX_VERTICAL_LIST *list); 95 UINT _gx_vertical_list_total_rows_set(GX_VERTICAL_LIST *list, INT count); 96 VOID _gx_vertical_list_up_wrap(GX_VERTICAL_LIST *list); 97 98 /* Define window management function prototypes. */ 99 100 VOID _gx_window_background_draw(GX_WINDOW *win); 101 VOID _gx_window_border_draw(GX_WINDOW *win, GX_COLOR fill_color); 102 UINT _gx_window_client_scroll(GX_WINDOW *window, GX_VALUE x_scroll, GX_VALUE y_scroll); 103 UINT _gx_window_client_height_get(GX_WINDOW *window, GX_VALUE *return_height); 104 UINT _gx_window_client_width_get(GX_WINDOW *window, GX_VALUE *return_width); 105 UINT _gx_window_close(GX_WINDOW *window); 106 UINT _gx_window_create(GX_WINDOW *window, GX_CONST GX_CHAR *name, GX_WIDGET *parent, 107 ULONG style, USHORT Id, GX_CONST GX_RECTANGLE *size); 108 VOID _gx_window_draw(GX_WINDOW *window); 109 UINT _gx_window_event_process(GX_WINDOW *window, GX_EVENT *event_ptr); 110 UINT _gx_window_execute(GX_WINDOW *window, ULONG *return_ptr); 111 112 UINT _gx_window_root_create(GX_WINDOW_ROOT *root_window, GX_CONST GX_CHAR *name, GX_CANVAS *canvas, 113 ULONG style, USHORT Id, GX_CONST GX_RECTANGLE *size); 114 UINT _gx_window_root_delete(GX_WINDOW_ROOT *root_window); 115 UINT _gx_window_root_find(GX_WIDGET *widget, GX_WINDOW_ROOT **return_root_window); 116 UINT _gx_window_root_event_process(GX_WINDOW_ROOT *root, GX_EVENT *event_ptr); 117 UINT _gx_window_scroll(GX_WINDOW *window, GX_VALUE x_scroll, GX_VALUE y_scroll); 118 UINT _gx_window_scroll_info_get(GX_WINDOW *window, ULONG type, GX_SCROLL_INFO *return_scroll_info); 119 UINT _gx_window_scrollbar_find(GX_WINDOW *window, USHORT type, GX_SCROLLBAR **return_scrollbar); 120 VOID _gx_window_view_update_detect(GX_WINDOW *win); 121 UINT _gx_window_wallpaper_get(GX_WINDOW *window, GX_RESOURCE_ID *return_wallpaper_id); 122 UINT _gx_window_wallpaper_set(GX_WINDOW *window, GX_RESOURCE_ID wallpaper_id, GX_BOOL tile); 123 124 /* Define error checking shells for API services. These are only referenced by the 125 application. */ 126 127 128 UINT _gxe_window_client_scroll(GX_WINDOW *window, GX_VALUE x_scroll, GX_VALUE y_scroll); 129 UINT _gxe_window_client_height_get(GX_WINDOW *window, GX_VALUE *return_height); 130 UINT _gxe_window_client_width_get(GX_WINDOW *window, GX_VALUE *return_width); 131 UINT _gxe_window_close(GX_WINDOW *window); 132 UINT _gxe_window_create(GX_WINDOW *window, GX_CONST GX_CHAR *name, GX_WIDGET *parent, 133 ULONG style, USHORT Id, GX_CONST GX_RECTANGLE *size, UINT window_control_block_size); 134 UINT _gxe_window_event_process(GX_WINDOW *window, GX_EVENT *event_ptr); 135 UINT _gxe_window_execute(GX_WINDOW *window, ULONG *return_ptr); 136 UINT _gxe_window_root_find(GX_WIDGET *widget, GX_WINDOW_ROOT **return_root_window); 137 UINT _gxe_window_scroll_info_get(GX_WINDOW *window, ULONG type, GX_SCROLL_INFO *return_scroll_info); 138 139 UINT _gxe_window_scrollbar_find(GX_WINDOW *window, USHORT type, GX_SCROLLBAR **return_scrollbar); 140 UINT _gxe_window_wallpaper_get(GX_WINDOW *window, GX_RESOURCE_ID *return_wallpaper_id); 141 UINT _gxe_window_wallpaper_set(GX_WINDOW *window, GX_RESOURCE_ID wallpaper_id, GX_BOOL tile); 142 143 144 UINT _gxe_horizontal_list_children_position(GX_HORIZONTAL_LIST *list); 145 UINT _gxe_horizontal_list_create(GX_HORIZONTAL_LIST *horizontal_list, 146 GX_CONST GX_CHAR *name, 147 GX_WIDGET *parent, INT total_rows, 148 VOID (*callback)(GX_HORIZONTAL_LIST *, GX_WIDGET *, INT), 149 ULONG style, USHORT horizontal_list_id, 150 GX_CONST GX_RECTANGLE *size, 151 UINT horizontal_list_control_block_size); 152 UINT _gxe_horizontal_list_event_process(GX_HORIZONTAL_LIST *list, GX_EVENT *event_ptr); 153 UINT _gxe_horizontal_list_selected_index_get(GX_HORIZONTAL_LIST *horizontal_list, INT *return_index); 154 UINT _gxe_horizontal_list_selected_set(GX_HORIZONTAL_LIST *horizontal_list, INT index); 155 UINT _gxe_horizontal_list_selected_widget_get(GX_HORIZONTAL_LIST *horizontal_list, GX_WIDGET **return_list_entry); 156 UINT _gxe_horizontal_list_total_columns_set(GX_HORIZONTAL_LIST *list, INT count); 157 UINT _gxe_horizontal_list_page_index_set(GX_HORIZONTAL_LIST *vertical_list, INT index); 158 159 UINT _gxe_vertical_list_children_position(GX_VERTICAL_LIST *list); 160 UINT _gxe_vertical_list_create(GX_VERTICAL_LIST *vertical_list, GX_CONST GX_CHAR *name, 161 GX_WIDGET *parent, INT total_rows, 162 VOID (*callback)(GX_VERTICAL_LIST *, GX_WIDGET *, INT), 163 ULONG style, USHORT vertical_list_id, GX_CONST GX_RECTANGLE *size, 164 UINT vertical_list_control_block_size); 165 UINT _gxe_vertical_list_event_process(GX_VERTICAL_LIST *list, GX_EVENT *event_ptr); 166 UINT _gxe_vertical_list_selected_set(GX_VERTICAL_LIST *vertical_list, INT index); 167 UINT _gxe_vertical_list_selected_index_get(GX_VERTICAL_LIST *vertical_list, INT *return_index); 168 UINT _gxe_vertical_list_selected_widget_get(GX_VERTICAL_LIST *vertical_list, GX_WIDGET **return_list_entry); 169 UINT _gxe_vertical_list_total_rows_set(GX_VERTICAL_LIST *list, INT count); 170 UINT _gxe_vertical_list_page_index_set(GX_VERTICAL_LIST *horizontal_list, INT list_entry); 171 172 UINT _gxe_window_root_create(GX_WINDOW_ROOT *root_window, GX_CONST GX_CHAR *name, 173 GX_CANVAS *canvas, ULONG style, USHORT Id, GX_CONST GX_RECTANGLE *size, UINT root_window_control_block_size); 174 UINT _gxe_window_root_delete(GX_WINDOW_ROOT *root_window); 175 UINT _gxe_window_root_event_process(GX_WINDOW_ROOT *root, GX_EVENT *event_ptr); 176 177 #endif 178 179