Fix Fl_Window::size_range() documentation (STR 3352)

"Tiny window problem if child group larger than window"

See Greg's comment 4: "something is wrong here: either the logic or
the docs are incorrect, not sure which."

It turned out that both were incorrect.

Since we fixed the code this commit completes the STR by fixing the
docs as well so they match the behavior.
This commit is contained in:
Albrecht Schlosser 2021-12-06 19:49:16 +01:00
parent 8bf62c67cf
commit 39b5ae9e6e
2 changed files with 32 additions and 24 deletions

View File

@ -162,6 +162,10 @@ public:
See the \ref resize chapter for more examples and detailed explanation.
\note The resizable() widget of a window can also affect the window's
resizing behavior if Fl_Window::size_range() is not called.
\see Fl_Window::size_range()
*/
void resizable(Fl_Widget* o) {resizable_ = o;}
/**

View File

@ -594,39 +594,43 @@ int Fl_Window::handle(int ev)
}
/**
Sets the allowable range the user can resize this window to.
This only works for top-level windows.
Sets the allowable range the user can resize this window to.
This only works for top-level windows.
If this function is not called, FLTK tries to figure out the range
from the setting of resizable():
<UL>
<LI>If resizable() is NULL (this is the default) then the window cannot
be resized and the resize border and max-size control will not be
displayed for the window.</LI>
<LI>If either dimension of resizable() is less than 100, then that is
considered the minimum size. Otherwise the resizable() has a minimum
size of 100.</LI>
<LI>If either dimension of resizable() is zero, then that is also the
maximum size (so the window cannot resize in that direction).</LI>
</UL>
It is undefined what happens if the current window size does not fit
in the constraints passed to size_range().
It is undefined what happens if the current size does not fit in the
constraints passed to size_range().
If this function is \b not called, FLTK tries to figure out the range
from the setting of the window's resizable() widget:
\param[in] minWidth, minHeight The smallest the window can be.
- If resizable() is NULL (this is the default) then the window cannot
be resized and the resize border and max-size control will not be
displayed for the window.
- If either dimension of resizable() is zero, then the minimum size is
also the maximum size (so the window cannot resize in that direction).
- Otherwise the size of the resizable is irrelevant and the window's
minimum size is the current size and the maximum size is unlimited
like if size_range(w(), h(), 0, 0) was called.
\param[in] minWidth, minHeight The smallest the window can be.
Either value must be greater than 0.
\param[in] maxWidth, maxHeight The largest the window can be. If either is
equal to the minimum then you cannot resize in that direction.
\param[in] maxWidth, maxHeight The largest the window can be. If either
is equal to the minimum then you cannot resize in that direction.
If either is zero then FLTK picks a maximum size in that direction
such that the window will fill the screen.
\param[in] deltaX, deltaY These are size increments. The window will be
\param[in] deltaX, deltaY These are size increments. The window will be
constrained to widths of <tt>minWidth + N * deltaX</tt>, where N is any
non-negative integer. If these are less or equal to 1 they are ignored.
(this is ignored on Windows)
\param[in] aspectRatio A flag that indicates that the window should preserve
non-negative integer. If these are less or equal to 1 they are ignored
(this is ignored on Windows).
\param[in] aspectRatio A flag that indicates that the window should preserve
its aspect ratio. This only works if both the maximum and minimum have
the same aspect ratio (ignored on Windows and by many X window managers).
*/
*/
void Fl_Window::size_range(int minWidth, int minHeight,
int maxWidth, int maxHeight,
int deltaX, int deltaY, int aspectRatio) {