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

Allow the ChildWindow to have maximum and minimum sizes. #64

wants to merge 1 commit into from

Allow the ChildWindow to have maximum and minimum sizes. #64

wants to merge 1 commit into from


Copy link

Alright, so this allows the user to explicitly set a ChildWindow's minimum and maximum sizes when resizing by dragging the edges. It's easiest to test by modifying the ChildWindow theme properties to something like:

ChildWindow {
    BorderColor     : rgb(255, 0, 0);
    Borders         : (4, 4, 4, 4);

Some behavioral decisions:

  • setSize() does not respect any previously set maximum/minimum sizes
  • Resizing width will stop to keep the buttons within the titlebar even if the set minimum size is smaller. For example, a ChildWindow with 2 buttons may require a minimum of 50 pixels to keep the buttons on the titlebar properly. If you set the minimum width of the ChildWindow to be 30, the window will not be resized below 50.
  • Negative values are allowed and not checked for. Per @texus: "I consider negative size undefined behavior in widgets"

The main.cpp code for testing is a bit sloppy, but on pastebin for convenience.

Copy link
Contributor Author

I forgot about the constexpr thing and C++11's restraints. Is TGUI meant to support C++11? If so I should change that clamp() implementation.

Copy link

texus commented Sep 11, 2016

Merged in e717b44 with some changes.

@texus texus closed this Sep 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants