mirror of https://github.com/buggins/dlangui.git
Add MeasureWindow flag to Window helps if you want window with scrollbars but first measure content size.
This commit is contained in:
parent
2bebff9404
commit
ab1ddc7529
|
@ -52,6 +52,8 @@ enum WindowFlag : uint {
|
||||||
Fullscreen = 2,
|
Fullscreen = 2,
|
||||||
/// modal window - grabs input focus
|
/// modal window - grabs input focus
|
||||||
Modal = 4,
|
Modal = 4,
|
||||||
|
/// measure window size on window.show() - helps if you want scrollWindow but on show() you want to set window to mainWidget measured size
|
||||||
|
MeasureSize = 8,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Window states
|
/// Window states
|
||||||
|
|
|
@ -352,6 +352,9 @@ class SDLWindow : Window {
|
||||||
}
|
}
|
||||||
if (_mainWidget) {
|
if (_mainWidget) {
|
||||||
_mainWidget.measure(SIZE_UNSPECIFIED, SIZE_UNSPECIFIED);
|
_mainWidget.measure(SIZE_UNSPECIFIED, SIZE_UNSPECIFIED);
|
||||||
|
if (flags & WindowFlag.MeasureSize) {
|
||||||
|
resizeWindow(Point(_mainWidget.measuredWidth, _mainWidget.measuredHeight));
|
||||||
|
}
|
||||||
adjustWindowOrContentSize(_mainWidget.measuredWidth, _mainWidget.measuredHeight);
|
adjustWindowOrContentSize(_mainWidget.measuredWidth, _mainWidget.measuredHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -432,9 +432,10 @@ class Win32Window : Window {
|
||||||
_mainWidget = new Widget();
|
_mainWidget = new Widget();
|
||||||
}
|
}
|
||||||
ReleaseCapture();
|
ReleaseCapture();
|
||||||
|
|
||||||
if (_mainWidget) {
|
if (_mainWidget) {
|
||||||
_mainWidget.measure(SIZE_UNSPECIFIED, SIZE_UNSPECIFIED);
|
_mainWidget.measure(SIZE_UNSPECIFIED, SIZE_UNSPECIFIED);
|
||||||
|
if (flags & WindowFlag.MeasureSize)
|
||||||
|
resizeWindow(Point(_mainWidget.measuredWidth, _mainWidget.measuredHeight));
|
||||||
adjustWindowOrContentSize(_mainWidget.measuredWidth, _mainWidget.measuredHeight);
|
adjustWindowOrContentSize(_mainWidget.measuredWidth, _mainWidget.measuredHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -430,6 +430,8 @@ class X11Window : DWindow {
|
||||||
}
|
}
|
||||||
if (_mainWidget) {
|
if (_mainWidget) {
|
||||||
_mainWidget.measure(SIZE_UNSPECIFIED, SIZE_UNSPECIFIED);
|
_mainWidget.measure(SIZE_UNSPECIFIED, SIZE_UNSPECIFIED);
|
||||||
|
if (flags & WindowFlag.MeasureSize)
|
||||||
|
resizeWindow(Point(_mainWidget.measuredWidth, _mainWidget.measuredHeight));
|
||||||
_windowRect.right = _dx;// hack to set windowRect, remove when _windowRect will be full supported on X11
|
_windowRect.right = _dx;// hack to set windowRect, remove when _windowRect will be full supported on X11
|
||||||
_windowRect.bottom = _dy;
|
_windowRect.bottom = _dy;
|
||||||
adjustWindowOrContentSize(_mainWidget.measuredWidth, _mainWidget.measuredHeight);
|
adjustWindowOrContentSize(_mainWidget.measuredWidth, _mainWidget.measuredHeight);
|
||||||
|
|
Loading…
Reference in New Issue