Adding new call Fl_Window::get_size_range(), #981

This commit is contained in:
Matthias Melcher 2024-05-26 17:50:40 +02:00
parent 2bab8c94ff
commit e325c2e4a0
2 changed files with 27 additions and 1 deletions

View File

@ -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*) */

View File

@ -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.