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 /* */
34 /* FUNCTION RELEASE */
35 /* */
36 /* _gx_text_button_create PORTABLE C */
37 /* 6.1 */
38 /* AUTHOR */
39 /* */
40 /* Kenneth Maxwell, Microsoft Corporation */
41 /* */
42 /* DESCRIPTION */
43 /* */
44 /* This function creates a text button, which is a special type of */
45 /* button (widget). */
46 /* */
47 /* INPUT */
48 /* */
49 /* button Button control block */
50 /* name Name of button */
51 /* parent Parent widget control block */
52 /* text_id text resource id */
53 /* style Style of button */
54 /* size Button size */
55 /* */
56 /* OUTPUT */
57 /* */
58 /* status Completion status */
59 /* */
60 /* CALLS */
61 /* */
62 /* memset Set control block to zero */
63 /* _gx_button_create Create the underlying button */
64 /* _gx_widget_link Link the button 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 /* set new event process, */
77 /* added logic to init new */
78 /* structure member for */
79 /* dynamic bidi text support, */
80 /* resulting in version 6.1 */
81 /* */
82 /**************************************************************************/
_gx_text_button_create(GX_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)83 UINT _gx_text_button_create(GX_TEXT_BUTTON *button, GX_CONST GX_CHAR *name,
84 GX_WIDGET *parent, GX_RESOURCE_ID text_id, ULONG style, USHORT Id,
85 GX_CONST GX_RECTANGLE *size)
86 {
87
88 /* Call the prompt create function. */
89 _gx_button_create((GX_BUTTON *)button, name, GX_NULL, style, Id, size);
90
91 /* Populate the rest of button control block - overriding as necessary. */
92 button -> gx_widget_type = GX_TYPE_TEXT_BUTTON;
93 button -> gx_text_button_text_id = text_id;
94 button -> gx_text_button_string.gx_string_ptr = GX_NULL;
95 button -> gx_text_button_string.gx_string_length = 0;
96 button -> gx_widget_draw_function = (VOID (*)(GX_WIDGET *))_gx_text_button_draw;
97 button -> gx_widget_event_process_function = (UINT(*)(GX_WIDGET*, GX_EVENT*))_gx_text_button_event_process;
98 button -> gx_text_button_normal_text_color = GX_COLOR_ID_BUTTON_TEXT;
99 button -> gx_text_button_selected_text_color = GX_COLOR_ID_BUTTON_TEXT;
100 button -> gx_text_button_disabled_text_color = GX_COLOR_ID_DISABLED_TEXT;
101 button -> gx_widget_disabled_fill_color = GX_COLOR_ID_DISABLED_FILL;
102 button -> gx_text_button_font_id = GX_FONT_ID_BUTTON;
103
104 #if defined(GX_DYNAMIC_BIDI_TEXT_SUPPORT)
105 button -> gx_text_button_bidi_resolved_text_info = GX_NULL;
106 #endif
107
108 /* Determine if a parent widget was provided. */
109 if (parent)
110 {
111 _gx_widget_link(parent, (GX_WIDGET *)button);
112 }
113
114 /* Return the status from button create. */
115 return(GX_SUCCESS);
116 }
117
118