fixed typo +

made toggle button better visible
This commit is contained in:
vurtun 2015-04-26 22:38:55 +02:00
parent 5296021b85
commit 1b7edff9c0
4 changed files with 11 additions and 6 deletions

View File

@ -93,7 +93,7 @@ while (1) {
gui_panel_row(&layout, 30, 2);
if (gui_panel_option(&layout, "easy", option == 0)) option = 0;
if (gui_panel_option(&layout, "hard", option == 1)) option = 1;
gui_panel_text(&layout, "input:", 5, GUI_TEXT_LEFT);
gui_panel_text(&layout, "input:", 6, GUI_TEXT_LEFT);
len = gui_panel_input(&layout, input, len, 256, &active, GUI_INPUT_DEFAULT);
gui_panel_end(&layout, &panel);
gui_buffer_end(&list, buffer, &status);

View File

@ -75,6 +75,7 @@ struct demo {
gui_bool tab_min;
gui_float group_off;
gui_float shelf_off;
gui_bool toggle;
};
static void
@ -440,6 +441,7 @@ demo_panel(struct gui_panel_layout *panel, struct demo *demo)
gui_panel_row(&tab, 30, 1);
if (gui_panel_button_text(&tab, "button", GUI_BUTTON_DEFAULT))
fprintf(stdout, "button pressed!\n");
demo->toggle = gui_panel_button_toggle(&tab, "toggle", demo->toggle);
demo->check = gui_panel_check(&tab, "advanced", demo->check);
demo->slider = gui_panel_slider(&tab, 0, demo->slider, 10, 1.0f);
demo->prog = gui_panel_progress(&tab, demo->prog, 100, gui_true);

12
gui.c
View File

@ -1141,6 +1141,7 @@ gui_default_config(struct gui_config *config)
col_load(config->colors[GUI_COLOR_TITLEBAR], 45, 45, 45, 255);
col_load(config->colors[GUI_COLOR_BUTTON], 45, 45, 45, 255);
col_load(config->colors[GUI_COLOR_BUTTON_HOVER], 100, 100, 100, 255);
col_load(config->colors[GUI_COLOR_BUTTON_TOGGLE], 65, 65, 65, 255);
col_load(config->colors[GUI_COLOR_BUTTON_HOVER_FONT], 45, 45, 45, 255);
col_load(config->colors[GUI_COLOR_BUTTON_BORDER], 100, 100, 100, 255);
col_load(config->colors[GUI_COLOR_CHECK], 100, 100, 100, 255);
@ -1588,12 +1589,12 @@ gui_panel_button_toggle(struct gui_panel_layout *layout, const char *str, gui_bo
button.background = config->colors[GUI_COLOR_BUTTON];
button.foreground = config->colors[GUI_COLOR_BUTTON_BORDER];
button.content = config->colors[GUI_COLOR_TEXT];
button.highlight = config->colors[GUI_COLOR_BUTTON];
button.highlight_content = config->colors[GUI_COLOR_TEXT];
button.highlight = config->colors[GUI_COLOR_BUTTON_HOVER];
button.highlight_content = config->colors[GUI_COLOR_BUTTON];
} else {
button.background = config->colors[GUI_COLOR_BUTTON_HOVER];
button.background = config->colors[GUI_COLOR_BUTTON_TOGGLE];
button.foreground = config->colors[GUI_COLOR_BUTTON_BORDER];
button.content = config->colors[GUI_COLOR_BUTTON];
button.content = config->colors[GUI_COLOR_TEXT];
button.highlight = config->colors[GUI_COLOR_BUTTON_HOVER];
button.highlight_content = config->colors[GUI_COLOR_BUTTON];
}
@ -1929,7 +1930,8 @@ gui_panel_histo(struct gui_panel_layout *layout, const gui_float *values, gui_si
values, count, &histo, layout->input);
}
gui_bool gui_panel_tab_begin(struct gui_panel_layout *parent, struct gui_panel_layout *tab,
gui_bool
gui_panel_tab_begin(struct gui_panel_layout *parent, struct gui_panel_layout *tab,
const char *title, gui_bool minimized)
{
struct gui_rect bounds;

1
gui.h
View File

@ -290,6 +290,7 @@ enum gui_panel_colors {
GUI_COLOR_BUTTON,
GUI_COLOR_BUTTON_BORDER,
GUI_COLOR_BUTTON_HOVER,
GUI_COLOR_BUTTON_TOGGLE,
GUI_COLOR_BUTTON_HOVER_FONT,
GUI_COLOR_CHECK,
GUI_COLOR_CHECK_ACTIVE,