| 723 | |
| 724 | |
| 725 | UI_Block *UI_push_block(UI_Context *ctx, UI_Block* parent) { |
| 726 | UI_assert(ctx != nullptr); |
| 727 | UI_Block *result = nullptr; |
| 728 | auto frame = UI_get_current_frame_buffer(ctx); |
| 729 | |
| 730 | UI_Block new_block = { 0 }; |
| 731 | result = frame->push_back(new_block); |
| 732 | |
| 733 | result->parent = parent; |
| 734 | result->frame_created = ctx->frame_id; |
| 735 | result->style.softness = 1.5; // defaults to 1 because everything looks better with it. |
| 736 | |
| 737 | // family matters |
| 738 | if (parent) { |
| 739 | UI_assert(result->parent != nullptr); // must not be null if it's on that list! |
| 740 | result->prev = result->parent->last; // set the last child of parent as prev sibling |
| 741 | result->parent->last = result; // make this the parent's last child |
| 742 | if (result->parent->first == nullptr) { |
| 743 | result->parent->first = result; // if parent has no first child, set this as first |
| 744 | } |
| 745 | result->depth_level = result->parent->depth_level + 1; |
| 746 | } |
| 747 | if (result->prev != nullptr) |
| 748 | result->prev->next = result; // if it has a prev, link em: set that prev's next to this. |
| 749 | |
| 750 | return result; |
| 751 | } |
| 752 | |
| 753 | UI_Block *UI_push_block(UI_Context *ctx) { |
| 754 | UI_assert(ctx != nullptr); |
no test coverage detected