foxygit / doom Log in
commit ef8bdb1feae078684843ae8ed3af0c632cc5eda0
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Mon Sep 18 22:19:00 2006 +0000
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Mon Sep 18 22:19:00 2006 +0000

    Add function to set button label.

    Subversion-branch: /trunk/chocolate-doom
    Subversion-revision: 614
---
 textscreen/txt_button.c | 6 ++++++
 textscreen/txt_button.h | 1 +
 2 files changed, 7 insertions(+)

diff --git a/textscreen/txt_button.c b/textscreen/txt_button.c
index b07d8096..fa808095 100644
--- a/textscreen/txt_button.c
+++ b/textscreen/txt_button.c
@@ -102,6 +102,12 @@ txt_widget_class_t txt_button_class =
     TXT_ButtonMousePress,
 };

+void TXT_SetButtonLabel(txt_button_t *button, char *label)
+{
+    free(button->label);
+    button->label = strdup(label);
+}
+
 txt_button_t *TXT_NewButton(char *label)
 {
     txt_button_t *button;
diff --git a/textscreen/txt_button.h b/textscreen/txt_button.h
index 76afa0eb..330782f7 100644
--- a/textscreen/txt_button.h
+++ b/textscreen/txt_button.h
@@ -33,6 +33,7 @@ struct txt_button_s
 };

 txt_button_t *TXT_NewButton(char *label);
+void TXT_SetButtonLabel(txt_button_t *button, char *label);

 #endif /* #ifndef TXT_BUTTON_H */