From 3b64a6984fa44f4ddb87d84b98ee10c3a0ea60d8 Mon Sep 17 00:00:00 2001 From: Allanis Date: Sun, 5 Jan 2014 20:44:42 +0000 Subject: [PATCH] [Change] Buttons with NULL function are now disabled by default. --- src/menu.c | 17 ++--------------- src/toolkit.c | 2 ++ 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/src/menu.c b/src/menu.c index e70994d..e4ca12c 100644 --- a/src/menu.c +++ b/src/menu.c @@ -58,7 +58,6 @@ static void menu_main_new(char* str); static void menu_main_exit(char* str); /* Small menu. */ static void menu_small_close(char* str); -static void edit_options(char* str); static void menu_small_exit(char* str); static void exit_game(void); /* Information menu. */ @@ -111,7 +110,7 @@ void menu_main(void) { "btnNew", "New Game", menu_main_new); window_addButton(wid, 20, 20 + (BUTTON_HEIGHT+20), BUTTON_WIDTH, BUTTON_HEIGHT, - "btnOptions", "Options", (void(*)(char*)) edit_options); + "btnOptions", "Options", NULL); window_addButton(wid, 20, 20, BUTTON_WIDTH, BUTTON_HEIGHT, "btnExit", "Exit", menu_main_exit); @@ -210,7 +209,7 @@ void menu_small(void) { window_addButton(wid, 20, 20 + BUTTON_HEIGHT + 20, BUTTON_WIDTH, BUTTON_HEIGHT, - "btnOptions", "Options", (void(*)(char*))edit_options); + "btnOptions", "Options", NULL); window_addButton(wid, 20, 20, BUTTON_WIDTH, BUTTON_HEIGHT, "btnExit", "Exit", menu_small_exit); @@ -243,18 +242,6 @@ static void menu_small_exit(char* str) { menu_main(); } -/** - * @fn static void edit_options(char* str) - * - * @brief Edit the options. - * @param str Unused. - * @todo Make the options menu. - */ -static void edit_options(char* str) { - (void)str; - /* @todo Make options menu */ -} - /** * @fn static void exit_game(void) * diff --git a/src/toolkit.c b/src/toolkit.c index 2239d8c..2edd547 100644 --- a/src/toolkit.c +++ b/src/toolkit.c @@ -201,6 +201,8 @@ void window_addButton(const unsigned int wid, const int x, const int y, wgt->dat.btn.display = strdup(display); wgt->dat.btn.disabled = 0; /* Initially enabled. */ wgt->dat.btn.fptr = call; + if(wgt->dat.btn.fptr == NULL) /* Disable if function is NULL. */ + wgt->dat.btn.disabled = 1; /* Position/Size. */ wgt->w = (double) w;