Add onWindowCreate, rename onWindowCreate to onCreateWindow

This commit is contained in:
Joshua Granick
2018-07-05 12:04:44 -07:00
parent 80b3dabccb
commit 1a93d95638

View File

@@ -52,7 +52,7 @@ class Application extends Module {
*/ */
public var onUpdate = new Event<Int->Void> (); public var onUpdate = new Event<Int->Void> ();
public var onWindowCreate = new Event<Window->Void> (); public var onCreateWindow = new Event<Window->Void> ();
/** /**
* The Preloader for the current Application * The Preloader for the current Application
@@ -141,6 +141,9 @@ class Application extends Module {
var window = new Window (this, attributes); var window = new Window (this, attributes);
__windows.push (window);
__windowByID.set (window.id, window);
window.onClose.add (__onWindowClose.bind (window), false, -10000); window.onClose.add (__onWindowClose.bind (window), false, -10000);
if (__window == null) { if (__window == null) {
@@ -173,12 +176,11 @@ class Application extends Module {
window.onTextEdit.add (onTextEdit); window.onTextEdit.add (onTextEdit);
window.onTextInput.add (onTextInput); window.onTextInput.add (onTextInput);
onWindowCreate ();
} }
__windows.push (window); onCreateWindow.dispatch (window);
__windowByID.set (window.id, window);
onWindowCreate.dispatch (window);
return window; return window;
@@ -446,6 +448,12 @@ class Application extends Module {
public function onWindowClose ():Void { } public function onWindowClose ():Void { }
/**
* Called when the primary window is created
*/
public function onWindowCreate ():Void { }
/** /**
* Called when a window deactivate event is fired on the primary window * Called when a window deactivate event is fired on the primary window
*/ */
@@ -655,6 +663,7 @@ class Application extends Module {
@:noCompletion private override function __unregisterLimeModule (application:Application):Void { @:noCompletion private override function __unregisterLimeModule (application:Application):Void {
application.onUpdate.remove (update);
application.onExit.remove (__onModuleExit); application.onExit.remove (__onModuleExit);
application.onExit.remove (onModuleExit); application.onExit.remove (onModuleExit);