MCPcopy Create free account
hub / github.com/MrNeRF/LichtFeld-Studio / UpdateTabs

Method UpdateTabs

external/zep/src/editor.cpp:536–565  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

534 }
535
536 void ZepEditor::UpdateTabs() {
537 m_tabRegion->children.clear();
538 if (GetTabWindows().size() > 1) {
539 // Tab region
540 for (auto& window : GetTabWindows()) {
541 if (window->GetActiveWindow() == nullptr)
542 continue;
543
544 auto& buffer = window->GetActiveWindow()->GetBuffer();
545
546 auto tabColor = GetTheme().GetColor(ThemeColor::TabActive);
547
548 auto name = window->GetName();
549 auto tabLength = m_pDisplay->GetFont(ZepTextType::UI).GetTextSize((const uint8_t*)name.c_str()).x + DPI_X(textBorder) * 2;
550
551 auto spTabRegionTab = std::make_shared<TabRegionTab>();
552
553 spTabRegionTab->color = tabColor;
554 spTabRegionTab->debugName = name;
555 spTabRegionTab->pTabWindow = window;
556 spTabRegionTab->fixed_size = NVec2f(tabLength, 0.0f);
557 spTabRegionTab->layoutType = RegionLayoutType::HBox;
558 spTabRegionTab->padding = DPI_VEC2(NVec2f(textBorder, textBorder));
559 spTabRegionTab->flags = RegionFlags::Fixed;
560 m_tabRegion->children.push_back(spTabRegionTab);
561 spTabRegionTab->pParent = m_tabRegion.get();
562 }
563 }
564 LayoutRegion(*m_tabRegion);
565 }
566
567 ZepTabWindow* ZepEditor::AddTabWindow() {
568 auto pTabWindow = new ZepTabWindow(*this);

Callers 5

RemoveTabWindowMethod · 0.80
SetBufferMethod · 0.80
SetFileFlagsMethod · 0.80
ClearFileFlagsMethod · 0.80
SetActiveWindowMethod · 0.80

Calls 9

LayoutRegionFunction · 0.85
GetNameMethod · 0.80
c_strMethod · 0.80
clearMethod · 0.45
sizeMethod · 0.45
GetActiveWindowMethod · 0.45
GetTextSizeMethod · 0.45
push_backMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected