Files
XCEngine/editor/src/UI/DividerChrome.h

51 lines
1.2 KiB
C++

#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