mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 13:37:42 -05:00
impr: Better UI for the settings view
This commit is contained in:
@@ -269,6 +269,9 @@ namespace ImGui {
|
||||
bool BeginBox();
|
||||
void EndBox();
|
||||
|
||||
void BeginSubWindow(const char *label, ImVec2 size = ImVec2(0, 0));
|
||||
void EndSubWindow();
|
||||
|
||||
template<typename T>
|
||||
constexpr ImGuiDataType getImGuiDataType() {
|
||||
if constexpr (std::same_as<T, u8>) return ImGuiDataType_U8;
|
||||
|
||||
@@ -834,4 +834,21 @@ namespace ImGui {
|
||||
ImGui::PopStyleVar();
|
||||
}
|
||||
|
||||
void BeginSubWindow(const char *label, ImVec2 size) {
|
||||
const bool hasMenuBar = !std::string_view(label).empty();
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 5.0f);
|
||||
if (ImGui::BeginChild(label, size, ImGuiChildFlags_Border | ImGuiChildFlags_AutoResizeY, hasMenuBar ? ImGuiWindowFlags_MenuBar : ImGuiWindowFlags_None)) {
|
||||
if (hasMenuBar && ImGui::BeginMenuBar()) {
|
||||
ImGui::TextUnformatted(label);
|
||||
ImGui::EndMenuBar();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EndSubWindow() {
|
||||
ImGui::EndChild();
|
||||
ImGui::PopStyleVar();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user