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 /**   Single Line Text Input Managment (Single 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_single_line_text_input.h"
29 
30 GX_CALLER_CHECKING_EXTERNS
31 /**************************************************************************/
32 /*                                                                        */
33 /*  FUNCTION                                               RELEASE        */
34 /*                                                                        */
35 /*    _gxe_single_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 highlighs text with specified start mark and end mark */
44 /*    index.                                                              */
45 /*                                                                        */
46 /*                                                                        */
47 /*  INPUT                                                                 */
48 /*                                                                        */
49 /*    text_input                            Single-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 /*    _gxe_single_line_text_input_text_select                             */
63 /*                                          Actual single line text input */
64 /*                                            text select call            */
65 /*                                                                        */
66 /*  CALLED BY                                                             */
67 /*                                                                        */
68 /*    Application Code                                                    */
69 /*                                                                        */
70 /*  RELEASE HISTORY                                                       */
71 /*                                                                        */
72 /*    DATE              NAME                      DESCRIPTION             */
73 /*                                                                        */
74 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
75 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
76 /*                                            resulting in version 6.1    */
77 /*                                                                        */
78 /**************************************************************************/
_gxe_single_line_text_input_text_select(GX_SINGLE_LINE_TEXT_INPUT * input,UINT start_index,UINT end_index)79 UINT  _gxe_single_line_text_input_text_select(GX_SINGLE_LINE_TEXT_INPUT *input, UINT start_index, UINT end_index)
80 {
81 UINT status;
82 
83     /* Check for invalid caller.  */
84     GX_INIT_AND_THREADS_CALLER_CHECKING
85 
86     /* Check for invalid pointer. */
87     if (!input)
88     {
89         return(GX_PTR_ERROR);
90     }
91 
92     /* Check for invalid widget. */
93     if (input -> gx_widget_type == 0)
94     {
95         return(GX_INVALID_WIDGET);
96     }
97 
98     /* Check for invalid value. */
99     if ((start_index >= input -> gx_single_line_text_input_string_size) ||
100         (end_index >= input -> gx_single_line_text_input_string_size))
101     {
102         return(GX_INVALID_VALUE);
103     }
104 
105     /* Call actual text input color set. */
106     status = _gx_single_line_text_input_text_select(input, start_index, end_index);
107 
108     return(status);
109 }
110 
111