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 View Management (Multi Line 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_widget.h" |
28 |
|
|
#include "gx_window.h" |
29 |
|
|
#include "gx_multi_line_text_view.h" |
30 |
|
|
|
31 |
|
|
/**************************************************************************/ |
32 |
|
|
/* */ |
33 |
|
|
/* FUNCTION RELEASE */ |
34 |
|
|
/* */ |
35 |
|
|
/* _gx_multi_line_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 multi-line text view widget. */ |
44 |
|
|
/* */ |
45 |
|
|
/* INPUT */ |
46 |
|
|
/* */ |
47 |
|
|
/* text_view Multi-line text view widget */ |
48 |
|
|
/* control block */ |
49 |
|
|
/* name Name of the text input widget */ |
50 |
|
|
/* parent Pointer to parent widget */ |
51 |
|
|
/* text_id Resource ID of the text string*/ |
52 |
|
|
/* style Style of text view widget */ |
53 |
|
|
/* id Application-defined ID of text*/ |
54 |
|
|
/* view */ |
55 |
|
|
/* size Dimension of text view widget */ |
56 |
|
|
/* */ |
57 |
|
|
/* OUTPUT */ |
58 |
|
|
/* */ |
59 |
|
|
/* status Completion status */ |
60 |
|
|
/* */ |
61 |
|
|
/* CALLS */ |
62 |
|
|
/* */ |
63 |
|
|
/* _gx_window_create Create the window */ |
64 |
|
|
/* _gx_widget_link Link the widget to its parent */ |
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 |
|
|
/* added logic to init new */ |
77 |
|
|
/* structure member for */ |
78 |
|
|
/* dynamic bidi text support, */ |
79 |
|
|
/* fixed compiler warnings, */ |
80 |
|
|
/* resulting in version 6.1 */ |
81 |
|
|
/* */ |
82 |
|
|
/**************************************************************************/ |
83 |
|
2964 |
UINT _gx_multi_line_text_view_create(GX_MULTI_LINE_TEXT_VIEW *text_view, |
84 |
|
|
GX_CONST GX_CHAR *name, |
85 |
|
|
GX_WIDGET *parent, |
86 |
|
|
GX_RESOURCE_ID text_id, |
87 |
|
|
ULONG style, |
88 |
|
|
USHORT id, |
89 |
|
|
GX_CONST GX_RECTANGLE *size) |
90 |
|
|
{ |
91 |
|
|
|
92 |
|
|
/* Call the window create function. */ |
93 |
|
2964 |
_gx_window_create((GX_WINDOW *)text_view, name, GX_NULL, style, id, size); |
94 |
|
|
|
95 |
|
2964 |
text_view -> gx_widget_type = GX_TYPE_MULTI_LINE_TEXT_VIEW; |
96 |
|
2964 |
text_view -> gx_widget_normal_fill_color = GX_COLOR_ID_TEXT_INPUT_FILL; |
97 |
|
2964 |
text_view -> gx_multi_line_text_view_normal_text_color = GX_COLOR_ID_TEXT_INPUT_TEXT; |
98 |
|
2964 |
text_view -> gx_multi_line_text_view_selected_text_color = GX_COLOR_ID_TEXT_INPUT_TEXT; |
99 |
|
2964 |
text_view -> gx_multi_line_text_view_disabled_text_color = GX_COLOR_ID_DISABLED_TEXT; |
100 |
|
2964 |
text_view -> gx_widget_draw_function = (VOID (*)(GX_WIDGET *))_gx_multi_line_text_view_draw; |
101 |
|
2964 |
text_view -> gx_widget_event_process_function = (UINT (*)(GX_WIDGET *, GX_EVENT *))_gx_multi_line_text_view_event_process; |
102 |
|
2964 |
text_view -> gx_window_scroll_info_get = (VOID (*)(struct GX_WINDOW_STRUCT *, ULONG, GX_SCROLL_INFO *))(void (*)(void))_gx_multi_line_text_view_scroll_info_get; |
103 |
|
2964 |
text_view -> gx_multi_line_text_view_text_id = text_id; |
104 |
|
2964 |
text_view -> gx_multi_line_text_view_font_id = GX_FONT_ID_TEXT_INPUT; |
105 |
|
2964 |
text_view -> gx_multi_line_text_view_text.gx_string_ptr = GX_NULL; |
106 |
|
2964 |
text_view -> gx_multi_line_text_view_text.gx_string_length = 0; |
107 |
|
2964 |
text_view -> gx_multi_line_text_view_text_scroll_shift = 0; |
108 |
|
2964 |
text_view -> gx_multi_line_text_view_text_total_rows = 0; |
109 |
|
2964 |
text_view -> gx_multi_line_text_view_text_visible_rows = 0; |
110 |
|
2964 |
text_view -> gx_multi_line_text_view_whitespace = 0; |
111 |
|
2964 |
text_view -> gx_multi_line_text_view_line_space = 0; |
112 |
|
2964 |
text_view -> gx_multi_line_text_view_line_index_old = GX_TRUE; |
113 |
|
2964 |
text_view -> gx_multi_line_text_view_first_cache_line = 0; |
114 |
|
2964 |
text_view -> gx_multi_line_text_view_cache_size = 0; |
115 |
|
|
|
116 |
|
|
#if defined(GX_DYNAMIC_BIDI_TEXT_SUPPORT) |
117 |
|
|
text_view -> gx_multi_line_text_view_bidi_resolved_text_info = GX_NULL; |
118 |
|
|
#endif |
119 |
|
|
|
120 |
|
2964 |
text_view -> gx_widget_status |= GX_STATUS_RESIZE_NOTIFY; |
121 |
|
|
|
122 |
|
2964 |
memset(text_view -> gx_multi_line_text_view_line_index, 0, GX_MULTI_LINE_INDEX_CACHE_SIZE * sizeof(UINT)); |
123 |
|
|
|
124 |
|
|
/* Determine if a parent widget was provided. */ |
125 |
✓✓ |
2964 |
if (parent) |
126 |
|
|
{ |
127 |
|
2139 |
_gx_widget_link(parent, (GX_WIDGET *)text_view); |
128 |
|
|
} |
129 |
|
|
|
130 |
|
|
/* Return the error status from window create. */ |
131 |
|
2964 |
return(GX_SUCCESS); |
132 |
|
|
} |
133 |
|
|
|