1 /**************************************************************************/
2 /*                                                                        */
3 /*       Copyright (c) Microsoft Corporation. All rights reserved.        */
4 /*                                                                        */
5 /*       This software is licensed under the Microsoft Software License   */
6 /*       Terms for Microsoft Azure RTOS. Full text of the license can be  */
7 /*       found in the LICENSE file at https://aka.ms/AzureRTOS_EULA       */
8 /*       and in the root directory of this software.                      */
9 /*                                                                        */
10 /**************************************************************************/
11 
12 
13 /**************************************************************************/
14 /**************************************************************************/
15 /**                                                                       */
16 /** GUIX Component                                                        */
17 /**                                                                       */
18 /**   Single Line Text Input Managment (Single Line Text Input)           */
19 /**                                                                       */
20 /**************************************************************************/
21 
22 #define GX_SOURCE_CODE
23 
24 
25 /* Include necessary system files.  */
26 
27 #include "gx_api.h"
28 #include "gx_system.h"
29 #include "gx_single_line_text_input.h"
30 
31 GX_CALLER_CHECKING_EXTERNS
32 /**************************************************************************/
33 /*                                                                        */
34 /*  FUNCTION                                               RELEASE        */
35 /*                                                                        */
36 /*    _gxe_single_line_text_input_text_select             PORTABLE C      */
37 /*                                                           6.1          */
38 /*  AUTHOR                                                                */
39 /*                                                                        */
40 /*    Kenneth Maxwell, Microsoft Corporation                              */
41 /*                                                                        */
42 /*  DESCRIPTION                                                           */
43 /*                                                                        */
44 /*    This function highlighs text with specified start mark and end mark */
45 /*    index.                                                              */
46 /*                                                                        */
47 /*                                                                        */
48 /*  INPUT                                                                 */
49 /*                                                                        */
50 /*    text_input                            Single-line text input widget */
51 /*                                            control block               */
52 /*    start_mark                            The index of the first        */
53 /*                                            highlight character.        */
54 /*    end_mark                              The index of the last         */
55 /*                                            highlight character         */
56 /*                                                                        */
57 /*  OUTPUT                                                                */
58 /*                                                                        */
59 /*    status                                Completion status             */
60 /*                                                                        */
61 /*  CALLS                                                                 */
62 /*                                                                        */
63 /*    _gxe_single_line_text_input_text_select                             */
64 /*                                          Actual single line text input */
65 /*                                            text select call            */
66 /*                                                                        */
67 /*  CALLED BY                                                             */
68 /*                                                                        */
69 /*    Application Code                                                    */
70 /*                                                                        */
71 /*  RELEASE HISTORY                                                       */
72 /*                                                                        */
73 /*    DATE              NAME                      DESCRIPTION             */
74 /*                                                                        */
75 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
76 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
77 /*                                            resulting in version 6.1    */
78 /*                                                                        */
79 /**************************************************************************/
_gxe_single_line_text_input_text_select(GX_SINGLE_LINE_TEXT_INPUT * input,UINT start_index,UINT end_index)80 UINT  _gxe_single_line_text_input_text_select(GX_SINGLE_LINE_TEXT_INPUT *input, UINT start_index, UINT end_index)
81 {
82 UINT status;
83 
84     /* Check for invalid caller.  */
85     GX_INIT_AND_THREADS_CALLER_CHECKING
86 
87     /* Check for invalid pointer. */
88     if (!input)
89     {
90         return(GX_PTR_ERROR);
91     }
92 
93     /* Check for invalid widget. */
94     if (input -> gx_widget_type == 0)
95     {
96         return(GX_INVALID_WIDGET);
97     }
98 
99     /* Check for invalid value. */
100     if ((start_index >= input -> gx_single_line_text_input_string_size) ||
101         (end_index >= input -> gx_single_line_text_input_string_size))
102     {
103         return(GX_INVALID_VALUE);
104     }
105 
106     /* Call actual text input color set. */
107     status = _gx_single_line_text_input_text_select(input, start_index, end_index);
108 
109     return(status);
110 }
111 
112