fix tree view and scroll widget

This commit is contained in:
Vadim Lopatin 2015-01-13 15:19:26 +03:00
parent cc838718ef
commit 55f9a43a2f
2 changed files with 38 additions and 3 deletions

View File

@ -217,11 +217,19 @@ class ScrollWidgetBase : WidgetGroup, OnScrollHandler {
pwidth -= m.left + m.right + p.left + p.right;
if (parentHeight != SIZE_UNSPECIFIED)
pheight -= m.top + m.bottom + p.top + p.bottom;
if (_hscrollbar)
if (_hscrollbar) {
_hscrollbar.measure(pwidth, pheight);
if (_vscrollbar)
}
if (_vscrollbar) {
_vscrollbar.measure(pwidth, pheight);
}
Point sz = fullContentSize();
if (_hscrollbar) {
sz.y += _hscrollbar.measuredHeight;
}
if (_vscrollbar) {
sz.x += _vscrollbar.measuredWidth;
}
measuredContent(parentWidth, parentHeight, sz.x, sz.y);
}

View File

@ -122,6 +122,10 @@ class TreeItem {
p = p._parent;
return cast(TreeItems)p;
}
void clear() {
_children.clear();
}
@property TreeItem parent() { return _parent; }
@property protected TreeItem parent(TreeItem p) { _parent = p; return this; }
@ -197,6 +201,29 @@ class TreeItem {
return _parent.topParent;
}
protected int _intParam;
protected Object _objectParam;
@property int intParam() {
return _intParam;
}
@property TreeItem intParam(int value) {
_intParam = value;
return this;
}
@property Object objectParam() {
return _objectParam;
}
@property TreeItem objectParam(Object value) {
_objectParam = value;
return this;
}
/// returns true if item has at least one child
@property bool hasChildren() { return childCount > 0; }
@ -643,7 +670,7 @@ class TreeWidgetBase : ScrollWidget, OnTreeContentChangeListener, OnTreeStateCh
super.layout(rc);
}
/// Measure widget according to desired width and height constraints. (Step 1 of two phase layout).
/// Measure widget according to desired width and height constraints. (Step 1 of two phase layout).
override void measure(int parentWidth, int parentHeight) {
if (visibility == Visibility.Gone) {
return;