Skip to content

Commit

Permalink
feat: Added window actions popup when clicking on icon
Browse files Browse the repository at this point in the history
  • Loading branch information
WerWolv committed Aug 19, 2023
1 parent e70ec10 commit 6c8a907
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions main/source/window/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,31 @@ namespace hex {
if (ImHexApi::System::isBorderlessWindowModeEnabled()) {
auto menuBarHeight = ImGui::GetCurrentWindow()->MenuBarHeight();
ImGui::SetCursorPosX(5);

ImGui::Image(this->m_logoTexture, ImVec2(menuBarHeight, menuBarHeight));
ImGui::SetCursorPosX(5);
ImGui::InvisibleButton("##logo", ImVec2(menuBarHeight, menuBarHeight));
ImGui::OpenPopupOnItemClick("WindowingMenu", ImGuiPopupFlags_MouseButtonLeft);
}

if (ImGui::BeginPopup("WindowingMenu")) {
bool maximized = glfwGetWindowAttrib(this->m_window, GLFW_MAXIMIZED);

ImGui::BeginDisabled(!maximized);
if (ImGui::MenuItem(ICON_VS_CHROME_RESTORE " Restore")) glfwRestoreWindow(this->m_window);
ImGui::EndDisabled();

if (ImGui::MenuItem(ICON_VS_CHROME_MINIMIZE " Minimize")) glfwIconifyWindow(this->m_window);

ImGui::BeginDisabled(maximized);
if (ImGui::MenuItem(ICON_VS_CHROME_MAXIMIZE " Maximize")) glfwMaximizeWindow(this->m_window);
ImGui::EndDisabled();

ImGui::Separator();

if (ImGui::MenuItem(ICON_VS_CHROME_CLOSE " Close")) ImHexApi::System::closeImHex();

ImGui::EndPopup();
}

for (const auto &[priority, menuItem] : ContentRegistry::Interface::impl::getMainMenuItems()) {
Expand Down

0 comments on commit 6c8a907

Please sign in to comment.