summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Melcher <github@matthiasm.com>2024-05-26 17:50:40 +0200
committerMatthias Melcher <github@matthiasm.com>2024-05-26 17:50:47 +0200
commite325c2e4a0a927f0b70c7f71da02065019c020ef (patch)
treeb5291f7461a644ae3d93b54854c38643ddb57e52
parent2bab8c94ff0d2440520b0aeefc3edaec18c02595 (diff)
Adding new call `Fl_Window::get_size_range()`, #981
-rw-r--r--FL/Fl_Window.H2
-rw-r--r--src/Fl_Window.cxx26
2 files changed, 27 insertions, 1 deletions
diff --git a/FL/Fl_Window.H b/FL/Fl_Window.H
index adf0aa44c..6c6e26493 100644
--- a/FL/Fl_Window.H
+++ b/FL/Fl_Window.H
@@ -347,6 +347,8 @@ public:
void size_range(int minw, int minh, int maxw=0, int maxh=0, int dw=0, int dh=0, int aspect=0);
+ uchar get_size_range(int *minw, int *minh, int *maxw=NULL, int *maxh=NULL, int *dw=NULL, int *dh=NULL, int *aspect=NULL);
+
/** See void Fl_Window::label(const char*) */
const char* label() const {return Fl_Widget::label();}
/** See void Fl_Window::iconlabel(const char*) */
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
@@ -678,6 +678,30 @@ void Fl_Window::size_range(int minWidth, int minHeight,
}
/**
+ 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.
This method is called internally prior to showing a window to ensure that