This repository has been archived by the owner on Nov 12, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement scrollbar dragging and postion property. Extra check when emitting changed signal for property. Fix mixin for opOpAssing in flexibleobject.d. Implement vertical and horizontal scrollbars. Add scrollbars to testapplication.d.
- Loading branch information
Showing
6 changed files
with
147 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/** | ||
Copyright: Copyright (c) 2014 Andrey Penechko. | ||
License: a$(WEB boost.org/LICENSE_1_0.txt, Boost License 1.0). | ||
Authors: Andrey Penechko. | ||
*/ | ||
|
||
|
||
module anchovy.gui.behaviors.sliderbehavior; | ||
|
||
import std.algorithm; | ||
import std.stdio; | ||
|
||
import anchovy.gui; | ||
import anchovy.gui.interfaces.iwidgetbehavior; | ||
|
||
class SliderBehavior : IWidgetBehavior | ||
{ | ||
override void attachTo(Widget widget) | ||
{ | ||
widget.addEventHandler(&pointerMoved); | ||
widget.addEventHandler(&pointerPressed); | ||
widget.addEventHandler(&pointerReleased); | ||
|
||
widget.setProperty!"isFocusable"(true); | ||
} | ||
|
||
bool pointerMoved(Widget widget, PointerMoveEvent event) | ||
{ | ||
if (event.context.pressedWidget is widget ) | ||
{ | ||
widget["position"] = event.delta + widget["position"].get!ivec2; | ||
} | ||
|
||
|
||
return true; | ||
} | ||
|
||
bool pointerPressed(Widget widget, PointerPressEvent event) | ||
{ | ||
if (event.button == PointerButton.PB_LEFT) | ||
{ | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
bool pointerReleased(Widget widget, PointerReleaseEvent event) | ||
{ | ||
return true; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters