mirror of https://github.com/buggins/dlangui.git
fix tree view and scroll widget
This commit is contained in:
parent
cc838718ef
commit
55f9a43a2f
|
@ -217,11 +217,19 @@ class ScrollWidgetBase : WidgetGroup, OnScrollHandler {
|
||||||
pwidth -= m.left + m.right + p.left + p.right;
|
pwidth -= m.left + m.right + p.left + p.right;
|
||||||
if (parentHeight != SIZE_UNSPECIFIED)
|
if (parentHeight != SIZE_UNSPECIFIED)
|
||||||
pheight -= m.top + m.bottom + p.top + p.bottom;
|
pheight -= m.top + m.bottom + p.top + p.bottom;
|
||||||
if (_hscrollbar)
|
if (_hscrollbar) {
|
||||||
_hscrollbar.measure(pwidth, pheight);
|
_hscrollbar.measure(pwidth, pheight);
|
||||||
if (_vscrollbar)
|
}
|
||||||
|
if (_vscrollbar) {
|
||||||
_vscrollbar.measure(pwidth, pheight);
|
_vscrollbar.measure(pwidth, pheight);
|
||||||
|
}
|
||||||
Point sz = fullContentSize();
|
Point sz = fullContentSize();
|
||||||
|
if (_hscrollbar) {
|
||||||
|
sz.y += _hscrollbar.measuredHeight;
|
||||||
|
}
|
||||||
|
if (_vscrollbar) {
|
||||||
|
sz.x += _vscrollbar.measuredWidth;
|
||||||
|
}
|
||||||
measuredContent(parentWidth, parentHeight, sz.x, sz.y);
|
measuredContent(parentWidth, parentHeight, sz.x, sz.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -122,6 +122,10 @@ class TreeItem {
|
||||||
p = p._parent;
|
p = p._parent;
|
||||||
return cast(TreeItems)p;
|
return cast(TreeItems)p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void clear() {
|
||||||
|
_children.clear();
|
||||||
|
}
|
||||||
|
|
||||||
@property TreeItem parent() { return _parent; }
|
@property TreeItem parent() { return _parent; }
|
||||||
@property protected TreeItem parent(TreeItem p) { _parent = p; return this; }
|
@property protected TreeItem parent(TreeItem p) { _parent = p; return this; }
|
||||||
|
@ -197,6 +201,29 @@ class TreeItem {
|
||||||
return _parent.topParent;
|
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
|
/// returns true if item has at least one child
|
||||||
@property bool hasChildren() { return childCount > 0; }
|
@property bool hasChildren() { return childCount > 0; }
|
||||||
|
|
||||||
|
@ -643,7 +670,7 @@ class TreeWidgetBase : ScrollWidget, OnTreeContentChangeListener, OnTreeStateCh
|
||||||
super.layout(rc);
|
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) {
|
override void measure(int parentWidth, int parentHeight) {
|
||||||
if (visibility == Visibility.Gone) {
|
if (visibility == Visibility.Gone) {
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue