mirror of https://github.com/buggins/dlangui.git
fix LinearLayout
This commit is contained in:
parent
bdba7bd15b
commit
cc838718ef
|
@ -66,7 +66,7 @@
|
||||||
<debuglevel>0</debuglevel>
|
<debuglevel>0</debuglevel>
|
||||||
<debugids>DebugFocus</debugids>
|
<debugids>DebugFocus</debugids>
|
||||||
<versionlevel>0</versionlevel>
|
<versionlevel>0</versionlevel>
|
||||||
<versionids>USE_OPENGL USE_SDL Unicode</versionids>
|
<versionids>USE_OPENGL Unicode</versionids>
|
||||||
<dump_source>0</dump_source>
|
<dump_source>0</dump_source>
|
||||||
<mapverbosity>0</mapverbosity>
|
<mapverbosity>0</mapverbosity>
|
||||||
<createImplib>1</createImplib>
|
<createImplib>1</createImplib>
|
||||||
|
|
|
@ -66,7 +66,7 @@
|
||||||
<debuglevel>0</debuglevel>
|
<debuglevel>0</debuglevel>
|
||||||
<debugids />
|
<debugids />
|
||||||
<versionlevel>0</versionlevel>
|
<versionlevel>0</versionlevel>
|
||||||
<versionids>USE_OPENGL USE_SDL Unicode</versionids>
|
<versionids>USE_OPENGL Unicode</versionids>
|
||||||
<dump_source>0</dump_source>
|
<dump_source>0</dump_source>
|
||||||
<mapverbosity>3</mapverbosity>
|
<mapverbosity>3</mapverbosity>
|
||||||
<createImplib>0</createImplib>
|
<createImplib>0</createImplib>
|
||||||
|
|
|
@ -52,7 +52,7 @@ class Dialog : VerticalLayout {
|
||||||
Signal!DialogResultHandler onDialogResult;
|
Signal!DialogResultHandler onDialogResult;
|
||||||
|
|
||||||
this(UIString caption, Window parentWindow = null, uint flags = DialogFlag.Modal) {
|
this(UIString caption, Window parentWindow = null, uint flags = DialogFlag.Modal) {
|
||||||
super("dlg");
|
super("dialog-main-widget");
|
||||||
_caption = caption;
|
_caption = caption;
|
||||||
_parentWindow = parentWindow;
|
_parentWindow = parentWindow;
|
||||||
_flags = flags;
|
_flags = flags;
|
||||||
|
@ -155,8 +155,11 @@ class Dialog : VerticalLayout {
|
||||||
uint wflags = 0;
|
uint wflags = 0;
|
||||||
if (_flags & DialogFlag.Modal)
|
if (_flags & DialogFlag.Modal)
|
||||||
wflags |= WindowFlag.Modal;
|
wflags |= WindowFlag.Modal;
|
||||||
if (_flags & DialogFlag.Resizable)
|
if (_flags & DialogFlag.Resizable) {
|
||||||
wflags |= WindowFlag.Resizable;
|
wflags |= WindowFlag.Resizable;
|
||||||
|
layoutWidth = FILL_PARENT;
|
||||||
|
layoutHeight = FILL_PARENT;
|
||||||
|
}
|
||||||
_window = Platform.instance.createWindow(_caption, _parentWindow, wflags);
|
_window = Platform.instance.createWindow(_caption, _parentWindow, wflags);
|
||||||
if (_window && _icon)
|
if (_window && _icon)
|
||||||
_window.windowIcon = drawableCache.getImage(_icon);
|
_window.windowIcon = drawableCache.getImage(_icon);
|
||||||
|
|
|
@ -133,13 +133,6 @@ class FileDialog : Dialog, CustomGridCellAdapter {
|
||||||
return null;
|
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() {
|
protected bool upLevel() {
|
||||||
return openDirectory(parentDir(_path), _path);
|
return openDirectory(parentDir(_path), _path);
|
||||||
}
|
}
|
||||||
|
@ -310,11 +303,11 @@ class FileDialog : Dialog, CustomGridCellAdapter {
|
||||||
layoutWidth(FILL_PARENT);
|
layoutWidth(FILL_PARENT);
|
||||||
layoutWidth(FILL_PARENT);
|
layoutWidth(FILL_PARENT);
|
||||||
minWidth = 600;
|
minWidth = 600;
|
||||||
minHeight = 400;
|
//minHeight = 400;
|
||||||
|
|
||||||
LinearLayout content = new HorizontalLayout("dlgcontent");
|
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 = new VerticalLayout("places");
|
||||||
leftPanel.addChild(createRootsList());
|
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() {
|
override void onShow() {
|
||||||
_fileList.setFocus();
|
_fileList.setFocus();
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,11 +107,13 @@ class Window {
|
||||||
Log.d("onResize ", _dx, "x", _dy);
|
Log.d("onResize ", _dx, "x", _dy);
|
||||||
long measureStart = currentTimeMillis;
|
long measureStart = currentTimeMillis;
|
||||||
measure();
|
measure();
|
||||||
|
//Log.d("measured size: ", _mainWidget.measuredWidth, "x", _mainWidget.measuredHeight);
|
||||||
long measureEnd = currentTimeMillis;
|
long measureEnd = currentTimeMillis;
|
||||||
Log.d("measure took ", measureEnd - measureStart, " ms");
|
Log.d("measure took ", measureEnd - measureStart, " ms");
|
||||||
layout();
|
layout();
|
||||||
long layoutEnd = currentTimeMillis;
|
long layoutEnd = currentTimeMillis;
|
||||||
Log.d("layout took ", layoutEnd - measureEnd, " ms");
|
Log.d("layout took ", layoutEnd - measureEnd, " ms");
|
||||||
|
//Log.d("layout position: ", _mainWidget.pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -174,15 +174,20 @@ class LayoutItems {
|
||||||
contentSecondarySize = maxItem;
|
contentSecondarySize = maxItem;
|
||||||
else
|
else
|
||||||
contentSecondarySize = rc.width;
|
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
|
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 {
|
} else {
|
||||||
if (_layoutHeight == WRAP_CONTENT && maxItem < rc.height)
|
if (_layoutHeight == WRAP_CONTENT && maxItem < rc.height)
|
||||||
contentSecondarySize = maxItem;
|
contentSecondarySize = maxItem;
|
||||||
else
|
else
|
||||||
contentSecondarySize = rc.height;
|
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
|
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
|
// calculate resize options and scale
|
||||||
bool needForceResize = false;
|
bool needForceResize = false;
|
||||||
|
|
|
@ -1061,14 +1061,19 @@ class Widget {
|
||||||
int maxw = maxWidth;
|
int maxw = maxWidth;
|
||||||
int minh = minHeight;
|
int minh = minHeight;
|
||||||
int maxh = maxHeight;
|
int maxh = maxHeight;
|
||||||
if (dx < minw)
|
if (minw != SIZE_UNSPECIFIED && dx < minw)
|
||||||
dx = minw;
|
dx = minw;
|
||||||
if (dy < minh)
|
if (minh != SIZE_UNSPECIFIED && dy < minh)
|
||||||
dy = minh;
|
dy = minh;
|
||||||
if (maxw != SIZE_UNSPECIFIED && dx > maxw)
|
if (maxw != SIZE_UNSPECIFIED && dx > maxw)
|
||||||
dx = maxw;
|
dx = maxw;
|
||||||
if (maxh != SIZE_UNSPECIFIED && dy > maxh)
|
if (maxh != SIZE_UNSPECIFIED && dy > maxh)
|
||||||
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
|
// apply max parent size constraint
|
||||||
if (parentWidth != SIZE_UNSPECIFIED && dx > parentWidth)
|
if (parentWidth != SIZE_UNSPECIFIED && dx > parentWidth)
|
||||||
dx = parentWidth;
|
dx = parentWidth;
|
||||||
|
|
Loading…
Reference in New Issue