62 lines
1.2 KiB
C
62 lines
1.2 KiB
C
|
|
#pragma once
|
||
|
|
|
||
|
|
#include <imgui.h>
|
||
|
|
|
||
|
|
namespace XCEngine {
|
||
|
|
namespace Editor {
|
||
|
|
namespace UI {
|
||
|
|
|
||
|
|
inline void StyleVarPush(ImGuiStyleVar idx, float val) {
|
||
|
|
ImGui::PushStyleVar(idx, val);
|
||
|
|
}
|
||
|
|
|
||
|
|
inline void StyleVarPush(ImGuiStyleVar idx, ImVec2 val) {
|
||
|
|
ImGui::PushStyleVar(idx, val);
|
||
|
|
}
|
||
|
|
|
||
|
|
inline void StyleColorPush(ImGuiCol idx, ImU32 col) {
|
||
|
|
ImGui::PushStyleColor(idx, col);
|
||
|
|
}
|
||
|
|
|
||
|
|
inline void StyleColorPush(ImGuiCol idx, ImVec4 col) {
|
||
|
|
ImGui::PushStyleColor(idx, col);
|
||
|
|
}
|
||
|
|
|
||
|
|
inline void PopStyleVar(int count = 1) {
|
||
|
|
ImGui::PopStyleVar(count);
|
||
|
|
}
|
||
|
|
|
||
|
|
inline void PopStyleColor(int count = 1) {
|
||
|
|
ImGui::PopStyleColor(count);
|
||
|
|
}
|
||
|
|
|
||
|
|
inline bool BeginPopup(const char* str_id, ImGuiWindowFlags flags = 0) {
|
||
|
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(12.0f, 10.0f));
|
||
|
|
bool is_open = ImGui::BeginPopup(str_id, flags);
|
||
|
|
if (!is_open) {
|
||
|
|
ImGui::PopStyleVar();
|
||
|
|
}
|
||
|
|
return is_open;
|
||
|
|
}
|
||
|
|
|
||
|
|
inline void EndPopup() {
|
||
|
|
ImGui::EndPopup();
|
||
|
|
ImGui::PopStyleVar();
|
||
|
|
}
|
||
|
|
|
||
|
|
inline void BeginDisabled(bool disabled = true) {
|
||
|
|
if (disabled) {
|
||
|
|
ImGui::BeginDisabled();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
inline void EndDisabled(bool disabled = true) {
|
||
|
|
if (disabled) {
|
||
|
|
ImGui::EndDisabled();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|