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 #define GX_SOURCE_CODE
22
23
24 /* Include necessary system files. */
25
26 #include "gx_api.h"
27 #include "gx_multi_line_text_view.h"
28 #include "gx_rich_text_view.h"
29 #include "gx_widget.h"
30
31 /**************************************************************************/
32 /* */
33 /* FUNCTION RELEASE */
34 /* */
35 /* _gx_rich_text_view_create PORTABLE C */
36 /* 6.1 */
37 /* AUTHOR */
38 /* */
39 /* Kenneth Maxwell, Microsoft Corporation */
40 /* */
41 /* DESCRIPTION */
42 /* */
43 /* This function creates a rich text view widget. */
44 /* */
45 /* INPUT */
46 /* */
47 /* text_view Rich text view widget control */
48 /* block */
49 /* name Name of the widget */
50 /* parent Pointer to parent widget */
51 /* text_id Resource ID of the text string*/
52 /* fonts Font list */
53 /* style Style of text view widget */
54 /* id Application-defined ID of text*/
55 /* view */
56 /* size Dimension of the widget */
57 /* */
58 /* OUTPUT */
59 /* */
60 /* status Completion status */
61 /* */
62 /* CALLS */
63 /* */
64 /* _gx_multi_line_text_view_create Create multi line text view */
65 /* _gx_widget_link Link the widget to its parent */
66 /* */
67 /* CALLED BY */
68 /* */
69 /* Application Code */
70 /* */
71 /* RELEASE HISTORY */
72 /* */
73 /* DATE NAME DESCRIPTION */
74 /* */
75 /* 09-30-2020 Kenneth Maxwell Initial Version 6.1 */
76 /* */
77 /**************************************************************************/
_gx_rich_text_view_create(GX_RICH_TEXT_VIEW * text_view,GX_CONST GX_CHAR * name,GX_WIDGET * parent,GX_RESOURCE_ID text_id,GX_RICH_TEXT_FONTS * fonts,ULONG style,USHORT id,GX_CONST GX_RECTANGLE * size)78 UINT _gx_rich_text_view_create(GX_RICH_TEXT_VIEW *text_view,
79 GX_CONST GX_CHAR *name,
80 GX_WIDGET *parent,
81 GX_RESOURCE_ID text_id,
82 GX_RICH_TEXT_FONTS *fonts,
83 ULONG style,
84 USHORT id,
85 GX_CONST GX_RECTANGLE *size)
86 {
87
88 /* Call the multi line text view create function. */
89 _gx_multi_line_text_view_create((GX_MULTI_LINE_TEXT_VIEW *)text_view, name, GX_NULL, text_id, style, id, size);
90
91 text_view -> gx_widget_type = GX_TYPE_RICH_TEXT_VIEW;
92 text_view -> gx_widget_draw_function = (VOID (*)(GX_WIDGET *))_gx_rich_text_view_draw;
93 text_view -> gx_window_scroll_info_get = (VOID (*)(struct GX_WINDOW_STRUCT *, ULONG, GX_SCROLL_INFO *))(void (*)(void))_gx_rich_text_view_scroll_info_get;
94 text_view -> gx_rich_text_view_fonts = *fonts;
95 text_view -> gx_rich_text_view_text_total_height = 0;
96
97 /* Determine if a parent widget was provided. */
98 if (parent)
99 {
100 _gx_widget_link(parent, (GX_WIDGET *)text_view);
101 }
102
103 /* Return the error status from window create. */
104 return(GX_SUCCESS);
105 }
106
107