Unify editor divider and splitter chrome
This commit is contained in:
50
editor/src/UI/DividerChrome.h
Normal file
50
editor/src/UI/DividerChrome.h
Normal file
@@ -0,0 +1,50 @@
|
||||
#pragma once
|
||||
|
||||
#include "StyleTokens.h"
|
||||
|
||||
#include <imgui.h>
|
||||
|
||||
namespace XCEngine {
|
||||
namespace Editor {
|
||||
namespace UI {
|
||||
|
||||
inline void DrawHorizontalDivider(
|
||||
ImDrawList* drawList,
|
||||
float minX,
|
||||
float maxX,
|
||||
float y,
|
||||
ImU32 color = PanelDividerColor(),
|
||||
float thickness = PanelDividerThickness()) {
|
||||
if (!drawList || maxX <= minX) {
|
||||
return;
|
||||
}
|
||||
|
||||
drawList->AddLine(ImVec2(minX, y), ImVec2(maxX, y), color, thickness);
|
||||
}
|
||||
|
||||
inline void DrawVerticalDivider(
|
||||
ImDrawList* drawList,
|
||||
float x,
|
||||
float minY,
|
||||
float maxY,
|
||||
ImU32 color = PanelDividerColor(),
|
||||
float thickness = PanelDividerThickness()) {
|
||||
if (!drawList || maxY <= minY) {
|
||||
return;
|
||||
}
|
||||
|
||||
drawList->AddLine(ImVec2(x, minY), ImVec2(x, maxY), color, thickness);
|
||||
}
|
||||
|
||||
inline void DrawCurrentWindowBottomDivider(
|
||||
ImU32 color = PanelDividerColor(),
|
||||
float thickness = PanelDividerThickness()) {
|
||||
ImDrawList* drawList = ImGui::GetWindowDrawList();
|
||||
const ImVec2 min = ImGui::GetWindowPos();
|
||||
const ImVec2 max = ImVec2(min.x + ImGui::GetWindowSize().x, min.y + ImGui::GetWindowSize().y);
|
||||
DrawHorizontalDivider(drawList, min.x, max.x, max.y - 1.0f, color, thickness);
|
||||
}
|
||||
|
||||
} // namespace UI
|
||||
} // namespace Editor
|
||||
} // namespace XCEngine
|
||||
Reference in New Issue
Block a user