# HG changeset patch # User Jacob Carlborg # Date 1244324137 -7200 # Node ID 05e03d23ca3a0cce35814ef78695adf3dd96394c # Parent 1324fd764db46e0ba0d95ba902031eade6e2d780 Fixes #27 diff -r 1324fd764db4 -r 05e03d23ca3a dwt/custom/ScrolledComposite.d --- 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); } }); }