--- a/ui/common/toolbar.c Sun Aug 24 15:24:16 2025 +0200 +++ b/ui/common/toolbar.c Sat Oct 04 14:52:59 2025 +0200 @@ -29,20 +29,21 @@ #include "toolbar.h" #include "menu.h" +#include <stdio.h> #include <string.h> static CxMap* toolbar_items; -static CxList* toolbar_defaults[3]; // 0: left 1: center 2: right +static CxList* toolbar_defaults[8]; // 0: left 1: center 2: right static UiToolbarMenuItem* ui_appmenu; void uic_toolbar_init(void) { toolbar_items = cxHashMapCreate(cxDefaultAllocator, CX_STORE_POINTERS, 16); - toolbar_defaults[0] = cxLinkedListCreateSimple(CX_STORE_POINTERS); - toolbar_defaults[1] = cxLinkedListCreateSimple(CX_STORE_POINTERS); - toolbar_defaults[2] = cxLinkedListCreateSimple(CX_STORE_POINTERS); + for(int i=0;i<8;i++) { + toolbar_defaults[i] = cxLinkedListCreateSimple(CX_STORE_POINTERS); + } } static char* nl_strdup(const char* str) { @@ -120,7 +121,7 @@ } CxList* uic_get_toolbar_defaults(enum UiToolbarPos pos) { - if (pos >= 0 && pos < 3) { + if (pos >= 0 && pos < 8) { return toolbar_defaults[pos]; } return NULL; @@ -128,15 +129,19 @@ void ui_toolbar_add_default(const char* name, enum UiToolbarPos pos) { char* cp = strdup(name); - if (pos >= 0 && pos < 3) { + if (pos >= 0 && pos < 8) { cxListAdd(toolbar_defaults[pos], cp); } else { - // TODO: error + fprintf(stderr, "Error: illegal toolbar position: %d\n", (int)pos); } } UiBool uic_toolbar_isenabled(void) { - return cxListSize(toolbar_defaults[0]) + cxListSize(toolbar_defaults[1]) + cxListSize(toolbar_defaults[2]) > 0; + size_t size = 0; + for(int i=0;i<8;i++) { + size += cxListSize(toolbar_defaults[i]); + } + return size > 0; } UiToolbarItemI* uic_toolbar_get_item(const char* name) {