MCPcopy Create free account
hub / github.com/Wassimulator/CactusViewer / UI_push_block

Function UI_push_block

include/ui/ui_core.cpp:725–751  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

723
724
725UI_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
753UI_Block *UI_push_block(UI_Context *ctx) {
754 UI_assert(ctx != nullptr);

Callers 15

UI_barFunction · 0.85
UI_textFunction · 0.85
UI_buttonFunction · 0.85
UI_push_parent_deferFunction · 0.85
UI_checkboxFunction · 0.85
UI_color_pickerFunction · 0.85
UI_sliderFunction · 0.85
UI_slider_fillFunction · 0.85
UI_spacer_verFunction · 0.85
UI_spacer_horFunction · 0.85
UI_separatorFunction · 0.85
UI_tooltipFunction · 0.85

Calls 2

push_backMethod · 0.80

Tested by

no test coverage detected