mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-28 07:47:03 -05:00
feat: Added always on top and fullscreen mode toggle
This commit is contained in:
@@ -484,7 +484,38 @@ namespace hex::plugin::builtin {
|
||||
static void createViewMenu() {
|
||||
ContentRegistry::Interface::registerMainMenuItem("hex.builtin.menu.view", 3000);
|
||||
|
||||
ContentRegistry::Interface::addMenuItemSubMenu({ "hex.builtin.menu.view" }, 1000, [] {
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.view", "hex.builtin.menu.view.always_on_top" }, ICON_VS_PINNED, 1000, Keys::F10, [] {
|
||||
static bool state = false;
|
||||
|
||||
state = !state;
|
||||
glfwSetWindowAttrib(ImHexApi::System::getMainWindowHandle(), GLFW_FLOATING, state);
|
||||
}, []{ return true; }, []{ return glfwGetWindowAttrib(ImHexApi::System::getMainWindowHandle(), GLFW_FLOATING); });
|
||||
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.view", "hex.builtin.menu.view.fullscreen" }, ICON_VS_SCREEN_FULL, 2000, Keys::F11, [] {
|
||||
static bool state = false;
|
||||
static ImVec2 position, size;
|
||||
|
||||
state = !state;
|
||||
|
||||
|
||||
const auto window = ImHexApi::System::getMainWindowHandle();
|
||||
if (state) {
|
||||
position = ImHexApi::System::getMainWindowPosition();
|
||||
size = ImHexApi::System::getMainWindowSize();
|
||||
|
||||
const auto monitor = glfwGetPrimaryMonitor();
|
||||
const auto videoMode = glfwGetVideoMode(monitor);
|
||||
|
||||
glfwSetWindowMonitor(window, monitor, 0, 0, videoMode->width, videoMode->height, videoMode->refreshRate);
|
||||
} else {
|
||||
glfwSetWindowMonitor(window, nullptr, position.x, position.y, size.x, size.y, 0);
|
||||
}
|
||||
|
||||
}, []{ return true; }, []{ return glfwGetWindowMonitor(ImHexApi::System::getMainWindowHandle()) != nullptr; });
|
||||
|
||||
ContentRegistry::Interface::addMenuItemSeparator({ "hex.builtin.menu.view" }, 3000);
|
||||
|
||||
ContentRegistry::Interface::addMenuItemSubMenu({ "hex.builtin.menu.view" }, 4000, [] {
|
||||
for (auto &[name, view] : ContentRegistry::Views::impl::getEntries()) {
|
||||
if (view->hasViewMenuItemEntry()) {
|
||||
auto &state = view->getWindowOpenState();
|
||||
|
||||
Reference in New Issue
Block a user