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_system.h"
28 #include "gx_window.h"
29 #include "gx_rich_text_view.h"
30 
31 GX_CALLER_CHECKING_EXTERNS
32 
33 /**************************************************************************/
34 /*                                                                        */
35 /*  FUNCTION                                               RELEASE        */
36 /*                                                                        */
37 /*    _gxe_multi_line_text_view_create                    PORTABLE C      */
38 /*                                                           6.1          */
39 /*  AUTHOR                                                                */
40 /*                                                                        */
41 /*    Kenneth Maxwell, Microsoft Corporation                              */
42 /*                                                                        */
43 /*  DESCRIPTION                                                           */
44 /*                                                                        */
45 /*    This function checks for errors in the rich text view create        */
46 /*    function.                                                           */
47 /*                                                                        */
48 /*  INPUT                                                                 */
49 /*                                                                        */
50 /*    text_view                             Rich text view widget control */
51 /*                                            block                       */
52 /*    name                                  Name of the widget            */
53 /*    parent                                Pointer to parent widget      */
54 /*    text_id                               Resource ID of the text string*/
55 /*    fonts                                 Font list                     */
56 /*    style                                 Style of text view widget     */
57 /*    id                                    Application-defined ID of text*/
58 /*                                            view                        */
59 /*    size                                  Dimension of the widget       */
60 /*                                                                        */
61 /*  OUTPUT                                                                */
62 /*                                                                        */
63 /*    status                                Completion status             */
64 /*                                                                        */
65 /*  CALLS                                                                 */
66 /*                                                                        */
67 /*    _gx_rich_text_view_create             Actual rich text view create  */
68 /*                                            function                    */
69 /*                                                                        */
70 /*  CALLED BY                                                             */
71 /*                                                                        */
72 /*    Application Code                                                    */
73 /*                                                                        */
74 /*  RELEASE HISTORY                                                       */
75 /*                                                                        */
76 /*    DATE              NAME                      DESCRIPTION             */
77 /*                                                                        */
78 /*  09-30-2020     Kenneth Maxwell          Initial Version 6.1           */
79 /*                                                                        */
80 /**************************************************************************/
_gxe_rich_text_view_create(GX_RICH_TEXT_VIEW * rich_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,UINT control_block_size)81 UINT    _gxe_rich_text_view_create(GX_RICH_TEXT_VIEW *rich_view,
82                                    GX_CONST GX_CHAR *name,
83                                    GX_WIDGET *parent,
84                                    GX_RESOURCE_ID text_id,
85                                    GX_RICH_TEXT_FONTS *fonts,
86                                    ULONG style,
87                                    USHORT id,
88                                    GX_CONST GX_RECTANGLE *size,
89                                    UINT control_block_size)
90 {
91 UINT status;
92 
93     /* Check for invalid caller of this function.  */
94     GX_INIT_AND_THREADS_CALLER_CHECKING
95 
96     /* Check for invalid pointer.  */
97     if ((rich_view == GX_NULL) || (size == GX_NULL) || (fonts == GX_NULL))
98     {
99         return(GX_PTR_ERROR);
100     }
101 
102     /* Check for invalid control block size. */
103     if (control_block_size != sizeof(GX_RICH_TEXT_VIEW))
104     {
105         return(GX_INVALID_SIZE);
106     }
107 
108     /* Check for widget already created.  */
109     if (rich_view -> gx_widget_type != 0)
110     {
111         return(GX_ALREADY_CREATED);
112     }
113 
114     /* Call actual multi line text input create function.  */
115     status = _gx_rich_text_view_create(rich_view, name, parent, text_id, fonts, style, id, size);
116 
117     /* Return the error status from window create.  */
118     return(status);
119 }
120 
121