1
0
mirror of synced 2024-11-24 07:40:17 +01:00

impr: Remove frame borders in more cases

This commit is contained in:
WerWolv 2024-05-17 22:05:32 +02:00
parent 0571dae9b7
commit 964d98dd7b
2 changed files with 13 additions and 4 deletions

View File

@ -356,6 +356,7 @@ namespace hex::plugin::builtin {
}
void drawWelcomeScreen() {
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0);
ImGui::PushStyleColor(ImGuiCol_WindowShadow, 0x00);
if (ImGui::Begin("ImHexDockSpace")) {
if (!ImHexApi::Provider::isValid()) {
@ -408,11 +409,13 @@ namespace hex::plugin::builtin {
}
ImGui::End();
ImGui::PopStyleColor();
ImGui::PopStyleVar();
}
/**
* @brief Draw some default background if there are no views available in the current layout
*/
void drawNoViewsBackground() {
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0);
ImGui::PushStyleColor(ImGuiCol_WindowShadow, 0x00);
if (ImGui::Begin("ImHexDockSpace")) {
static std::array<char, 256> title;
@ -453,6 +456,7 @@ namespace hex::plugin::builtin {
}
ImGui::End();
ImGui::PopStyleColor();
ImGui::PopStyleVar();
}
}

View File

@ -339,6 +339,7 @@ namespace hex::plugin::builtin {
void drawMainMenu([[maybe_unused]] float menuBarHeight) {
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0F);
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0F);
ImGui::SetNextWindowScroll(ImVec2(0, 0));
#if defined(OS_MACOS)
@ -351,7 +352,7 @@ namespace hex::plugin::builtin {
auto window = ImHexApi::System::getMainWindowHandle();
ImGui::PopStyleVar();
ImGui::PopStyleVar(2);
if (ImHexApi::System::isBorderlessWindowModeEnabled()) {
#if defined(OS_WINDOWS)
@ -391,11 +392,13 @@ namespace hex::plugin::builtin {
ImGui::EndMainMenuBar();
} else {
ImGui::PopStyleVar();
ImGui::PopStyleVar(2);
}
}
void drawToolbar() {
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0F);
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0F);
if (ImGui::BeginMenuBar()) {
for (const auto &callback : ContentRegistry::Interface::impl::getToolbarItems()) {
callback();
@ -412,6 +415,7 @@ namespace hex::plugin::builtin {
ImGui::EndMenuBar();
}
ImGui::PopStyleVar(2);
}
bool anySidebarItemsAvailable() {
@ -450,10 +454,11 @@ namespace hex::plugin::builtin {
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0F);
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0F);
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0));
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0);
// Draw main window decoration
if (ImGui::Begin("ImHexDockSpace", nullptr, windowFlags)) {
ImGui::PopStyleVar();
ImGui::PopStyleVar(2);
const auto drawList = ImGui::GetWindowDrawList();
const auto shouldDrawSidebar = anySidebarItemsAvailable();
@ -489,7 +494,7 @@ namespace hex::plugin::builtin {
ImGui::GetColorU32(ImGuiCol_Separator));
}
} else {
ImGui::PopStyleVar();
ImGui::PopStyleVar(2);
}
ImGui::End();