Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: Extend demo with full screen window / docking examples #7955

Closed
Andersama opened this issue Sep 5, 2024 · 9 comments
Closed

Comments

@Andersama
Copy link

Version/Branch of Dear ImGui:

Any

Back-ends:

Any

Compiler, OS:

Any

Full config/build information:

No response

Details:

I just figured I'd point out that while:

ImGui::ShowDemoWindow(&show_demo_window);

is an excellent resource for the basics, this function doesn't show off how to make a window "maximized" or fit to the screen, which is one of the first things a person would like to do.

I figure there's probably a good place to add a toggle button in the demo to do just that, and similarly, for builds with the dock enabled there should probably maybe there's there's a variation of "ShowDemoWindow" called "ShowDemoDock" that allows shuffling around some child windows.

Screenshots/Video:

No response

Minimal, Complete and Verifiable Example code:

No response

@ocornut ocornut added the demo label Sep 5, 2024
@ocornut
Copy link
Owner

ocornut commented Sep 5, 2024

The DockSpace demo already has a fullscreen demo but because it does quite more things it may be a little unobvious.

You basically need to do:

const ImGuiViewport* viewport = ImGui::GetMainViewport();
ImGui::SetNextWindowPos(viewport->WorkPos);
ImGui::SetNextWindowSize(viewport->WorkSize);
ImGui::SetNextWindowViewport(viewport->ID); // in docking branch
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
ImGuiWindowFlags flags = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoBringToFrontOnFocus;
ImGui::Begin(...., ..., flags);
ImGui::PopStyleVar();

@ocornut
Copy link
Owner

ocornut commented Sep 5, 2024

Err, I just realized there IS such demo.
Demo->Examples->Fullscreen Window.
Leading to the ShowExampleAppFullscreen() function.

But if you mean adding a "Maximize" button to every window, that's another topic. I presume we might support it at some point. Linking to #2104 and #3486.

called "ShowDemoDock" that allows shuffling around some child windows.

There is a Dockspace demo but that's more advanced. You can already dock and drag anything into anything by default.

@Andersama
Copy link
Author

Andersama commented Sep 5, 2024

Ah, well, I didn't find that example, despite it being under the examples drop down. Yeah it might be better if it's related to minimizing/maximizing/restoring type buttons, or just better placement. I'd almost suggest putting it underneath the dropdowns.

I'm realizing now why it's strange, that demo opens another window, where you might expect it to impact the demo window.

@ocornut
Copy link
Owner

ocornut commented Sep 5, 2024

Yeah it might be better if it's related to minimizing/maximizing/restoring type buttons,

The existing open issues are here to track when this will be implemented.

I'm realizing now why it's strange, that demo opens another window, where you might expect it to impact the demo window.

We have many many features to demo they cannot all be packed at the beginning of the main demo window.

@ocornut ocornut closed this as completed Sep 5, 2024
@Andersama
Copy link
Author

Call me crazy, would it not be possible to add it to the front/main window?

I mean it seems like you're referencing static variables to do similar things for other features.

@ocornut
Copy link
Owner

ocornut commented Sep 5, 2024

I don't understand what you are saying. Please be more explicit. Maybe https://github.com/ocornut/imgui/wiki/Glossary can help.

@Andersama
Copy link
Author

I thought you were referring to adding code to demonstrate the feature on the demo window itself, it seems like it'd be doable towards the start of the demo window function.

@Andersama
Copy link
Author

Andersama commented Sep 6, 2024

@ocornut I'm not sure because it seems like from the links you referenced that someone started on this project quite a while ago, is there a commit already being considered?

I took a couple minutes and I've got a minimize/maximize/restore button in the title bar using flags. The only remaining part is what the behavior exactly is.

Edit: Maximize/Restores fairly clear, I'm not 100% on how "minimize" should act. A thought I had was that it could "collapse" and move the collapsed window handle to a particular position. There's also the idea like w/ OS's where minimizing is associated w/ a button-like icon somewhere else.

image

@ocornut
Copy link
Owner

ocornut commented Sep 6, 2024

I think this discussion may be moved to #2104. If that issue is open it means that the work hasn't been done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants