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

Closed
wants to merge 1 commit into
base: master
from

Conversation

2 participants
@Ruckamongus
Contributor

Ruckamongus commented Sep 11, 2016

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.

@Ruckamongus

This comment has been minimized.

Contributor

Ruckamongus commented Sep 11, 2016

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.

@Ruckamongus Ruckamongus force-pushed the Ruckamongus:master branch from 184f5cf to 785a0ff Sep 11, 2016

@texus

This comment has been minimized.

Owner

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