diff options
Diffstat (limited to 'textscreen/txt_button.c')
-rw-r--r-- | textscreen/txt_button.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/textscreen/txt_button.c b/textscreen/txt_button.c index e20f462d..d7dbe143 100644 --- a/textscreen/txt_button.c +++ b/textscreen/txt_button.c @@ -6,12 +6,11 @@ #include "txt_button.h" #include "txt_io.h" #include "txt_main.h" -#include "txt_widget.h" #include "txt_window.h" -static void TXT_ButtonSizeCalc(txt_widget_t *widget, int *w, int *h) +static void TXT_ButtonSizeCalc(UNCAST(button), int *w, int *h) { - txt_button_t *button = (txt_button_t *) widget; + CAST(txt_button_t, button); // Minimum width is the string length + two spaces for padding @@ -19,9 +18,9 @@ static void TXT_ButtonSizeCalc(txt_widget_t *widget, int *w, int *h) *h = 1; } -static void TXT_ButtonDrawer(txt_widget_t *widget, int w, int selected) +static void TXT_ButtonDrawer(UNCAST(button), int w, int selected) { - txt_button_t *button = (txt_button_t *) widget; + CAST(txt_button_t, button); int i; TXT_BGColor(TXT_COLOR_BLUE, 0); @@ -41,18 +40,20 @@ static void TXT_ButtonDrawer(txt_widget_t *widget, int w, int selected) } } -static void TXT_ButtonDestructor(txt_widget_t *widget) +static void TXT_ButtonDestructor(UNCAST(button)) { - txt_button_t *button = (txt_button_t *) widget; + CAST(txt_button_t, button); free(button->label); } -static int TXT_ButtonKeyPress(txt_widget_t *widget, int key) +static int TXT_ButtonKeyPress(UNCAST(button), int key) { + CAST(txt_button_t, button); + if (key == KEY_ENTER) { - TXT_EmitSignal(widget, "pressed"); + TXT_EmitSignal(button, "pressed"); } return 0; |