1 |
|
|
/*************************************************************************** |
2 |
|
|
* Copyright (c) 2024 Microsoft Corporation |
3 |
|
|
* Copyright (c) 2026-present Eclipse ThreadX contributors |
4 |
|
|
* |
5 |
|
|
* This program and the accompanying materials are made available under the |
6 |
|
|
* terms of the MIT License which is available at |
7 |
|
|
* https://opensource.org/licenses/MIT. |
8 |
|
|
* |
9 |
|
|
* SPDX-License-Identifier: MIT |
10 |
|
|
**************************************************************************/ |
11 |
|
|
|
12 |
|
|
|
13 |
|
|
/**************************************************************************/ |
14 |
|
|
/**************************************************************************/ |
15 |
|
|
/** */ |
16 |
|
|
/** GUIX Component */ |
17 |
|
|
/** */ |
18 |
|
|
/** Text Button Management (Button) */ |
19 |
|
|
/** */ |
20 |
|
|
/**************************************************************************/ |
21 |
|
|
|
22 |
|
|
#define GX_SOURCE_CODE |
23 |
|
|
|
24 |
|
|
|
25 |
|
|
/* Include necessary system files. */ |
26 |
|
|
|
27 |
|
|
#include "gx_api.h" |
28 |
|
|
#include "gx_widget.h" |
29 |
|
|
#include "gx_button.h" |
30 |
|
|
|
31 |
|
|
/**************************************************************************/ |
32 |
|
|
/* */ |
33 |
|
|
/* FUNCTION RELEASE */ |
34 |
|
|
/* */ |
35 |
|
|
/* _gx_multi_line_text_button_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 button, which is a special */ |
44 |
|
|
/* type of button (widget). */ |
45 |
|
|
/* */ |
46 |
|
|
/* INPUT */ |
47 |
|
|
/* */ |
48 |
|
|
/* button Button control block */ |
49 |
|
|
/* name Name of button */ |
50 |
|
|
/* parent Parent widget control block */ |
51 |
|
|
/* text_id text resource id */ |
52 |
|
|
/* style Style of button */ |
53 |
|
|
/* size Button size */ |
54 |
|
|
/* */ |
55 |
|
|
/* OUTPUT */ |
56 |
|
|
/* */ |
57 |
|
|
/* status Completion status */ |
58 |
|
|
/* */ |
59 |
|
|
/* CALLS */ |
60 |
|
|
/* */ |
61 |
|
|
/* memset Set control block to zero */ |
62 |
|
|
/* _gx_button_create Create the underlying button */ |
63 |
|
|
/* _gx_widget_link Link the button to its parent */ |
64 |
|
|
/* */ |
65 |
|
|
/* CALLED BY */ |
66 |
|
|
/* */ |
67 |
|
|
/* Application Code */ |
68 |
|
|
/* */ |
69 |
|
|
/**************************************************************************/ |
70 |
|
364 |
UINT _gx_multi_line_text_button_create(GX_MULTI_LINE_TEXT_BUTTON *button, GX_CONST GX_CHAR *name, |
71 |
|
|
GX_WIDGET *parent, GX_RESOURCE_ID text_id, ULONG style, USHORT Id, |
72 |
|
|
GX_CONST GX_RECTANGLE *size) |
73 |
|
|
{ |
74 |
|
|
|
75 |
|
|
INT line_index; |
76 |
|
|
|
77 |
|
|
/* Call the prompt create function. */ |
78 |
|
364 |
_gx_text_button_create((GX_TEXT_BUTTON *)button, name, GX_NULL, text_id, style, Id, size); |
79 |
|
|
|
80 |
|
|
/* Populate the rest of button control block - overriding as necessary. */ |
81 |
|
364 |
button -> gx_widget_type = GX_TYPE_MULTI_LINE_TEXT_BUTTON; |
82 |
|
364 |
button -> gx_widget_draw_function = (VOID (*)(GX_WIDGET *))_gx_multi_line_text_button_draw; |
83 |
|
364 |
button -> gx_widget_event_process_function = (UINT (*)(GX_WIDGET *, GX_EVENT *))_gx_multi_line_text_button_event_process; |
84 |
|
364 |
button -> gx_multi_line_text_button_line_count = 0; |
85 |
|
|
|
86 |
✓✓ |
1820 |
for (line_index = 0; line_index < GX_MULTI_LINE_TEXT_BUTTON_MAX_LINES; line_index++) |
87 |
|
|
{ |
88 |
|
1456 |
button -> gx_multi_line_text_button_lines[line_index].gx_string_ptr = GX_NULL; |
89 |
|
1456 |
button -> gx_multi_line_text_button_lines[line_index].gx_string_length = 0; |
90 |
|
|
} |
91 |
|
|
|
92 |
|
|
/* Determine if a parent widget was provided. */ |
93 |
✓✓ |
364 |
if (parent) |
94 |
|
|
{ |
95 |
|
363 |
_gx_widget_link(parent, (GX_WIDGET *)button); |
96 |
|
|
} |
97 |
|
|
|
98 |
|
|
/* Return the status from button create. */ |
99 |
|
364 |
return(GX_SUCCESS); |
100 |
|
|
} |
101 |
|
|
|