mirror of https://github.com/buggins/dlangui.git
move Mouse Wheel handler from tree to base class -- scroll widget
This commit is contained in:
parent
040b9233d7
commit
e9e99d6bf5
|
@ -134,6 +134,24 @@ class ScrollWidgetBase : WidgetGroup, OnScrollHandler {
|
|||
return true;
|
||||
}
|
||||
|
||||
/// process mouse event; return true if event is processed by widget.
|
||||
override bool onMouseEvent(MouseEvent event) {
|
||||
if (event.action == MouseAction.Wheel) {
|
||||
if (event.flags == MouseFlag.Shift) {
|
||||
if (_hscrollbar) {
|
||||
_hscrollbar.sendScrollEvent(event.wheelDelta > 0 ? ScrollAction.LineUp : ScrollAction.LineDown);
|
||||
return true;
|
||||
}
|
||||
} else if (event.flags == 0) {
|
||||
if (_vscrollbar) {
|
||||
_vscrollbar.sendScrollEvent(event.wheelDelta > 0 ? ScrollAction.LineUp : ScrollAction.LineDown);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.onMouseEvent(event);
|
||||
}
|
||||
|
||||
/// handle scroll event
|
||||
override bool onScrollEvent(AbstractSlider source, ScrollEvent event) {
|
||||
if (source.orientation == Orientation.Horizontal) {
|
||||
|
|
|
@ -667,8 +667,8 @@ class TreeWidgetBase : ScrollWidget, OnTreeContentChangeListener, OnTreeStateCh
|
|||
protected bool _needUpdateWidgetStates;
|
||||
|
||||
protected bool _noCollapseForSingleTopLevelItem;
|
||||
@property bool noCollapseForSingleTopLevelItem() {
|
||||
return _noCollapseForSingleTopLevelItem;
|
||||
@property bool noCollapseForSingleTopLevelItem() {
|
||||
return _noCollapseForSingleTopLevelItem;
|
||||
}
|
||||
@property TreeWidgetBase noCollapseForSingleTopLevelItem(bool flg) {
|
||||
_noCollapseForSingleTopLevelItem = flg;
|
||||
|
@ -857,22 +857,6 @@ class TreeWidgetBase : ScrollWidget, OnTreeContentChangeListener, OnTreeStateCh
|
|||
selectItem(item, makeVisible);
|
||||
}
|
||||
|
||||
/// process mouse event; return true if event is processed by widget.
|
||||
override bool onMouseEvent(MouseEvent event) {
|
||||
if (event.action == MouseAction.Wheel) {
|
||||
if (event.flags == MouseFlag.Control) {
|
||||
if (_hscrollbar)
|
||||
_hscrollbar.sendScrollEvent(event.wheelDelta > 0 ? ScrollAction.LineUp : ScrollAction.LineDown);
|
||||
return true;
|
||||
} else if (event.flags == 0) {
|
||||
if (_vscrollbar)
|
||||
_vscrollbar.sendScrollEvent(event.wheelDelta > 0 ? ScrollAction.LineUp : ScrollAction.LineDown);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return super.onMouseEvent(event);
|
||||
}
|
||||
|
||||
override protected bool handleAction(const Action a) {
|
||||
Log.d("tree.handleAction ", a.id);
|
||||
switch (a.id) with(TreeActions)
|
||||
|
|
Loading…
Reference in New Issue