8 #ifndef UI_RECT_COLLECTION_H
9 #define UI_RECT_COLLECTION_H
37 ui_rect_t data[UI_RECT_COLLECTION_MAX_LENGTH];
51 collection->length = 0;
60 UI_RECT_COLLECTION_clear(collection);
71 return collection->length;
82 return UI_RECT_COLLECTION_get_length(collection) >= UI_RECT_COLLECTION_MAX_LENGTH;
93 return collection->length == 0u;
104 return UI_RECT_COLLECTION_is_empty(collection) ? NULL : (collection->data + collection->length - 1u);
115 return collection->data + collection->length;
125 static inline void UI_RECT_COLLECTION_add_rect(
ui_rect_collection_t *collection,
const ui_rect_t element) {
126 assert(!UI_RECT_COLLECTION_is_full(collection));
127 collection->data[collection->length] = element;
128 collection->length++;
138 static inline void UI_RECT_COLLECTION_remove_rect(
ui_rect_collection_t *collection, ui_rect_t *element) {
139 assert(!UI_RECT_COLLECTION_is_empty(collection));
140 assert(element >= collection->data);
141 assert(element < (collection->data + collection->length));
142 *element = *UI_RECT_COLLECTION_get_last(collection);
143 collection->length--;
153 for (
size_t i = 0; i < collection->length;) {
154 if (UI_RECT_is_empty(&collection->data[i])) {
155 UI_RECT_COLLECTION_remove_rect(collection, &collection->data[i]);
MicroEJ MicroUI library low level API: enable some features according to the hardware capabilities.