mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 13:37:42 -05:00
feat: Added full-screen views for use with subcommands in the future
This commit is contained in:
@@ -502,33 +502,38 @@ namespace hex::plugin::builtin {
|
||||
if (ImGui::Begin("Welcome Screen", nullptr, ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoDocking | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove)) {
|
||||
ImGui::BringWindowToDisplayBack(ImGui::GetCurrentWindowRead());
|
||||
|
||||
drawWelcomeScreenBackground();
|
||||
if (const auto &fullScreenView = ContentRegistry::Views::impl::getFullScreenView(); fullScreenView != nullptr) {
|
||||
fullScreenView->draw();
|
||||
} else {
|
||||
drawWelcomeScreenBackground();
|
||||
|
||||
if (s_simplifiedWelcomeScreen)
|
||||
drawWelcomeScreenContentSimplified();
|
||||
else
|
||||
drawWelcomeScreenContentFull();
|
||||
if (s_simplifiedWelcomeScreen)
|
||||
drawWelcomeScreenContentSimplified();
|
||||
else
|
||||
drawWelcomeScreenContentFull();
|
||||
|
||||
static bool hovered = false;
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, hovered ? 1.0F : 0.3F);
|
||||
{
|
||||
const ImVec2 windowSize = { 150_scaled, ImGui::GetTextLineHeightWithSpacing() * 3.5F };
|
||||
ImGui::SetCursorScreenPos(ImGui::GetWindowPos() + ImGui::GetWindowSize() - windowSize - ImGui::GetStyle().WindowPadding);
|
||||
ImGui::PushStyleColor(ImGuiCol_ChildBg, ImGui::GetStyleColorVec4(ImGuiCol_WindowBg));
|
||||
if (ImGuiExt::BeginSubWindow("hex.builtin.welcome.header.quick_settings"_lang, nullptr, windowSize, ImGuiChildFlags_AutoResizeY)) {
|
||||
if (ImGuiExt::ToggleSwitch("hex.builtin.welcome.quick_settings.simplified"_lang, &s_simplifiedWelcomeScreen)) {
|
||||
ContentRegistry::Settings::write<bool>("hex.builtin.setting.interface", "hex.builtin.setting.interface.simplified_welcome_screen", s_simplifiedWelcomeScreen);
|
||||
WorkspaceManager::switchWorkspace(s_simplifiedWelcomeScreen ? "Minimal" : "Default");
|
||||
}
|
||||
|
||||
static bool hovered = false;
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, hovered ? 1.0F : 0.3F);
|
||||
{
|
||||
const ImVec2 windowSize = { 150_scaled, ImGui::GetTextLineHeightWithSpacing() * 3.5F };
|
||||
ImGui::SetCursorScreenPos(ImGui::GetWindowPos() + ImGui::GetWindowSize() - windowSize - ImGui::GetStyle().WindowPadding);
|
||||
ImGui::PushStyleColor(ImGuiCol_ChildBg, ImGui::GetStyleColorVec4(ImGuiCol_WindowBg));
|
||||
if (ImGuiExt::BeginSubWindow("hex.builtin.welcome.header.quick_settings"_lang, nullptr, windowSize, ImGuiChildFlags_AutoResizeY)) {
|
||||
if (ImGuiExt::ToggleSwitch("hex.builtin.welcome.quick_settings.simplified"_lang, &s_simplifiedWelcomeScreen)) {
|
||||
ContentRegistry::Settings::write<bool>("hex.builtin.setting.interface", "hex.builtin.setting.interface.simplified_welcome_screen", s_simplifiedWelcomeScreen);
|
||||
WorkspaceManager::switchWorkspace(s_simplifiedWelcomeScreen ? "Minimal" : "Default");
|
||||
}
|
||||
ImGuiExt::EndSubWindow();
|
||||
|
||||
ImGui::PopStyleColor();
|
||||
hovered = ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenOverlappedByItem | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem);
|
||||
|
||||
}
|
||||
ImGuiExt::EndSubWindow();
|
||||
|
||||
ImGui::PopStyleColor();
|
||||
hovered = ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenOverlappedByItem | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem);
|
||||
|
||||
ImGui::PopStyleVar();
|
||||
}
|
||||
ImGui::PopStyleVar();
|
||||
|
||||
}
|
||||
ImGui::End();
|
||||
ImGui::PopStyleVar();
|
||||
|
||||
@@ -495,7 +495,12 @@ namespace hex::plugin::builtin {
|
||||
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
drawMenu();
|
||||
|
||||
{
|
||||
ImGui::BeginDisabled(ContentRegistry::Views::impl::getFullScreenView() != nullptr);
|
||||
drawMenu();
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
menu::endMainMenuBar();
|
||||
}
|
||||
menu::enableNativeMenuBar(false);
|
||||
@@ -541,18 +546,23 @@ namespace hex::plugin::builtin {
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0F);
|
||||
if (ImGui::BeginMenuBar()) {
|
||||
drawTitleBarBackDrop();
|
||||
for (const auto &callback : ContentRegistry::Interface::impl::getToolbarItems()) {
|
||||
callback();
|
||||
ImGui::SameLine();
|
||||
}
|
||||
|
||||
if (auto provider = ImHexApi::Provider::get(); provider != nullptr) {
|
||||
ImGui::BeginDisabled(TaskManager::getRunningTaskCount() > 0);
|
||||
if (ImGui::CloseButton(ImGui::GetID("ProviderCloseButton"), ImGui::GetCursorScreenPos() + ImVec2(ImGui::GetContentRegionAvail().x - 17_scaled, 3_scaled))) {
|
||||
ImHexApi::Provider::remove(provider);
|
||||
ImGui::BeginDisabled(ContentRegistry::Views::impl::getFullScreenView() != nullptr);
|
||||
{
|
||||
for (const auto &callback : ContentRegistry::Interface::impl::getToolbarItems()) {
|
||||
callback();
|
||||
ImGui::SameLine();
|
||||
}
|
||||
|
||||
if (auto provider = ImHexApi::Provider::get(); provider != nullptr) {
|
||||
ImGui::BeginDisabled(TaskManager::getRunningTaskCount() > 0);
|
||||
if (ImGui::CloseButton(ImGui::GetID("ProviderCloseButton"), ImGui::GetCursorScreenPos() + ImVec2(ImGui::GetContentRegionAvail().x - 17_scaled, 3_scaled))) {
|
||||
ImHexApi::Provider::remove(provider);
|
||||
}
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
ImGui::EndDisabled();
|
||||
|
||||
ImGui::EndMenuBar();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user