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 /**   Rich Text View Management (Rich Text View)                          */
18 /**                                                                       */
19 /**************************************************************************/
20 /**************************************************************************/
21 
22 
23 /**************************************************************************/
24 /*                                                                        */
25 /*  COMPONENT DEFINITION                                   RELEASE        */
26 /*                                                                        */
27 /*    gx_rich_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 /*  09-30-2020     Kenneth Maxwell          Initial Version 6.1           */
44 /*                                                                        */
45 /**************************************************************************/
46 #ifndef GX_RICH_TEXT_VIEW_H
47 #define GX_RICH_TEXT_VIEW_H
48 
49 typedef struct GX_RICH_TEXT_LINE_INFO_STRUCT
50 {
51     GX_STRING           gx_rich_text_line_info_text;
52     GX_RICH_TEXT_FORMAT gx_rich_text_line_info_start_format;
53     GX_RICH_TEXT_FORMAT gx_rich_text_line_info_end_format;
54     UINT                gx_rich_text_line_info_text_width;
55     GX_UBYTE            gx_rich_text_line_info_line_height;
56     GX_UBYTE            gx_rich_text_line_info_baseline;
57 } GX_RICH_TEXT_LINE_INFO;
58 
59 
60 /* Define rich text view management function prototypes. */
61 UINT _gx_rich_text_view_context_peek(GX_RICH_TEXT_CONTEXT *context);
62 UINT _gx_rich_text_view_context_pop();
63 UINT _gx_rich_text_view_context_push(GX_RICH_TEXT_CONTEXT *context);
64 UINT _gx_rich_text_view_context_save();
65 UINT _gx_rich_text_view_context_reset();
66 UINT _gx_rich_text_view_context_restore();
67 UINT _gx_rich_text_view_create(GX_RICH_TEXT_VIEW *text_view,
68                                GX_CONST GX_CHAR *name,
69                                GX_WIDGET *parent,
70                                GX_RESOURCE_ID text_id,
71                                GX_RICH_TEXT_FONTS *fonts,
72                                ULONG style,
73                                USHORT id,
74                                GX_CONST GX_RECTANGLE *size);
75 UINT _gx_rich_text_view_tag_enter(GX_RICH_TEXT_VIEW *view, GX_CONST GX_STRING *text, GX_RICH_TEXT_FORMAT *format, GX_UBYTE *handled_bytes);
76 VOID _gx_rich_text_view_draw(GX_RICH_TEXT_VIEW *text_view);
77 UINT _gx_rich_text_view_fonts_set(GX_RICH_TEXT_VIEW *view, GX_RICH_TEXT_FONTS *fonts);
78 UINT _gx_rich_text_view_line_info_get(GX_RICH_TEXT_VIEW *text_view, GX_STRING text, GX_RICH_TEXT_LINE_INFO *line_info, GX_VALUE availlable_width);
79 UINT _gx_rich_text_view_scroll_info_get(GX_RICH_TEXT_VIEW *text_view, ULONG style, GX_SCROLL_INFO *info);
80 VOID _gx_rich_text_view_text_draw(GX_RICH_TEXT_VIEW *text_view);
81 UINT _gx_rich_text_view_text_total_height_calculate(GX_RICH_TEXT_VIEW *text_view);
82 
83 /* Define error checking shells for API services. */
84 UINT _gxe_rich_text_view_create(GX_RICH_TEXT_VIEW *text_view,
85                                 GX_CONST GX_CHAR *name,
86                                 GX_WIDGET *parent,
87                                 GX_RESOURCE_ID text_id,
88                                 GX_RICH_TEXT_FONTS *fonts,
89                                 ULONG style,
90                                 USHORT id,
91                                 GX_CONST GX_RECTANGLE *size,
92                                 UINT control_block_size);
93 UINT _gxe_rich_text_view_fonts_set(GX_RICH_TEXT_VIEW *view, GX_RICH_TEXT_FONTS *fonts);
94 
95 #endif
96