finished stack layered input
This commit is contained in:
parent
855e181015
commit
1085f843aa
17
gui.c
17
gui.c
|
@ -2440,9 +2440,20 @@ gui_begin_panel(struct gui_context *ctx, struct gui_panel *panel,
|
|||
cpanel = CONTAINER_OF(panel, struct gui_context_panel, panel);
|
||||
inpanel = INBOX(in->mouse_prev.x,in->mouse_prev.y, cpanel->x, cpanel->y, cpanel->w, cpanel->h);
|
||||
if (in->mouse_down && in->mouse_clicked && inpanel) {
|
||||
gui_rm_draw_list(ctx, &cpanel->list);
|
||||
gui_add_draw_list(ctx, &cpanel->list);
|
||||
ctx->active = cpanel;
|
||||
gui_size n = 0;
|
||||
struct gui_context_panel *p = NULL;
|
||||
while (n < ctx->panel_size && ctx->panel_lists[n++] != &cpanel->list);
|
||||
while (n < ctx->panel_size) {
|
||||
p = CONTAINER_OF(ctx->panel_lists[n], struct gui_context_panel, list);
|
||||
if (INBOX(in->mouse_prev.x, in->mouse_prev.y, p->x, p->y, p->w, p->h))
|
||||
break;
|
||||
n++;
|
||||
}
|
||||
if (n >= ctx->panel_size) {
|
||||
gui_rm_draw_list(ctx, &cpanel->list);
|
||||
gui_add_draw_list(ctx, &cpanel->list);
|
||||
ctx->active = cpanel;
|
||||
}
|
||||
}
|
||||
|
||||
if (ctx->active == cpanel && (flags & GUI_PANEL_MOVEABLE) && (flags & GUI_PANEL_HEADER)) {
|
||||
|
|
4
opengl.c
4
opengl.c
|
@ -408,8 +408,8 @@ main(int argc, char *argv[])
|
|||
fprintf(stdout, "button pressed!\n");
|
||||
gui_end_panel(ctx, panel, NULL);
|
||||
|
||||
gui_begin_panel(ctx, subpanel, "Subdemo",
|
||||
GUI_PANEL_HEADER|GUI_PANEL_MINIMIZABLE|GUI_PANEL_BORDER|GUI_PANEL_MOVEABLE);
|
||||
gui_begin_panel(ctx, subpanel, "Error",
|
||||
GUI_PANEL_HEADER|GUI_PANEL_BORDER|GUI_PANEL_MOVEABLE);
|
||||
gui_panel_layout(subpanel, 30, 2);
|
||||
if (gui_panel_button_text(subpanel, "ok", 2, GUI_BUTTON_SWITCH))
|
||||
fprintf(stdout, "ok pressed!\n");
|
||||
|
|
Loading…
Reference in New Issue