/** * Copyright (c) 2021 Dominic Masters * * This software is released under the MIT License. * https://opensource.org/licenses/MIT */ #pragma once #include "../libs.h" #include "frame.h" #include "label.h" #include "menu.h" #include "rectangle.h" /** Color of the menulist selection rectangle */ #define MENULIST_SELECTION_COLOR ((pixel_t){ .r=255, .g=255, .b=255, .a=150 }) /** Maximum number of items that the list supports */ #define MENULIST_ITEMS_MAX 32 typedef struct _menulist_t menulist_t; /** Callback for when a menulist item is selected */ typedef void menulistcallback_t(menulist_t *list, uint8_t i, void *user); /** Representation of a menu list, a menu with multiple menu items. */ typedef struct _menulist_t { float x, y; char *items[MENULIST_ITEMS_MAX]; label_t labels[MENULIST_ITEMS_MAX]; frame_t frame; menu_t menu; rectangle_t selection; menulistcallback_t *onSelect; void *user; } menulist_t;