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 /** 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 /* 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 /**************************************************************************/
_gx_multi_line_text_button_create(GX_MULTI_LINE_TEXT_BUTTON * button,GX_CONST GX_CHAR * name,GX_WIDGET * parent,GX_RESOURCE_ID text_id,ULONG style,USHORT Id,GX_CONST GX_RECTANGLE * size)78 UINT _gx_multi_line_text_button_create(GX_MULTI_LINE_TEXT_BUTTON *button, GX_CONST GX_CHAR *name,
79 GX_WIDGET *parent, GX_RESOURCE_ID text_id, ULONG style, USHORT Id,
80 GX_CONST GX_RECTANGLE *size)
81 {
82
83 INT line_index;
84
85 /* Call the prompt create function. */
86 _gx_text_button_create((GX_TEXT_BUTTON *)button, name, GX_NULL, text_id, style, Id, size);
87
88 /* Populate the rest of button control block - overriding as necessary. */
89 button -> gx_widget_type = GX_TYPE_MULTI_LINE_TEXT_BUTTON;
90 button -> gx_widget_draw_function = (VOID (*)(GX_WIDGET *))_gx_multi_line_text_button_draw;
91 button -> gx_widget_event_process_function = (UINT (*)(GX_WIDGET *, GX_EVENT *))_gx_multi_line_text_button_event_process;
92 button -> gx_multi_line_text_button_line_count = 0;
93
94 for (line_index = 0; line_index < GX_MULTI_LINE_TEXT_BUTTON_MAX_LINES; line_index++)
95 {
96 button -> gx_multi_line_text_button_lines[line_index].gx_string_ptr = GX_NULL;
97 button -> gx_multi_line_text_button_lines[line_index].gx_string_length = 0;
98 }
99
100 /* Determine if a parent widget was provided. */
101 if (parent)
102 {
103 _gx_widget_link(parent, (GX_WIDGET *)button);
104 }
105
106 /* Return the status from button create. */
107 return(GX_SUCCESS);
108 }
109
110