add a bunch of buttons to the test application for testing performance
This commit is contained in:
parent
802d611650
commit
996d6fb520
1 changed files with 23 additions and 0 deletions
23
src/main.c
23
src/main.c
|
@ -116,6 +116,29 @@ int app_handle(struct UINode *node, void *data, int event_type, size_t d, void *
|
||||||
text_input->text_node = text_node_new(&text_input->node, state->font, UINeutral50, NULL);
|
text_input->text_node = text_node_new(&text_input->node, state->font, UINeutral50, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* a bunch of buttons */
|
||||||
|
{
|
||||||
|
UINode *scroll_container = node_new(node, "buttons_scroll_container");
|
||||||
|
scroll_container->width_policy = UI_SIZE_POLICY_GROW;
|
||||||
|
scroll_container->height_policy = UI_SIZE_POLICY_GROW;
|
||||||
|
|
||||||
|
UIScrollableNode *scroll = scrollable_new(scroll_container, NULL);
|
||||||
|
UINode *buttons = node_new(scroll_container, "buttons");
|
||||||
|
buttons->width_policy = UI_SIZE_POLICY_GROW;
|
||||||
|
buttons->height_policy = UI_SIZE_POLICY_DYNAMIC;
|
||||||
|
scroll->target = buttons;
|
||||||
|
|
||||||
|
box_layout_new(buttons, UI_DIRECTION_VERTICAL);
|
||||||
|
|
||||||
|
for (int i = 0; i < 100; i++) {
|
||||||
|
UINode *button = node_new(buttons, "button");
|
||||||
|
state_background_node_new(button, UIPurple600, UIPurple700, UIPurple800, 6.0);
|
||||||
|
text_node_new(button, state->font, UINeutral50, "button");
|
||||||
|
dispatcher_new(button, UI_EVENT_UNPRESSED, INCREMENT_COUNT, state, app_handle);
|
||||||
|
button->width_policy = UI_SIZE_POLICY_GROW;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SIDEBAR_BEGIN_ANIMATE: {
|
case SIDEBAR_BEGIN_ANIMATE: {
|
||||||
|
|
Loading…
Reference in a new issue