summaryrefslogtreecommitdiff
path: root/src/Fl_Window.cxx
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2016-03-23 17:13:09 +0000
committerManolo Gouy <Manolo>2016-03-23 17:13:09 +0000
commite3ee1e7b81c9b1a8806b80cd69c66eeccc679bf9 (patch)
tree60f70f3960bb65296b42884bed91f8a165ee9f3f /src/Fl_Window.cxx
parent6608db0b0c88fb01a903c47b9e1bbed477766ec2 (diff)
Rewrite Fl_Window::size_range_() under the driver model.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11410 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Window.cxx')
-rw-r--r--src/Fl_Window.cxx47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/Fl_Window.cxx b/src/Fl_Window.cxx
index 8cf091427..70701bab6 100644
--- a/src/Fl_Window.cxx
+++ b/src/Fl_Window.cxx
@@ -554,6 +554,53 @@ int Fl_Window::handle(int ev)
return Fl_Group::handle(ev);
}
+/**
+ Sets the allowable range the user can resize this window to.
+ This only works for top-level windows.
+ <UL>
+ <LI>\p minw and \p minh are the smallest the window can be.
+ Either value must be greater than 0.</LI>
+ <LI>\p maxw and \p maxh are the largest the window can be. If either is
+ <I>equal</I> 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.</LI>
+ <LI>\p dw and \p dh are size increments. The window will be constrained
+ to widths of minw + N * dw, where N is any non-negative integer.
+ If these are less or equal to 1 they are ignored (this is ignored
+ on WIN32).</LI>
+ <LI>\p aspect is 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 WIN32 and by many X window managers).
+ </LI>
+ </UL>
+
+ 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 size does not fit in the
+ constraints passed to size_range().
+ */
+void Fl_Window::size_range(int minw, int minh, int maxw, int maxh, int dw, int dh, int aspect) {
+ this->minw = minw;
+ this->minh = minh;
+ this->maxw = maxw;
+ this->maxh = maxh;
+ this->dw = dw;
+ this->dh = dh;
+ this->aspect = aspect;
+ pWindowDriver->size_range();
+}
+
//
// End of "$Id$".
//