-
-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e4113b7
commit fb02576
Showing
5 changed files
with
143 additions
and
44 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package haxe.ui.animation; | ||
|
||
class AnimationSequence { | ||
public var onComplete:Void->Void = null; | ||
public var builders:Array<AnimationBuilder> = []; | ||
|
||
private var _activeBuilders:Array<AnimationBuilder>; | ||
|
||
public function new() { | ||
|
||
} | ||
|
||
public function add(builder:AnimationBuilder) { | ||
builders.push(builder); | ||
} | ||
|
||
private function onAnimationComplete() { | ||
_activeBuilders.pop(); | ||
if (_activeBuilders.length == 0) { | ||
if (onComplete != null) { | ||
onComplete(); | ||
} | ||
} | ||
} | ||
|
||
public function play() { | ||
if (builders.length == 0) { | ||
if (onComplete != null) { | ||
onComplete(); | ||
} | ||
return; | ||
} | ||
_activeBuilders = builders.copy(); | ||
for (builder in builders) { | ||
builder.onComplete = onAnimationComplete; | ||
} | ||
for (builder in builders) { | ||
builder.play(); | ||
} | ||
} | ||
} |
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,23 @@ | ||
package haxe.ui.events; | ||
|
||
import haxe.ui.notifications.Notification; | ||
|
||
class NotificationEvent extends UIEvent { | ||
public static final SHOWN:EventType<ScrollEvent> = EventType.name("notificationshown"); | ||
public static final HIDDEN:EventType<ScrollEvent> = EventType.name("notificationhidden"); | ||
public static final ACTION:EventType<ScrollEvent> = EventType.name("notificationaction"); | ||
|
||
public var notification:Notification = null; | ||
|
||
public override function clone():NotificationEvent { | ||
var c:NotificationEvent = new NotificationEvent(this.type); | ||
c.notification = this.notification; | ||
c.type = this.type; | ||
c.bubble = this.bubble; | ||
c.target = this.target; | ||
c.data = this.data; | ||
c.canceled = this.canceled; | ||
postClone(c); | ||
return c; | ||
} | ||
} |
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 |
---|---|---|
@@ -1,11 +1,19 @@ | ||
package haxe.ui.notifications; | ||
|
||
import haxe.ui.util.Variant; | ||
|
||
typedef NotificationData = { | ||
var body:String; | ||
@:optional var title:String; | ||
@:optional var icon:String; | ||
@:optional var actions:Array<String>; | ||
@:optional var actions:Array<NotificationActionData>; | ||
@:optional var expiryMs:Int; | ||
@:optional var type:NotificationType; | ||
@:optional var styleNames:String; | ||
} | ||
|
||
typedef NotificationActionData = { | ||
@:optional var text:String; | ||
@:optional var icon:Variant; | ||
@:optional var callback:NotificationActionData->Void; | ||
} |
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