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 |
|
|
/** Prompt Management (Prompt) */ |
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_prompt.h" |
29 |
|
|
#include "gx_system.h" |
30 |
|
|
|
31 |
|
|
|
32 |
|
|
/**************************************************************************/ |
33 |
|
|
/* */ |
34 |
|
|
/* FUNCTION RELEASE */ |
35 |
|
|
/* */ |
36 |
|
|
/* _gx_prompt_create PORTABLE C */ |
37 |
|
|
/* 6.1 */ |
38 |
|
|
/* AUTHOR */ |
39 |
|
|
/* */ |
40 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
41 |
|
|
/* */ |
42 |
|
|
/* DESCRIPTION */ |
43 |
|
|
/* */ |
44 |
|
|
/* This function creates a prompt, which is a special type of */ |
45 |
|
|
/* widget. */ |
46 |
|
|
/* */ |
47 |
|
|
/* INPUT */ |
48 |
|
|
/* */ |
49 |
|
|
/* prompt Prompt control block */ |
50 |
|
|
/* name Name of prompt */ |
51 |
|
|
/* parent Parent widget control block */ |
52 |
|
|
/* text_id Resource string id */ |
53 |
|
|
/* style Style of prompt */ |
54 |
|
|
/* prompt_id Application-defined ID of */ |
55 |
|
|
/* prompt. */ |
56 |
|
|
/* size Prompt size */ |
57 |
|
|
/* */ |
58 |
|
|
/* OUTPUT */ |
59 |
|
|
/* */ |
60 |
|
|
/* status Completion status */ |
61 |
|
|
/* */ |
62 |
|
|
/* CALLS */ |
63 |
|
|
/* */ |
64 |
|
|
/* _gx_widget_create Create the underlying widget */ |
65 |
|
|
/* _gx_widget_link Link the widget to its parent */ |
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 |
|
|
/* set new event process, */ |
78 |
|
|
/* added logic to init new */ |
79 |
|
|
/* structure member for */ |
80 |
|
|
/* dynamic bidi text support, */ |
81 |
|
|
/* fixed compiler warnings, */ |
82 |
|
|
/* resulting in version 6.1 */ |
83 |
|
|
/* */ |
84 |
|
|
/**************************************************************************/ |
85 |
|
73549 |
UINT _gx_prompt_create(GX_PROMPT *prompt, GX_CONST GX_CHAR *name, GX_WIDGET *parent, |
86 |
|
|
GX_RESOURCE_ID text_id, ULONG style, USHORT prompt_id, |
87 |
|
|
GX_CONST GX_RECTANGLE *size) |
88 |
|
|
{ |
89 |
|
|
|
90 |
|
|
/* Call the widget create function. */ |
91 |
|
73549 |
_gx_widget_create((GX_WIDGET *)prompt, name, GX_NULL, style, prompt_id, size); |
92 |
|
|
|
93 |
|
|
/* Populate the rest of prompt control block - overriding as necessary. */ |
94 |
|
73549 |
prompt -> gx_widget_type = GX_TYPE_PROMPT; |
95 |
|
73549 |
prompt -> gx_prompt_text_id = text_id; |
96 |
|
73549 |
prompt -> gx_prompt_normal_text_color = GX_COLOR_ID_TEXT; |
97 |
|
73549 |
prompt -> gx_prompt_selected_text_color = GX_COLOR_ID_SELECTED_TEXT; |
98 |
|
73549 |
prompt -> gx_prompt_disabled_text_color = GX_COLOR_ID_DISABLED_TEXT; |
99 |
|
73549 |
prompt -> gx_prompt_string.gx_string_ptr = GX_NULL; |
100 |
|
73549 |
prompt -> gx_prompt_string.gx_string_length = 0; |
101 |
|
73549 |
prompt -> gx_prompt_font_id = GX_FONT_ID_PROMPT; |
102 |
|
73549 |
prompt -> gx_widget_draw_function = (VOID (*)(GX_WIDGET *))_gx_prompt_draw; |
103 |
|
73549 |
prompt -> gx_widget_event_process_function = (UINT(*)(GX_WIDGET*, GX_EVENT*))_gx_prompt_event_process; |
104 |
|
73549 |
prompt -> gx_prompt_text_get_function = (VOID (*)(GX_PROMPT *, GX_STRING *))(void (*)(void))_gx_prompt_text_get_ext; |
105 |
|
|
|
106 |
|
|
#if defined(GX_DYNAMIC_BIDI_TEXT_SUPPORT) |
107 |
|
|
prompt -> gx_prompt_bidi_resolved_text_info = GX_NULL; |
108 |
|
|
#endif |
109 |
|
|
|
110 |
|
|
/* Determine if a parent widget was provided. */ |
111 |
✓✓ |
73549 |
if (parent) |
112 |
|
|
{ |
113 |
|
57212 |
_gx_widget_link(parent, (GX_WIDGET *)prompt); |
114 |
|
|
} |
115 |
|
|
|
116 |
|
|
/* Return the status from widget create. */ |
117 |
|
73549 |
return(GX_SUCCESS); |
118 |
|
|
} |
119 |
|
|
|