mirror of https://github.com/buggins/dlangui.git
Merge pull request #475 from and3md/expand_size
ExpandSize flag - another #466 fix
This commit is contained in:
commit
ab0c10d069
|
@ -266,7 +266,9 @@ extern (C) int UIAppMain(string[] args) {
|
||||||
//}
|
//}
|
||||||
|
|
||||||
// create window
|
// create window
|
||||||
Window window = Platform.instance.createWindow("DlangUI Example 1", null, WindowFlag.Resizable, 800, 700);
|
//Window window = Platform.instance.createWindow("DlangUI Example 1", null, WindowFlag.Resizable, 800, 700);
|
||||||
|
// Expand window size if content is bigger than 800, 700 (change to above version if you want scrollbars and 800, 700 size)
|
||||||
|
Window window = Platform.instance.createWindow("DlangUI Example 1", null, WindowFlag.Resizable | WindowFlag.ExpandSize, 800, 700);
|
||||||
// here you can see window or content resize mode
|
// here you can see window or content resize mode
|
||||||
//Window window = Platform.instance.createWindow("DlangUI Example 1", null, WindowFlag.Resizable, 400, 400);
|
//Window window = Platform.instance.createWindow("DlangUI Example 1", null, WindowFlag.Resizable, 400, 400);
|
||||||
//window.windowOrContentResizeMode = WindowOrContentResizeMode.resizeWindow;
|
//window.windowOrContentResizeMode = WindowOrContentResizeMode.resizeWindow;
|
||||||
|
|
|
@ -56,6 +56,8 @@ enum WindowFlag : uint {
|
||||||
MeasureSize = 8,
|
MeasureSize = 8,
|
||||||
/// window without decorations
|
/// window without decorations
|
||||||
Borderless = 16,
|
Borderless = 16,
|
||||||
|
/// expand window size if main widget minimal size is greater than size defined in window constructor
|
||||||
|
ExpandSize = 32,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Window states
|
/// Window states
|
||||||
|
@ -333,9 +335,9 @@ class Window : CustomEventTarget {
|
||||||
@property bool caretReplace() { return _caretReplace; }
|
@property bool caretReplace() { return _caretReplace; }
|
||||||
|
|
||||||
// window content resize mode
|
// window content resize mode
|
||||||
protected WindowOrContentResizeMode _windowOrContentResizeMode = WindowOrContentResizeMode.resizeWindow;
|
//protected WindowOrContentResizeMode _windowOrContentResizeMode = WindowOrContentResizeMode.resizeWindow;
|
||||||
//protected WindowOrContentResizeMode _windowOrContentResizeMode = WindowOrContentResizeMode.shrinkWidgets;
|
//protected WindowOrContentResizeMode _windowOrContentResizeMode = WindowOrContentResizeMode.shrinkWidgets;
|
||||||
//protected WindowOrContentResizeMode _windowOrContentResizeMode = WindowOrContentResizeMode.scrollWindow;
|
protected WindowOrContentResizeMode _windowOrContentResizeMode = WindowOrContentResizeMode.scrollWindow;
|
||||||
|
|
||||||
@property WindowOrContentResizeMode windowOrContentResizeMode() {return _windowOrContentResizeMode; }
|
@property WindowOrContentResizeMode windowOrContentResizeMode() {return _windowOrContentResizeMode; }
|
||||||
@property void windowOrContentResizeMode(WindowOrContentResizeMode newMode) {
|
@property void windowOrContentResizeMode(WindowOrContentResizeMode newMode) {
|
||||||
|
@ -466,7 +468,7 @@ class Window : CustomEventTarget {
|
||||||
void adjustWindowOrContentSize(int minContentWidth, int minContentHeight) {
|
void adjustWindowOrContentSize(int minContentWidth, int minContentHeight) {
|
||||||
_minContentWidth = minContentWidth;
|
_minContentWidth = minContentWidth;
|
||||||
_minContentHeight = minContentHeight;
|
_minContentHeight = minContentHeight;
|
||||||
if (_windowOrContentResizeMode == WindowOrContentResizeMode.resizeWindow)
|
if (_windowOrContentResizeMode == WindowOrContentResizeMode.resizeWindow || flags & WindowFlag.ExpandSize)
|
||||||
resizeWindow(Point(max(_windowRect.right, minContentWidth), max(_windowRect.bottom, minContentHeight)));
|
resizeWindow(Point(max(_windowRect.right, minContentWidth), max(_windowRect.bottom, minContentHeight)));
|
||||||
updateWindowOrContentSize();
|
updateWindowOrContentSize();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue