feat: Added a button to restore default layout when there are no views open (#1053)
Co-authored-by: Nik <werwolv98@gmail.com>
This commit is contained in:
parent
980e4cad06
commit
34e12e2515
@ -151,4 +151,6 @@ namespace ImGui {
|
||||
|
||||
bool BitCheckbox(const char* label, bool* v);
|
||||
|
||||
bool DimmedButton(const char* label);
|
||||
|
||||
}
|
@ -698,4 +698,19 @@ namespace ImGui {
|
||||
return pressed;
|
||||
}
|
||||
|
||||
bool DimmedButton(const char* label){
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImGui::GetCustomColorU32(ImGuiCustomCol_DescButtonHovered));
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImGui::GetCustomColorU32(ImGuiCustomCol_DescButton));
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImGui::GetColorU32(ImGuiCol_ButtonActive));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImGui::GetCustomColorU32(ImGuiCustomCol_DescButtonActive));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1);
|
||||
|
||||
bool res = ImGui::Button(label);
|
||||
|
||||
ImGui::PopStyleColor(4);
|
||||
ImGui::PopStyleVar(1);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
}
|
@ -132,6 +132,7 @@
|
||||
"hex.builtin.inspector.utf8": "UTF-8 code point",
|
||||
"hex.builtin.inspector.wide": "Wide Character",
|
||||
"hex.builtin.layouts.default": "Default",
|
||||
"hex.builtin.layouts.none.restore_default": "Restore default layout",
|
||||
"hex.builtin.menu.edit": "Edit",
|
||||
"hex.builtin.menu.edit.bookmark.create": "Create bookmark",
|
||||
"hex.builtin.menu.edit.redo": "Redo",
|
||||
|
@ -418,10 +418,23 @@ namespace hex::plugin::builtin {
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(10_scaled, 10_scaled));
|
||||
if (ImGui::BeginChild("NoViewsBackground", ImVec2(0, 0), false, ImGuiWindowFlags_AlwaysUseWindowPadding | ImGuiWindowFlags_NoScrollWithMouse)) {
|
||||
auto imageSize = scaled(ImVec2(350, 350));
|
||||
auto pos = (ImGui::GetContentRegionAvail() - imageSize) / 2;
|
||||
auto imagePos = (ImGui::GetContentRegionAvail() - imageSize) / 2;
|
||||
|
||||
ImGui::SetCursorPos(pos);
|
||||
ImGui::SetCursorPos(imagePos);
|
||||
ImGui::Image(s_backdropTexture, imageSize);
|
||||
|
||||
auto loadDefaultText = "hex.builtin.layouts.none.restore_default"_lang;
|
||||
auto textSize = ImGui::CalcTextSize(loadDefaultText);
|
||||
|
||||
auto textPos = scaled(ImVec2(
|
||||
(ImGui::GetContentRegionAvail().x - textSize.x) / 2,
|
||||
imagePos.y + imageSize.y
|
||||
));
|
||||
|
||||
ImGui::SetCursorPos(textPos);
|
||||
if (ImGui::DimmedButton(loadDefaultText)){
|
||||
loadDefaultLayout();
|
||||
}
|
||||
}
|
||||
ImGui::EndChild();
|
||||
ImGui::PopStyleVar();
|
||||
|
Loading…
Reference in New Issue
Block a user