mirror of https://github.com/buggins/dlangui.git
Full implemented scrollbars events.
This commit is contained in:
parent
e31bd2cc2f
commit
3dc4d6679a
|
@ -376,6 +376,19 @@ class Window : CustomEventTarget {
|
||||||
_hScrollBar.scrollEvent = delegate bool (AbstractSlider source, ScrollEvent event) {
|
_hScrollBar.scrollEvent = delegate bool (AbstractSlider source, ScrollEvent event) {
|
||||||
if (event.action == ScrollAction.SliderMoved || event.action == ScrollAction.SliderReleased)
|
if (event.action == ScrollAction.SliderMoved || event.action == ScrollAction.SliderReleased)
|
||||||
requestLayout();
|
requestLayout();
|
||||||
|
else if (event.action == ScrollAction.PageUp) {
|
||||||
|
source.position = max(0, source.position - _windowRect.right * 3 / 4);
|
||||||
|
requestLayout();
|
||||||
|
} else if (event.action == ScrollAction.PageDown) {
|
||||||
|
source.position = min(source.maxValue - _windowRect.right, source.position + _windowRect.right *3 / 4);
|
||||||
|
requestLayout();
|
||||||
|
} else if (event.action == ScrollAction.LineUp) {
|
||||||
|
source.position = max(0, source.position - _windowRect.right / 10);
|
||||||
|
requestLayout();
|
||||||
|
} else if (event.action == ScrollAction.LineDown) {
|
||||||
|
source.position = min(source.maxValue - _windowRect.right, source.position + _windowRect.right / 10);
|
||||||
|
requestLayout();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -403,6 +416,19 @@ class Window : CustomEventTarget {
|
||||||
_vScrollBar.scrollEvent = delegate bool (AbstractSlider source, ScrollEvent event) {
|
_vScrollBar.scrollEvent = delegate bool (AbstractSlider source, ScrollEvent event) {
|
||||||
if (event.action == ScrollAction.SliderMoved || event.action == ScrollAction.SliderReleased)
|
if (event.action == ScrollAction.SliderMoved || event.action == ScrollAction.SliderReleased)
|
||||||
requestLayout();
|
requestLayout();
|
||||||
|
else if (event.action == ScrollAction.PageUp) {
|
||||||
|
source.position = max(0, source.position - _windowRect.bottom * 3 / 4);
|
||||||
|
requestLayout();
|
||||||
|
} else if (event.action == ScrollAction.PageDown) {
|
||||||
|
source.position = min(source.maxValue - _windowRect.bottom, source.position + _windowRect.bottom *3 / 4);
|
||||||
|
requestLayout();
|
||||||
|
} else if (event.action == ScrollAction.LineUp) {
|
||||||
|
source.position = max(0, source.position - _windowRect.bottom / 10);
|
||||||
|
requestLayout();
|
||||||
|
} else if (event.action == ScrollAction.LineDown) {
|
||||||
|
source.position = min(source.maxValue - _windowRect.bottom, source.position + _windowRect.bottom / 10);
|
||||||
|
requestLayout();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue