From e325c2e4a0a927f0b70c7f71da02065019c020ef Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Sun, 26 May 2024 17:50:40 +0200 Subject: Adding new call `Fl_Window::get_size_range()`, #981 --- src/Fl_Window.cxx | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'src/Fl_Window.cxx') diff --git a/src/Fl_Window.cxx b/src/Fl_Window.cxx index 38b3da521..e2e0f8237 100644 --- a/src/Fl_Window.cxx +++ b/src/Fl_Window.cxx @@ -606,7 +606,7 @@ int Fl_Window::handle(int ev) } /** - Sets the allowable range the user can resize this window to. + Sets the allowable range to which the user can resize this window. We recommend to call size_range() if you have a resizable() widget in a main window, and to call it after setting the resizable() and @@ -677,6 +677,30 @@ void Fl_Window::size_range(int minWidth, int minHeight, pWindowDriver->size_range(); // platform specific stuff } +/** + Gets the allowable range to which the user can resize this window. + + \param[out] minWidth, minHeight, maxWidth, maxHeight, deltaX, deltaY, aspectRatio + are all pointers to integers that will receive the current respective value + during the call. Every pointer can be NULL if that value is not needed. + \retval 0 if size range not set + \retval 1 if the size range was explicitly set by a call to Fl_Window::size_range() + or has been calculated + \see Fl_Window::size_range(int minWidth, int minHeight, int maxWidth, int maxHeight, int deltaX, int deltaY, int aspectRatio) + */ +uchar Fl_Window::get_size_range(int *minWidth, int *minHeight, + int *maxWidth, int *maxHeight, + int *deltaX, int *deltaY, int *aspectRatio) { + if (minWidth) *minWidth = minw_; + if (minHeight) *minHeight = minh_; + if (maxWidth) *maxWidth = maxw_; + if (maxHeight) *maxHeight = maxh_; + if (deltaX) *deltaX = dw_; + if (deltaY) *deltaY = dh_; + if (aspectRatio) *aspectRatio = aspect_; + return size_range_set_; +} + /** Protected method to calculate the default size range of a window. -- cgit v1.2.3