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 Managment (Multi Line Text Input)             */
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_multi_line_text_input.h"
29 
30 GX_CALLER_CHECKING_EXTERNS
31 /**************************************************************************/
32 /*                                                                        */
33 /*  FUNCTION                                               RELEASE        */
34 /*                                                                        */
35 /*    _gxe_multi_line_text_input_text_select              PORTABLE C      */
36 /*                                                           6.1          */
37 /*  AUTHOR                                                                */
38 /*                                                                        */
39 /*    Kenneth Maxwell, Microsoft Corporation                              */
40 /*                                                                        */
41 /*  DESCRIPTION                                                           */
42 /*                                                                        */
43 /*    This function checks for errors in the multi line text input text   */
44 /*    select function call.                                               */
45 /*                                                                        */
46 /*                                                                        */
47 /*  INPUT                                                                 */
48 /*                                                                        */
49 /*    input                                 Multi-line text input widget  */
50 /*                                            control block               */
51 /*    start_mark                            The index of the first        */
52 /*                                            highlight character.        */
53 /*    end_mark                              The index of the last         */
54 /*                                            highlight character         */
55 /*                                                                        */
56 /*  OUTPUT                                                                */
57 /*                                                                        */
58 /*    status                                Completion status             */
59 /*                                                                        */
60 /*  CALLS                                                                 */
61 /*                                                                        */
62 /*    _gx_multi_line_text_input_text_select Actual multi line text input  */
63 /*                                            text select fucntion        */
64 /*                                                                        */
65 /*  CALLED BY                                                             */
66 /*                                                                        */
67 /*    Application Code                                                    */
68 /*                                                                        */
69 /*  RELEASE HISTORY                                                       */
70 /*                                                                        */
71 /*    DATE              NAME                      DESCRIPTION             */
72 /*                                                                        */
73 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
74 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
75 /*                                            resulting in version 6.1    */
76 /*                                                                        */
77 /**************************************************************************/
_gxe_multi_line_text_input_text_select(GX_MULTI_LINE_TEXT_INPUT * input,UINT start_index,UINT end_index)78 UINT _gxe_multi_line_text_input_text_select(GX_MULTI_LINE_TEXT_INPUT *input, UINT start_index, UINT end_index)
79 {
80 UINT status;
81 
82     /* Check for invalid caller.  */
83     GX_INIT_AND_THREADS_CALLER_CHECKING
84 
85     if (!input)
86     {
87         return(GX_PTR_ERROR);
88     }
89 
90     /* Check for invalid widget. */
91     if (input -> gx_widget_type == 0)
92     {
93         return(GX_INVALID_WIDGET);
94     }
95 
96     /* Check for invalid index value. */
97     if ((start_index >= input -> gx_multi_line_text_view_text.gx_string_length) ||
98         (end_index >= input -> gx_multi_line_text_view_text.gx_string_length))
99     {
100         return(GX_INVALID_VALUE);
101     }
102 
103     status = _gx_multi_line_text_input_text_select(input, start_index, end_index);
104 
105     return(status);
106 }
107 
108