changeset 121:c8f6e8dc0fcf

Possibly way for delegate integration
author Frank Benoit <benoit@tionex.de>
date Sun, 20 Jan 2008 22:07:01 +0100
parents d716ed170ef6
children 45921f44a4b2
files dwt/events/ShellAdapter.d
diffstat 1 files changed, 48 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/dwt/events/ShellAdapter.d	Sun Jan 20 16:40:10 2008 +0100
+++ b/dwt/events/ShellAdapter.d	Sun Jan 20 22:07:01 2008 +0100
@@ -73,3 +73,51 @@
 public void shellIconified(ShellEvent e) {
 }
 }
+
+class ShellDelegator : ShellAdapter {
+    alias void delegate(ShellEvent) DFunc;
+    DFunc delShellActivated;
+    DFunc delShellClosed;
+    DFunc delShellDeactivated;
+    DFunc delShellDeiconified;
+    DFunc delShellIconified;
+
+private this(
+    DFunc delShellActivated,
+    DFunc delShellClosed,
+    DFunc delShellDeactivated,
+    DFunc delShellDeiconified,
+    DFunc delShellIconified )
+{
+    this.delShellActivated = delShellActivated;
+    this.delShellClosed = delShellClosed;
+    this.delShellDeactivated = delShellDeactivated;
+    this.delShellDeiconified = delShellDeiconified;
+    this.delShellIconified = delShellIconified;
+}
+
+static ShellDelegator createShellActivated( DFunc del ){
+    return new ShellDelegator( del, null, null, null, null );
+}
+static ShellDelegator createShellClosed( DFunc del ){
+    return new ShellDelegator( null, del, null, null, null );
+}
+
+public void shellActivated(ShellEvent e) {
+    if( delShellActivated !is null ) delShellActivated(e);
+}
+public void shellClosed(ShellEvent e) {
+    if( delShellClosed !is null ) delShellClosed(e);
+}
+public void shellDeactivated(ShellEvent e) {
+    if( delShellDeactivated !is null ) delShellDeactivated(e);
+}
+public void shellDeiconified(ShellEvent e) {
+    if( delShellDeiconified !is null ) delShellDeiconified(e);
+}
+public void shellIconified(ShellEvent e) {
+    if( delShellIconified !is null ) delShellIconified(e);
+}
+}
+
+