-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve Theme window (deprecated some private api)
- Loading branch information
Showing
6 changed files
with
52 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,26 @@ | ||
#include "hello_imgui/hello_imgui_theme.h" | ||
#include "hello_imgui/hello_imgui.h" | ||
|
||
namespace HelloImGui | ||
{ | ||
bool gShowTweakWindow = false; | ||
|
||
void Theme_WindowGui(ImGuiTheme::ImGuiTweakedTheme& tweakedTheme) | ||
void ShowThemeTweakGuiWindow(bool* p_open) | ||
{ | ||
if (gShowTweakWindow) | ||
bool showWindow = true; | ||
if (p_open != nullptr) | ||
showWindow = *p_open; | ||
|
||
if (showWindow) | ||
{ | ||
ImGui::SetNextWindowSize(ImVec2(600.f, 750.f), ImGuiCond_FirstUseEver); | ||
if (ImGui::Begin("Theme Tweaks", &gShowTweakWindow)) | ||
auto& tweakedTheme = HelloImGui::GetRunnerParams()->imGuiWindowParams.tweakedTheme; | ||
ImGui::SetNextWindowSize(HelloImGui::EmToVec2(20.f, 46.f), ImGuiCond_FirstUseEver); | ||
if (ImGui::Begin("Theme Tweaks", p_open)) | ||
{ | ||
if (ImGuiTheme::ShowThemeTweakGui(&tweakedTheme)) | ||
{ | ||
ApplyTweakedTheme(tweakedTheme); | ||
} | ||
} | ||
ImGui::End(); | ||
} | ||
} | ||
|
||
void Theme_MenuGui(ImGuiTheme::ImGuiTweakedTheme& tweakedTheme) | ||
{ | ||
if (ImGui::BeginMenu("Theme")) | ||
{ | ||
if (ImGui::MenuItem("Theme tweak window", nullptr, gShowTweakWindow)) | ||
gShowTweakWindow = !gShowTweakWindow; | ||
ImGui::Separator(); | ||
for (int i = 0; i < ImGuiTheme::ImGuiTheme_Count; ++i) | ||
{ | ||
ImGuiTheme::ImGuiTheme_ theme = (ImGuiTheme::ImGuiTheme_)(i); | ||
bool selected = (theme == tweakedTheme.Theme); | ||
if (ImGui::MenuItem(ImGuiTheme::ImGuiTheme_Name(theme), nullptr, selected)) | ||
{ | ||
tweakedTheme.Theme = theme; | ||
ImGuiTheme::ApplyTheme(theme); | ||
} | ||
} | ||
ImGui::EndMenu(); | ||
} | ||
} | ||
} // namespace HellImGui |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters