diff options
Diffstat (limited to 'examples_library/theme.c')
-rw-r--r-- | examples_library/theme.c | 46 |
1 files changed, 18 insertions, 28 deletions
diff --git a/examples_library/theme.c b/examples_library/theme.c index fcc5fd5cc31a..689633e624ed 100644 --- a/examples_library/theme.c +++ b/examples_library/theme.c @@ -11,64 +11,54 @@ #include <bsddialog.h> #include <bsddialog_theme.h> #include <stdio.h> -#include <string.h> int main() { int output, focusitem; struct bsddialog_conf conf; enum bsddialog_default_theme theme; - struct bsddialog_menuitem items[5] = { - {"", false, 0, "Flat", "dialog-like", - "BSDDIALOG_THEME_FLAT" }, - {"", false, 0, "Dialog", "dialog clone", - "BSDDIALOG_THEME_DIALOG" }, - {"", false, 0, "BSDDialog", "new theme", - "BSDDIALOG_THEME_BSDDIALOG" }, - {"", false, 0, "BlackWhite","black and white", - "BSDDIALOG_THEME_BLACKWHITE" }, - {"", false, 0, "Quit", "Exit", "Quit or Cancel to exit" } + struct bsddialog_menuitem items[4] = { + {"", false, 0, "Flat", "default flat theme", + "enum bsddialog_default_theme BSDDIALOG_THEME_FLAT" }, + {"", false, 0, "3D", "pseudo 3D theme", + "enum bsddialog_default_theme BSDDIALOG_THEME_3D" }, + {"", false, 0, "BlackWhite","black and white theme", + "enum bsddialog_default_theme BSDDIALOG_THEME_BLACKWHITE" }, + {"", false, 0, "Quit", "Exit", "Quit, Cancel or ESC to exit" } }; if (bsddialog_init() == BSDDIALOG_ERROR) { printf("Error: %s\n", bsddialog_geterror()); return (1); } - bsddialog_initconf(&conf); - + conf.ascii_lines = true; bsddialog_backtitle(&conf, "Theme Example"); - + bsddialog_initconf(&conf); + conf.key.enable_esc = true; conf.title = " Theme "; focusitem = -1; while (true) { - output = bsddialog_menu(&conf, "Choose theme", 15, 45, 5, 5, + output = bsddialog_menu(&conf, "Choose theme", 15, 45, 4, 4, items, &focusitem); - if (output != BSDDIALOG_OK || items[4].on) + if (output != BSDDIALOG_OK || items[3].on) break; if (items[0].on) { theme = BSDDIALOG_THEME_FLAT; focusitem = 0; - } - else if (items[1].on) { - theme = BSDDIALOG_THEME_DIALOG; + } else if (items[1].on) { + theme = BSDDIALOG_THEME_3D; focusitem = 1; - } - else if (items[2].on) { - theme = BSDDIALOG_THEME_BSDDIALOG; - focusitem = 2; - } - else if (items[3].on) { + } else if (items[2].on) { theme = BSDDIALOG_THEME_BLACKWHITE; - focusitem = 3; + focusitem = 2; } - bsddialog_set_default_theme(theme); } bsddialog_end(); - return (output); + return (0); }
\ No newline at end of file |