diff --git a/dlanguilib.visualdproj b/dlanguilib.visualdproj
index a28e84c3..fbb01e43 100644
--- a/dlanguilib.visualdproj
+++ b/dlanguilib.visualdproj
@@ -66,7 +66,7 @@
0
DebugFocus
0
- USE_OPENGL USE_SDL Unicode
+ USE_OPENGL Unicode
0
0
1
diff --git a/examples/example1/example1.visualdproj b/examples/example1/example1.visualdproj
index c1aca680..8170912c 100644
--- a/examples/example1/example1.visualdproj
+++ b/examples/example1/example1.visualdproj
@@ -66,7 +66,7 @@
0
0
- USE_OPENGL USE_SDL Unicode
+ USE_OPENGL Unicode
0
3
0
diff --git a/src/dlangui/dialogs/dialog.d b/src/dlangui/dialogs/dialog.d
index 56b86d68..1955abf1 100644
--- a/src/dlangui/dialogs/dialog.d
+++ b/src/dlangui/dialogs/dialog.d
@@ -52,7 +52,7 @@ class Dialog : VerticalLayout {
Signal!DialogResultHandler onDialogResult;
this(UIString caption, Window parentWindow = null, uint flags = DialogFlag.Modal) {
- super("dlg");
+ super("dialog-main-widget");
_caption = caption;
_parentWindow = parentWindow;
_flags = flags;
@@ -155,8 +155,11 @@ class Dialog : VerticalLayout {
uint wflags = 0;
if (_flags & DialogFlag.Modal)
wflags |= WindowFlag.Modal;
- if (_flags & DialogFlag.Resizable)
+ if (_flags & DialogFlag.Resizable) {
wflags |= WindowFlag.Resizable;
+ layoutWidth = FILL_PARENT;
+ layoutHeight = FILL_PARENT;
+ }
_window = Platform.instance.createWindow(_caption, _parentWindow, wflags);
if (_window && _icon)
_window.windowIcon = drawableCache.getImage(_icon);
diff --git a/src/dlangui/dialogs/filedlg.d b/src/dlangui/dialogs/filedlg.d
index 67dde005..81e2f252 100644
--- a/src/dlangui/dialogs/filedlg.d
+++ b/src/dlangui/dialogs/filedlg.d
@@ -133,13 +133,6 @@ class FileDialog : Dialog, CustomGridCellAdapter {
return null;
}
- /// Set widget rectangle to specified value and layout widget contents. (Step 2 of two phase layout).
- override void layout(Rect rc) {
- super.layout(rc);
- _fileList.autoFitColumnWidths();
- _fileList.fillColumnWidth(1);
- }
-
protected bool upLevel() {
return openDirectory(parentDir(_path), _path);
}
@@ -310,11 +303,11 @@ class FileDialog : Dialog, CustomGridCellAdapter {
layoutWidth(FILL_PARENT);
layoutWidth(FILL_PARENT);
minWidth = 600;
- minHeight = 400;
+ //minHeight = 400;
LinearLayout content = new HorizontalLayout("dlgcontent");
- content.layoutWidth(FILL_PARENT).layoutHeight(FILL_PARENT).minWidth(400).minHeight(300);
+ content.layoutWidth(FILL_PARENT).layoutHeight(FILL_PARENT); //.minWidth(400).minHeight(300);
leftPanel = new VerticalLayout("places");
leftPanel.addChild(createRootsList());
@@ -387,6 +380,28 @@ class FileDialog : Dialog, CustomGridCellAdapter {
}
+ /// Set widget rectangle to specified value and layout widget contents. (Step 2 of two phase layout).
+ override void layout(Rect rc) {
+ super.layout(rc);
+ _fileList.autoFitColumnWidths();
+ _fileList.fillColumnWidth(1);
+ }
+
+
+ ///// Measure widget according to desired width and height constraints. (Step 1 of two phase layout).
+ //override void measure(int parentWidth, int parentHeight) {
+ // super.measure(parentWidth, parentHeight);
+ // for(int i = 0; i < childCount; i++) {
+ // Widget w = child(i);
+ // Log.d("id=", w.id, " measuredHeight=", w.measuredHeight );
+ // for (int j = 0; j < w.childCount; j++) {
+ // Widget w2 = w.child(j);
+ // Log.d(" id=", w2.id, " measuredHeight=", w.measuredHeight );
+ // }
+ // }
+ // Log.d("this id=", id, " measuredHeight=", measuredHeight);
+ //}
+
override void onShow() {
_fileList.setFocus();
}
diff --git a/src/dlangui/platforms/common/platform.d b/src/dlangui/platforms/common/platform.d
index 303e1486..6de8ec04 100644
--- a/src/dlangui/platforms/common/platform.d
+++ b/src/dlangui/platforms/common/platform.d
@@ -107,11 +107,13 @@ class Window {
Log.d("onResize ", _dx, "x", _dy);
long measureStart = currentTimeMillis;
measure();
+ //Log.d("measured size: ", _mainWidget.measuredWidth, "x", _mainWidget.measuredHeight);
long measureEnd = currentTimeMillis;
Log.d("measure took ", measureEnd - measureStart, " ms");
layout();
long layoutEnd = currentTimeMillis;
Log.d("layout took ", layoutEnd - measureEnd, " ms");
+ //Log.d("layout position: ", _mainWidget.pos);
}
}
diff --git a/src/dlangui/widgets/layouts.d b/src/dlangui/widgets/layouts.d
index 2546b518..54a3fec3 100644
--- a/src/dlangui/widgets/layouts.d
+++ b/src/dlangui/widgets/layouts.d
@@ -174,15 +174,20 @@ class LayoutItems {
contentSecondarySize = maxItem;
else
contentSecondarySize = rc.width;
- if (_layoutHeight == FILL_PARENT || totalSize > rc.height)
+ if (_layoutHeight == FILL_PARENT && totalSize < rc.height && resizableSize > 0) {
delta = rc.height - totalSize; // total space to add to fit
+ } else if (totalSize > rc.height) {
+ delta = rc.height - totalSize; // total space to reduce to fit
+ }
} else {
if (_layoutHeight == WRAP_CONTENT && maxItem < rc.height)
contentSecondarySize = maxItem;
else
contentSecondarySize = rc.height;
- if (_layoutWidth == FILL_PARENT || totalSize > rc.width)
+ if (_layoutWidth == FILL_PARENT && totalSize < rc.width && resizableSize > 0)
delta = rc.width - totalSize; // total space to add to fit
+ else if (totalSize > rc.width)
+ delta = rc.width - totalSize; // total space to reduce to fit
}
// calculate resize options and scale
bool needForceResize = false;
diff --git a/src/dlangui/widgets/widget.d b/src/dlangui/widgets/widget.d
index 3ecd6571..bed6141a 100644
--- a/src/dlangui/widgets/widget.d
+++ b/src/dlangui/widgets/widget.d
@@ -1061,14 +1061,19 @@ class Widget {
int maxw = maxWidth;
int minh = minHeight;
int maxh = maxHeight;
- if (dx < minw)
+ if (minw != SIZE_UNSPECIFIED && dx < minw)
dx = minw;
- if (dy < minh)
+ if (minh != SIZE_UNSPECIFIED && dy < minh)
dy = minh;
if (maxw != SIZE_UNSPECIFIED && dx > maxw)
dx = maxw;
if (maxh != SIZE_UNSPECIFIED && dy > maxh)
dy = maxh;
+ // apply FILL_PARENT
+ //if (parentWidth != SIZE_UNSPECIFIED && layoutWidth == FILL_PARENT)
+ // dx = parentWidth;
+ //if (parentHeight != SIZE_UNSPECIFIED && layoutHeight == FILL_PARENT)
+ // dy = parentHeight;
// apply max parent size constraint
if (parentWidth != SIZE_UNSPECIFIED && dx > parentWidth)
dx = parentWidth;