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 /** Multi Line Text Input Management (Multi Line Text Input) */ 18 /** */ 19 /**************************************************************************/ 20 /**************************************************************************/ 21 22 23 /**************************************************************************/ 24 /* */ 25 /* COMPONENT DEFINITION RELEASE */ 26 /* */ 27 /* gx_multi_line_text_input.h PORTABLE C */ 28 /* 6.1 */ 29 /* AUTHOR */ 30 /* */ 31 /* Kenneth Maxwell, Microsoft Corporation */ 32 /* */ 33 /* DESCRIPTION */ 34 /* */ 35 /* This file defines the GUIX multi line text input management */ 36 /* component, including all data types and external references. It is */ 37 /* assumed 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 #define ID_TEXT_INPUT_TIMER 2 49 #define GX_MARK_TIMER 3 50 51 #define NUM_BEF_CURSOR 1 52 #define NUM_AFT_CURSOR 3 53 54 #define GX_MARK_INTERVAL 5 55 56 /* Define multi-line text input management function prototypes. */ 57 UINT _gx_multi_line_text_input_backspace(GX_MULTI_LINE_TEXT_INPUT *text_input); 58 UINT _gx_multi_line_text_input_buffer_clear(GX_MULTI_LINE_TEXT_INPUT *text_input); 59 UINT _gx_multi_line_text_input_buffer_get(GX_MULTI_LINE_TEXT_INPUT *text_input_ptr, GX_CHAR **buffer_address, 60 UINT *content_size, UINT *buffer_size); 61 62 #if defined(GX_ENABLE_DEPRECATED_STRING_API) 63 UINT _gx_multi_line_text_input_char_insert(GX_MULTI_LINE_TEXT_INPUT *text_input, GX_UBYTE *str, UINT str_size); 64 #endif 65 UINT _gx_multi_line_text_input_char_insert_ext(GX_MULTI_LINE_TEXT_INPUT *text_input, GX_CONST GX_STRING *str); 66 UINT _gx_multi_line_text_input_char_remove(GX_MULTI_LINE_TEXT_INPUT *text_input, UINT index, UINT del_bytes); 67 UINT _gx_multi_line_text_input_copy(GX_MULTI_LINE_TEXT_INPUT *input); 68 UINT _gx_multi_line_text_input_create(GX_MULTI_LINE_TEXT_INPUT *text_input_ptr, 69 GX_CONST GX_CHAR *name_ptr, GX_WIDGET *parent, 70 GX_CHAR *input_buffer, UINT buffer_size, ULONG style, USHORT Id, 71 GX_CONST GX_RECTANGLE *size); 72 UINT _gx_multi_line_text_input_cursor_pos_calculate(GX_MULTI_LINE_TEXT_INPUT *text_input, GX_POINT click_pos); 73 UINT _gx_multi_line_text_input_cursor_pos_get(GX_MULTI_LINE_TEXT_INPUT *input, GX_POINT *cursor_pos); 74 UINT _gx_multi_line_text_input_cursor_pos_update(GX_MULTI_LINE_TEXT_INPUT *text_input, GX_BOOL make_cursor_visible); 75 UINT _gx_multi_line_text_input_cursor_visible(GX_MULTI_LINE_TEXT_INPUT *text_input); 76 UINT _gx_multi_line_text_input_cut(GX_MULTI_LINE_TEXT_INPUT *input); 77 UINT _gx_multi_line_text_input_delete(GX_MULTI_LINE_TEXT_INPUT *text_input); 78 UINT _gx_multi_line_text_input_down_arrow(GX_MULTI_LINE_TEXT_INPUT *text_input); 79 VOID _gx_multi_line_text_input_draw(GX_MULTI_LINE_TEXT_INPUT *text_input); 80 UINT _gx_multi_line_text_input_end(GX_MULTI_LINE_TEXT_INPUT *text_input); 81 UINT _gx_multi_line_text_input_event_process(GX_MULTI_LINE_TEXT_INPUT *text_input, GX_EVENT *event_ptr); 82 UINT _gx_multi_line_text_input_fill_color_set(GX_MULTI_LINE_TEXT_INPUT *input, 83 GX_RESOURCE_ID normal_fill_color_id, 84 GX_RESOURCE_ID selected_fill_color_id, 85 GX_RESOURCE_ID disabled_fill_color_id, 86 GX_RESOURCE_ID readonly_fill_color_id); 87 UINT _gx_multi_line_text_input_home(GX_MULTI_LINE_TEXT_INPUT *text_input); 88 UINT _gx_multi_line_text_input_highlight_rectangle_get(GX_MULTI_LINE_TEXT_INPUT *input, GX_RECTANGLE *rect); 89 UINT _gx_multi_line_text_input_keydown_process(GX_MULTI_LINE_TEXT_INPUT *text_input, GX_EVENT *event_ptr); 90 UINT _gx_multi_line_text_input_left_arrow(GX_MULTI_LINE_TEXT_INPUT *text_input); 91 UINT _gx_multi_line_text_input_mark_end(GX_MULTI_LINE_TEXT_INPUT *text_input); 92 UINT _gx_multi_line_text_input_mark_home(GX_MULTI_LINE_TEXT_INPUT *text_input); 93 UINT _gx_multi_line_text_input_mark_next(GX_MULTI_LINE_TEXT_INPUT *text_input); 94 UINT _gx_multi_line_text_input_mark_previous(GX_MULTI_LINE_TEXT_INPUT *text_input); 95 UINT _gx_multi_line_text_input_mark_up(GX_MULTI_LINE_TEXT_INPUT *text_input); 96 UINT _gx_multi_line_text_input_mark_down(GX_MULTI_LINE_TEXT_INPUT *text_input); 97 UINT _gx_multi_line_text_input_paste(GX_MULTI_LINE_TEXT_INPUT *input); 98 UINT _gx_multi_line_text_input_right_arrow(GX_MULTI_LINE_TEXT_INPUT *text_input); 99 UINT _gx_multi_line_text_input_style_add(GX_MULTI_LINE_TEXT_INPUT *text_input_ptr, ULONG cursor_type); 100 UINT _gx_multi_line_text_input_style_remove(GX_MULTI_LINE_TEXT_INPUT *text_input_ptr, ULONG cursor_type); 101 UINT _gx_multi_line_text_input_style_set(GX_MULTI_LINE_TEXT_INPUT *text_input_ptr, ULONG cursor_type); 102 UINT _gx_multi_line_text_input_text_color_set(GX_MULTI_LINE_TEXT_INPUT *input, 103 GX_RESOURCE_ID normal_text_color_id, 104 GX_RESOURCE_ID selected_text_color_id, 105 GX_RESOURCE_ID disabled_text_color_id, 106 GX_RESOURCE_ID readonly_text_color_id); 107 UINT _gx_multi_line_text_input_text_rectangle_get(GX_MULTI_LINE_TEXT_INPUT *input, GX_POINT start_cursor_pos, GX_POINT end_cursor_pos, GX_RECTANGLE *rect); 108 UINT _gx_multi_line_text_input_text_select(GX_MULTI_LINE_TEXT_INPUT *input, UINT start_index, UINT end_index); 109 #if defined(GX_ENABLE_DEPRECATED_STRING_API) 110 UINT _gx_multi_line_text_input_text_set(GX_MULTI_LINE_TEXT_INPUT *text_input, GX_CONST GX_CHAR *text); 111 #endif 112 UINT _gx_multi_line_text_input_text_set_ext(GX_MULTI_LINE_TEXT_INPUT *text_input, GX_CONST GX_STRING *text); 113 UINT _gx_multi_line_text_input_up_arrow(GX_MULTI_LINE_TEXT_INPUT *text_input); 114 115 /* Define error checking shells for API services. These are only referenced by the 116 application. */ 117 UINT _gxe_multi_line_text_input_backspace(GX_MULTI_LINE_TEXT_INPUT *text_input); 118 UINT _gxe_multi_line_text_input_buffer_clear(GX_MULTI_LINE_TEXT_INPUT *text_input); 119 UINT _gxe_multi_line_text_input_buffer_get(GX_MULTI_LINE_TEXT_INPUT *text_input_ptr, GX_CHAR **buffer_address, 120 UINT *content_size, UINT *buffer_size); 121 #if defined(GX_ENABLE_DEPRECATED_STRING_API) 122 UINT _gxe_multi_line_text_input_char_insert(GX_MULTI_LINE_TEXT_INPUT *text_input, GX_UBYTE *str, UINT str_size); 123 #endif 124 UINT _gxe_multi_line_text_input_char_insert_ext(GX_MULTI_LINE_TEXT_INPUT *text_input, GX_CONST GX_STRING *str); 125 UINT _gxe_multi_line_text_input_create(GX_MULTI_LINE_TEXT_INPUT *text_input_ptr, GX_CONST GX_CHAR *name_ptr, GX_WIDGET *parent, 126 GX_CHAR *input_buffer, UINT buffer_size, ULONG style, USHORT Id, GX_CONST GX_RECTANGLE *size, 127 UINT text_input_control_block_size); 128 UINT _gxe_multi_line_text_input_cursor_pos_get(GX_MULTI_LINE_TEXT_INPUT *input, GX_POINT *cursor_pos); 129 UINT _gxe_multi_line_text_input_delete(GX_MULTI_LINE_TEXT_INPUT *text_input); 130 UINT _gxe_multi_line_text_input_down_arrow(GX_MULTI_LINE_TEXT_INPUT *text_input); 131 UINT _gxe_multi_line_text_input_end(GX_MULTI_LINE_TEXT_INPUT *text_input); 132 UINT _gxe_multi_line_text_input_event_process(GX_MULTI_LINE_TEXT_INPUT *input, GX_EVENT *event_ptr); 133 UINT _gxe_multi_line_text_input_fill_color_set(GX_MULTI_LINE_TEXT_INPUT *input, 134 GX_RESOURCE_ID normal_fill_color_id, 135 GX_RESOURCE_ID selected_fill_color_id, 136 GX_RESOURCE_ID disabled_fill_color_id, 137 GX_RESOURCE_ID readonly_fill_color_id); 138 UINT _gxe_multi_line_text_input_home(GX_MULTI_LINE_TEXT_INPUT *text_input); 139 UINT _gxe_multi_line_text_input_left_arrow(GX_MULTI_LINE_TEXT_INPUT *text_input); 140 UINT _gxe_multi_line_text_input_right_arrow(GX_MULTI_LINE_TEXT_INPUT *text_input); 141 UINT _gxe_multi_line_text_input_style_add(GX_MULTI_LINE_TEXT_INPUT *text_input_ptr, ULONG cursor_type); 142 UINT _gxe_multi_line_text_input_style_remove(GX_MULTI_LINE_TEXT_INPUT *text_input_ptr, ULONG cursor_type); 143 UINT _gxe_multi_line_text_input_style_set(GX_MULTI_LINE_TEXT_INPUT *text_input_ptr, ULONG cursor_type); 144 UINT _gxe_multi_line_text_input_text_color_set(GX_MULTI_LINE_TEXT_INPUT *input, 145 GX_RESOURCE_ID normal_text_color_id, 146 GX_RESOURCE_ID selected_text_color_id, 147 GX_RESOURCE_ID disabled_text_color_id, 148 GX_RESOURCE_ID readonly_text_color_id); 149 UINT _gxe_multi_line_text_input_text_select(GX_MULTI_LINE_TEXT_INPUT *input, UINT start_index, UINT end_index); 150 #if defined(GX_ENABLE_DEPRECATED_STRING_API) 151 UINT _gxe_multi_line_text_input_text_set(GX_MULTI_LINE_TEXT_INPUT *input, GX_CONST GX_CHAR *text); 152 #endif 153 UINT _gxe_multi_line_text_input_text_set_ext(GX_MULTI_LINE_TEXT_INPUT *input, GX_CONST GX_STRING *text); 154 UINT _gxe_multi_line_text_input_up_arrow(GX_MULTI_LINE_TEXT_INPUT *text_input); 155 156