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 |
|
|
/** 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_button.h" |
29 |
|
|
#include "gx_utility.h" |
30 |
|
|
#include "gx_system.h" |
31 |
|
|
|
32 |
|
|
/**************************************************************************/ |
33 |
|
|
/* */ |
34 |
|
|
/* FUNCTION RELEASE */ |
35 |
|
|
/* */ |
36 |
|
|
/* _gx_text_button_event_process PORTABLE C */ |
37 |
|
|
/* 6.1 */ |
38 |
|
|
/* AUTHOR */ |
39 |
|
|
/* */ |
40 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
41 |
|
|
/* */ |
42 |
|
|
/* DESCRIPTION */ |
43 |
|
|
/* */ |
44 |
|
|
/* This function processes events for the specified text button. */ |
45 |
|
|
/* */ |
46 |
|
|
/* INPUT */ |
47 |
|
|
/* */ |
48 |
|
|
/* button Pointer to text button */ |
49 |
|
|
/* control block */ |
50 |
|
|
/* event_ptr Incoming event to process */ |
51 |
|
|
/* */ |
52 |
|
|
/* OUTPUT */ |
53 |
|
|
/* */ |
54 |
|
|
/* status Completion status */ |
55 |
|
|
/* */ |
56 |
|
|
/* CALLS */ |
57 |
|
|
/* */ |
58 |
|
|
/* _gx_utility_bidi_resolved_text_info_delete */ |
59 |
|
|
/* Delete dynamic bidi text */ |
60 |
|
|
/* _gx_button_event_process Default widget event process */ |
61 |
|
|
/* */ |
62 |
|
|
/* CALLED BY */ |
63 |
|
|
/* */ |
64 |
|
|
/* Application Code */ |
65 |
|
|
/* GUIX Internal Code */ |
66 |
|
|
/* */ |
67 |
|
|
/**************************************************************************/ |
68 |
|
11163 |
UINT _gx_text_button_event_process(GX_TEXT_BUTTON *button, GX_EVENT *event_ptr) |
69 |
|
|
{ |
70 |
|
|
|
71 |
|
|
/* Process relative to the type of event. */ |
72 |
✓✓ |
11163 |
switch (event_ptr -> gx_event_type) |
73 |
|
|
{ |
74 |
|
59 |
case GX_EVENT_DELETE: |
75 |
✓✓✓✓
|
59 |
if ((button -> gx_widget_style & GX_STYLE_TEXT_COPY) && button -> gx_text_button_string.gx_string_ptr) |
76 |
|
|
{ |
77 |
✓✓ |
7 |
if (!_gx_system_memory_free) |
78 |
|
|
{ |
79 |
|
1 |
return GX_SYSTEM_MEMORY_ERROR; |
80 |
|
|
} |
81 |
|
6 |
_gx_system_memory_free((void *)button -> gx_text_button_string.gx_string_ptr); |
82 |
|
6 |
button -> gx_text_button_string.gx_string_ptr = GX_NULL; |
83 |
|
6 |
button -> gx_text_button_string.gx_string_length = 0; |
84 |
|
|
} |
85 |
|
|
#if defined(GX_DYNAMIC_BIDI_TEXT_SUPPORT) |
86 |
|
|
if (button -> gx_text_button_bidi_resolved_text_info) |
87 |
|
|
{ |
88 |
|
|
_gx_utility_bidi_resolved_text_info_delete(&button -> gx_text_button_bidi_resolved_text_info); |
89 |
|
|
} |
90 |
|
|
#endif |
91 |
|
58 |
break; |
92 |
|
|
|
93 |
|
11104 |
default: |
94 |
|
|
|
95 |
|
|
/* Do nothing. */ |
96 |
|
11104 |
break; |
97 |
|
|
} |
98 |
|
|
|
99 |
|
|
/* Return completion status. */ |
100 |
|
11162 |
return _gx_button_event_process((GX_BUTTON*)button, event_ptr); |
101 |
|
|
} |
102 |
|
|
|