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 |
|
|
/** Text Button Management (Button) */ |
18 |
|
|
/** */ |
19 |
|
|
/**************************************************************************/ |
20 |
|
|
|
21 |
|
|
#define GX_SOURCE_CODE |
22 |
|
|
|
23 |
|
|
|
24 |
|
|
/* Include necessary system files. */ |
25 |
|
|
|
26 |
|
|
#include "gx_api.h" |
27 |
|
|
#include "gx_system.h" |
28 |
|
|
#include "gx_display.h" |
29 |
|
|
#include "gx_context.h" |
30 |
|
|
#include "gx_widget.h" |
31 |
|
|
#include "gx_button.h" |
32 |
|
|
|
33 |
|
|
/**************************************************************************/ |
34 |
|
|
/* */ |
35 |
|
|
/* FUNCTION RELEASE */ |
36 |
|
|
/* */ |
37 |
|
|
/* _gx_text_button_text_draw PORTABLE C */ |
38 |
|
|
/* 6.1 */ |
39 |
|
|
/* AUTHOR */ |
40 |
|
|
/* */ |
41 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
42 |
|
|
/* */ |
43 |
|
|
/* DESCRIPTION */ |
44 |
|
|
/* */ |
45 |
|
|
/* This function draws the button text */ |
46 |
|
|
/* */ |
47 |
|
|
/* INPUT */ |
48 |
|
|
/* */ |
49 |
|
|
/* button Text button control block */ |
50 |
|
|
/* */ |
51 |
|
|
/* OUTPUT */ |
52 |
|
|
/* */ |
53 |
|
|
/* None */ |
54 |
|
|
/* */ |
55 |
|
|
/* CALLS */ |
56 |
|
|
/* */ |
57 |
|
|
/* _gx_widget_text_id_draw Draw text using resource ID */ |
58 |
|
|
/* _gx_widget_text_draw Draw text string */ |
59 |
|
|
/* */ |
60 |
|
|
/* CALLED BY */ |
61 |
|
|
/* */ |
62 |
|
|
/* Application Code */ |
63 |
|
|
/* GUIX Internal Code */ |
64 |
|
|
/* */ |
65 |
|
|
/* RELEASE HISTORY */ |
66 |
|
|
/* */ |
67 |
|
|
/* DATE NAME DESCRIPTION */ |
68 |
|
|
/* */ |
69 |
|
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ |
70 |
|
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */ |
71 |
|
|
/* improved logic, */ |
72 |
|
|
/* resulting in version 6.1 */ |
73 |
|
|
|
74 |
|
|
/* */ |
75 |
|
|
/**************************************************************************/ |
76 |
|
87299 |
VOID _gx_text_button_text_draw(GX_TEXT_BUTTON *button) |
77 |
|
|
{ |
78 |
|
|
GX_WIDGET *widget; |
79 |
|
87299 |
INT xtextoffset = 0; |
80 |
|
87299 |
INT ytextoffset = 0; |
81 |
|
|
GX_RESOURCE_ID color; |
82 |
|
|
GX_STRING string; |
83 |
|
|
|
84 |
|
|
/* Setup the button. */ |
85 |
|
87299 |
widget = (GX_WIDGET *)button; |
86 |
|
|
|
87 |
|
|
/* draw the text */ |
88 |
|
|
|
89 |
✓✓ |
87299 |
if (widget -> gx_widget_style & GX_STYLE_ENABLED) |
90 |
|
|
{ |
91 |
✓✓ |
87220 |
if (widget -> gx_widget_style & GX_STYLE_BUTTON_PUSHED) |
92 |
|
|
{ |
93 |
|
42 |
xtextoffset = ytextoffset = 1; |
94 |
|
42 |
color = button -> gx_text_button_selected_text_color; |
95 |
|
|
} |
96 |
|
|
else |
97 |
|
|
{ |
98 |
|
87178 |
color = button -> gx_text_button_normal_text_color; |
99 |
|
|
} |
100 |
|
|
} |
101 |
|
|
else |
102 |
|
|
{ |
103 |
|
79 |
color = button -> gx_text_button_disabled_text_color; |
104 |
|
|
} |
105 |
|
|
|
106 |
|
87299 |
_gx_text_button_text_get_ext(button, &string); |
107 |
|
|
|
108 |
✓✓ |
87299 |
if (string.gx_string_ptr) |
109 |
|
|
{ |
110 |
|
87288 |
_gx_widget_text_draw_ext(widget, color, |
111 |
|
87288 |
button -> gx_text_button_font_id, |
112 |
|
|
&string, xtextoffset, ytextoffset); |
113 |
|
|
} |
114 |
|
87299 |
} |
115 |
|
|
|