changeset 146:05e03d23ca3a

Fixes #27
author Jacob Carlborg <doob@me.com>
date Sat, 06 Jun 2009 23:35:37 +0200
parents 1324fd764db4
children 64712e72cb16
files dwt/custom/ScrolledComposite.d
diffstat 1 files changed, 39 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/dwt/custom/ScrolledComposite.d	Sat Jun 06 23:02:40 2009 +0200
+++ b/dwt/custom/ScrolledComposite.d	Sat Jun 06 23:35:37 2009 +0200
@@ -163,7 +163,13 @@
     ScrollBar hBar = getHorizontalBar ();
     if (hBar !is null) {
         hBar.setVisible(false);
-        hBar.addListener (DWT.Selection, new class() Listener  {
+        hBar.addListener (DWT.Selection, new class(this) Listener  {
+            ScrolledComposite sc;
+            
+            this (ScrolledComposite sc) {
+                this.sc = sc;
+            }
+
             public void handleEvent (Event e) {
                 hScroll();
             }
@@ -173,31 +179,55 @@
     ScrollBar vBar = getVerticalBar ();
     if (vBar !is null) {
         vBar.setVisible(false);
-        vBar.addListener (DWT.Selection, new class() Listener {
+        vBar.addListener (DWT.Selection, new class(this) Listener {
+            ScrolledComposite sc;
+            
+            this (ScrolledComposite sc) {
+                this.sc = sc;
+            }
+
             public void handleEvent (Event e) {
-                vScroll();
+                sc.vScroll();
             }
         });
     }
 
-    contentListener = new class() Listener {
+    contentListener = new class(this) Listener {
+        ScrolledComposite sc;
+        
+        this (ScrolledComposite sc) {
+            this.sc = sc;
+        }
+        
         public void handleEvent(Event e) {
             if (e.type !is DWT.Resize) return;
-            layout(false);
+            sc.layout(false);
         }
     };
 
-    filter = new class() Listener {
+    filter = new class(this) Listener {
+            ScrolledComposite sc;
+            
+            this (ScrolledComposite sc) {
+                this.sc = sc;
+            }
+
         public void handleEvent(Event event) {
             if (auto control = cast(Control)event.widget ) {
-                if (contains(control)) showControl(control);
+                if (contains(control)) sc.showControl(control);
             }
         }
     };
 
-    addDisposeListener(new class() DisposeListener {
+    addDisposeListener(new class(this) DisposeListener {
+        ScrolledComposite sc;
+        
+        this (ScrolledComposite sc) {
+            this.sc = sc;
+        }
+        
         public void widgetDisposed(DisposeEvent e) {
-            getDisplay().removeFilter(DWT.FocusIn, filter);
+            sc.getDisplay().removeFilter(DWT.FocusIn, filter);
         }
     });
 }