small update

This commit is contained in:
vurtun 2015-05-10 11:19:28 +02:00
parent f0b172a3be
commit 30800c95f2
7 changed files with 16 additions and 16 deletions

View File

@ -225,7 +225,7 @@ code the panel was introduced. The panel groups together a number of
widgets but in true immediate mode fashion does not save any state from
widgets that have been added to the panel. In addition the panel enables a
number of nice features on a group of widgets like movement, scaling,
closing and minimizing. An additional use for panel is to further extend the
hidding and minimizing. An additional use for panel is to further extend the
grouping of widgets into tabs, groups and shelfs.
The panel is divided into a `struct gui_panel` with persistent life time and
the `struct gui_panel_layout` structure with a temporary life time.
@ -267,11 +267,11 @@ not known beforehand since it is possible to create your own buffer type.
Therefore just the sequence of panels is managed and you either have to cast
from the panel to your own type, use inheritance in C++ or use the `container_of`
macro from the Linux kernel. For the standard buffer there is already a type
`gui_window` which contains the panel and the buffer output `gui_command_list`,
`gui_panel_hook` which contains the panel and the buffer output `gui_command_list`,
which can be used to implement overlapping panels.
```c
struct gui_window window;
struct gui_panel_hook hook;
struct gui_memory memory = {...};
struct gui_memory_status status;
struct gui_command_buffer buffer;
@ -282,9 +282,9 @@ struct gui_stack stack;
gui_buffer_init_fixed(buffer, &memory);
gui_default_config(&config);
gui_panel_init(&win.panel, 50, 50, 300, 200, 0, &config, &font);
gui_panel_init(&hook.panel, 50, 50, 300, 200, 0, &config, &font);
gui_stack_clear(&stack);
gui_stack_push(&stack, &win.panel);
gui_stack_push(&stack, &hook.panel);
while (1) {
struct gui_panel_layout layout;
@ -301,11 +301,11 @@ while (1) {
/* draw each panel */
struct gui_panel *iter = stack.begin;
while (iter) {
const struct gui_window *w = iter;
const struct gui_command *cmd = gui_list_begin(&w->list);
const struct gui_panel_hook *h = iter;
const struct gui_command *cmd = gui_list_begin(&h->list);
while (cmd) {
/* execute command */
cmd = gui_list_next(&w->list, cmd);
cmd = gui_list_next(&h->list, cmd);
}
iter = iter->next;
}

View File

@ -2,7 +2,7 @@
#define MAX_MEMORY (32 * 1024)
struct show_window {
struct gui_window win;
struct gui_panel_hook win;
gui_char in_buf[MAX_BUFFER];
gui_size in_len;
gui_bool in_act;
@ -27,7 +27,7 @@ struct show_window {
};
struct control_window {
struct gui_window win;
struct gui_panel_hook win;
gui_flags show_flags;
gui_bool flag_min;
gui_bool style_min;

View File

@ -483,8 +483,8 @@ draw(struct gui_panel_stack *stack, int width, int height)
struct gui_panel *iter = stack->begin;
if (!stack->count) return;
while (iter) {
struct gui_window *win = (void*)iter;
execute(&win->list, width, height);
struct gui_panel_hook *hook = (void*)iter;
execute(&hook->list, width, height);
iter = iter->next;
}
}

View File

@ -347,8 +347,8 @@ draw(XSurface *surf, struct gui_panel_stack *stack)
struct gui_panel *iter = stack->begin;
if (!stack->count) return;
while (iter) {
struct gui_window *win = (void*)iter;
execute(surf, &win->list);
struct gui_panel_hook *hook = (void*)iter;
execute(surf, &hook->list);
iter = iter->next;
}
}

2
gui.c
View File

@ -1241,7 +1241,7 @@ gui_default_config(struct gui_config *config)
col_load(config->colors[GUI_COLOR_BUTTON_HOVER], 100, 100, 100, 255);
col_load(config->colors[GUI_COLOR_BUTTON_TOGGLE], 75, 75, 75, 255);
col_load(config->colors[GUI_COLOR_BUTTON_HOVER_FONT], 45, 45, 45, 255);
col_load(config->colors[GUI_COLOR_BUTTON_BORDER], 80, 80, 80, 255);
col_load(config->colors[GUI_COLOR_BUTTON_BORDER], 100, 100, 100, 255);
col_load(config->colors[GUI_COLOR_CHECK], 100, 100, 100, 255);
col_load(config->colors[GUI_COLOR_CHECK_BACKGROUND], 45, 45, 45, 255);
col_load(config->colors[GUI_COLOR_CHECK_ACTIVE], 45, 45, 45, 255);

2
gui.h
View File

@ -427,7 +427,7 @@ struct gui_panel_stack {
struct gui_panel *end;
};
struct gui_window {
struct gui_panel_hook {
struct gui_panel panel;
struct gui_command_list list;
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB

After

Width:  |  Height:  |  Size: 8.0 KiB