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 View Management (Multi Line Text View)              */
18 /**                                                                       */
19 /**************************************************************************/
20 /**************************************************************************/
21 
22 
23 /**************************************************************************/
24 /*                                                                        */
25 /*  COMPONENT DEFINITION                                   RELEASE        */
26 /*                                                                        */
27 /*    gx_multi_line_text_view.h                           PORTABLE C      */
28 /*                                                           6.1          */
29 /*  AUTHOR                                                                */
30 /*                                                                        */
31 /*    Kenneth Maxwell, Microsoft Corporation                              */
32 /*                                                                        */
33 /*  DESCRIPTION                                                           */
34 /*                                                                        */
35 /*    This file defines the GUIX text view 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 /* Define multi-line text view management function prototypes. */
50 UINT _gx_multi_line_text_view_create(GX_MULTI_LINE_TEXT_VIEW *text_view_ptr,
51                                      GX_CONST GX_CHAR *name_ptr,
52                                      GX_WIDGET *parent, GX_RESOURCE_ID text_id,
53                                      ULONG style, USHORT Id,
54                                      GX_CONST GX_RECTANGLE *size);
55 VOID _gx_multi_line_text_view_display_info_get(GX_MULTI_LINE_TEXT_VIEW *text_view, UINT start_index,
56                                                UINT end_index, GX_MULTI_LINE_TEXT_INFO *text_info, GX_VALUE available_width);
57 VOID _gx_multi_line_text_view_draw(GX_MULTI_LINE_TEXT_VIEW *view);
58 VOID _gx_multi_line_text_view_text_draw(GX_MULTI_LINE_TEXT_VIEW *text_view, GX_RESOURCE_ID text_color);
59 UINT _gx_multi_line_text_view_event_process(GX_MULTI_LINE_TEXT_VIEW *view, GX_EVENT *event_ptr);
60 UINT _gx_multi_line_text_view_font_set(GX_MULTI_LINE_TEXT_VIEW *view, GX_RESOURCE_ID font_id);
61 UINT _gx_multi_line_text_view_line_space_set(GX_MULTI_LINE_TEXT_VIEW *view, GX_BYTE line_space);
62 UINT _gx_multi_line_text_view_line_cache_update(GX_MULTI_LINE_TEXT_VIEW *view);
63 UINT _gx_multi_line_text_view_scroll(GX_MULTI_LINE_TEXT_VIEW *view, GX_VALUE amount_to_scroll);
64 UINT _gx_multi_line_text_view_scroll_info_get(GX_MULTI_LINE_TEXT_VIEW *view, ULONG style, GX_SCROLL_INFO *info);
65 UINT _gx_multi_line_text_view_string_total_rows_compute(GX_MULTI_LINE_TEXT_VIEW *text_view);
66 UINT _gx_multi_line_text_view_text_color_set(GX_MULTI_LINE_TEXT_VIEW *text_view,
67                                              GX_RESOURCE_ID normal_text_color_id,
68                                              GX_RESOURCE_ID selected_text_color_id,
69                                              GX_RESOURCE_ID disabled_text_color_id);
70 UINT _gx_multi_line_text_view_text_id_set(GX_MULTI_LINE_TEXT_VIEW *text_view_ptr,
71                                           GX_RESOURCE_ID text_id);
72 #if defined(GX_ENABLE_DEPRECATED_STRING_API)
73 UINT _gx_multi_line_text_view_text_set(GX_MULTI_LINE_TEXT_VIEW *view, GX_CONST GX_CHAR *text);
74 #endif
75 UINT _gx_multi_line_text_view_text_set_ext(GX_MULTI_LINE_TEXT_VIEW *view, GX_CONST GX_STRING *text);
76 UINT _gx_multi_line_text_view_visible_rows_compute(GX_MULTI_LINE_TEXT_VIEW *view);
77 UINT _gx_multi_line_text_view_whitespace_set(GX_MULTI_LINE_TEXT_VIEW *view, GX_UBYTE whitespace);
78 
79 /* Define error checking shells for API services.  These are only referenced by the
80    application.  */
81 UINT _gxe_multi_line_text_view_create(GX_MULTI_LINE_TEXT_VIEW *text_view_ptr, GX_CONST GX_CHAR *name_ptr, GX_WIDGET *parent,
82                                       GX_RESOURCE_ID text_id, ULONG style, USHORT Id, GX_CONST GX_RECTANGLE *size,
83                                       UINT text_view_control_block_size);
84 UINT _gxe_multi_line_text_view_event_process(GX_MULTI_LINE_TEXT_VIEW *view, GX_EVENT *event_ptr);
85 UINT _gxe_multi_line_text_view_font_set(GX_MULTI_LINE_TEXT_VIEW *view, GX_RESOURCE_ID font_id);
86 UINT _gxe_multi_line_text_view_line_space_set(GX_MULTI_LINE_TEXT_VIEW *view, GX_BYTE line_space);
87 UINT _gxe_multi_line_text_view_scroll_info_get(GX_MULTI_LINE_TEXT_VIEW *view, ULONG style, GX_SCROLL_INFO *info);
88 UINT _gxe_multi_line_text_view_text_color_set(GX_MULTI_LINE_TEXT_VIEW *view,
89                                               GX_RESOURCE_ID normal_text_color_id,
90                                               GX_RESOURCE_ID selected_text_color_id,
91                                               GX_RESOURCE_ID disabled_text_color_id);
92 UINT _gxe_multi_line_text_view_text_id_set(GX_MULTI_LINE_TEXT_VIEW *text_view_ptr,
93                                            GX_RESOURCE_ID text_id);
94 
95 #if defined(GX_ENABLE_DEPRECATED_STRING_API)
96 UINT _gxe_multi_line_text_view_text_set(GX_MULTI_LINE_TEXT_VIEW *view, GX_CONST GX_CHAR *text);
97 #endif
98 UINT _gxe_multi_line_text_view_text_set_ext(GX_MULTI_LINE_TEXT_VIEW *view, GX_CONST GX_STRING *text);
99 
100 UINT _gxe_multi_line_text_view_whitespace_set(GX_MULTI_LINE_TEXT_VIEW *view, GX_UBYTE whitespace);
101 
102 UINT _gxe_rich_text_view_create(GX_RICH_TEXT_VIEW *rich_view,
103                                 GX_CONST GX_CHAR *name,
104                                 GX_WIDGET *parent,
105                                 GX_RESOURCE_ID text_id,
106                                 GX_RICH_TEXT_FONTS *fonts,
107                                 ULONG style,
108                                 USHORT id,
109                                 GX_CONST GX_RECTANGLE *size,
110                                 UINT control_block_size);
111 UINT _gxe_rich_text_view_fonts_set(GX_RICH_TEXT_VIEW *rich_view, GX_RICH_TEXT_FONTS *fonts);
112 
113