Refactor editor dock and panel chrome styling
This commit is contained in:
@@ -1,11 +1,30 @@
|
||||
#pragma once
|
||||
|
||||
#include "StyleTokens.h"
|
||||
|
||||
#include <imgui.h>
|
||||
|
||||
namespace XCEngine {
|
||||
namespace Editor {
|
||||
namespace UI {
|
||||
|
||||
inline float DefaultControlLabelWidth() {
|
||||
return 104.0f;
|
||||
}
|
||||
|
||||
inline ImVec2 DefaultControlCellPadding() {
|
||||
return ImVec2(0.0f, 2.0f);
|
||||
}
|
||||
|
||||
inline ImVec2 DefaultControlFramePadding() {
|
||||
return ImVec2(6.0f, 3.0f);
|
||||
}
|
||||
|
||||
inline void PushControlRowStyles() {
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, DefaultControlCellPadding());
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, DefaultControlFramePadding());
|
||||
}
|
||||
|
||||
inline void StyleVarPush(ImGuiStyleVar idx, float val) {
|
||||
ImGui::PushStyleVar(idx, val);
|
||||
}
|
||||
@@ -56,6 +75,26 @@ inline void EndDisabled(bool disabled = true) {
|
||||
}
|
||||
}
|
||||
|
||||
inline void DrawCurrentWindowBottomBorder(ImU32 color = PanelDividerColor()) {
|
||||
ImDrawList* drawList = ImGui::GetWindowDrawList();
|
||||
const ImVec2 min = ImGui::GetWindowPos();
|
||||
const ImVec2 max = ImVec2(min.x + ImGui::GetWindowSize().x, min.y + ImGui::GetWindowSize().y);
|
||||
drawList->AddLine(ImVec2(min.x, max.y - 1.0f), ImVec2(max.x, max.y - 1.0f), color);
|
||||
}
|
||||
|
||||
inline bool ToolbarButton(const char* label, bool active = false, ImVec2 size = ImVec2(0.0f, 0.0f)) {
|
||||
const ImVec4 buttonColor = ToolbarButtonColor(active);
|
||||
const ImVec4 hoverColor = ToolbarButtonHoveredColor(active);
|
||||
const ImVec4 activeColor = ToolbarButtonActiveColor();
|
||||
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, buttonColor);
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, hoverColor);
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, activeColor);
|
||||
const bool pressed = ImGui::Button(label, size);
|
||||
ImGui::PopStyleColor(3);
|
||||
return pressed;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user