Skip to content

Commit 324e172

Browse files
committed
add KW_GetLabelText
1 parent 0815aa1 commit 324e172

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

src/KW_label.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ void KW_SetLabelText(KW_Widget * widget, const char * text) {
4444
label->dirty = SDL_TRUE;
4545
}
4646

47+
const char* KW_GetLabelText(KW_Widget * widget) {
48+
KW_Label * label = (KW_Label *) KW_GetWidgetData(widget, KW_WIDGETTYPE_LABEL);
49+
return label->text;
50+
}
51+
4752
void KW_SetLabelStyle(KW_Widget * widget, int style) {
4853
KW_Label * label = (KW_Label *) KW_GetWidgetData(widget, KW_WIDGETTYPE_LABEL);
4954
label->style = style;

src/KW_label.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,12 @@ extern DECLSPEC KW_Widget * KW_CreateLabel(KW_GUI * gui, KW_Widget * parent, con
8888
*/
8989
extern DECLSPEC void KW_SetLabelText(KW_Widget * widget, const char * text);
9090

91+
/**
92+
* \brief Get the text being rendered in this label.
93+
* \param widget The label widget.
94+
*/
95+
extern DECLSPEC const char* KW_GetLabelText(KW_Widget * widget);
96+
9197
/**
9298
* \brief Set the text style for this label.
9399
* \param widget The label widget.

0 commit comments

Comments
 (0)