Mercurial > projects > dwt-addons
changeset 120:3b2353d77f37
Fix: DMD anon class problems
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Mon, 11 Aug 2008 11:14:42 +0200 |
parents | 35f1d208f3c3 |
children | c0304616ea23 |
files | dwtx/jface/window/ToolTip.d |
diffstat | 1 files changed, 26 insertions(+), 33 deletions(-) [+] |
line wrap: on
line diff
--- a/dwtx/jface/window/ToolTip.d Fri Aug 08 19:28:39 2008 +0200 +++ b/dwtx/jface/window/ToolTip.d Mon Aug 11 11:14:42 2008 +0200 @@ -14,6 +14,7 @@ module dwtx.jface.window.ToolTip; +import tango.util.log.Trace; import dwt.DWT; import dwt.events.DisposeEvent; @@ -107,35 +108,33 @@ * @see #RECREATE * @see #NO_RECREATE */ - public this(Control control_, int style, bool manualActivation) { - this.control = control_; + public this(Control control, int style, bool manualActivation) { + this.control = control; this.style = style; this.hideListener = new TooltipHideListener(); this.control.addDisposeListener(new class DisposeListener { public void widgetDisposed(DisposeEvent e) { - data = null; - deactivate(); + this.outer.data = null; + this.outer.deactivate(); } }); this.listener = new ToolTipOwnerControlListener(); - this.shellListener = new class Listener { - public void handleEvent(Event event) { - if( control_ !is null - && ! control_.isDisposed() ) { - control_.getDisplay().asyncExec( dgRunnable( (Event event_){ - // Check if the new active shell is the tooltip - // itself - if( control_.getDisplay().getActiveShell() !is CURRENT_TOOLTIP) { - toolTipHide(CURRENT_TOOLTIP, event_); + this.shellListener = dgListener( (Event event_, Control control_, ToolTip tooltip_) { + if( control_ !is null + && ! control_.isDisposed() ) { + control_.getDisplay().asyncExec( dgRunnable( (Event event__, Control control__, ToolTip tooltip__){ + // Check if the new active shell is the tooltip + // itself + if( control__.getDisplay().getActiveShell() !is CURRENT_TOOLTIP) { + tooltip__.toolTipHide(CURRENT_TOOLTIP, event__); - } - }, event)); - } + } + }, event_, control_, tooltip_)); } - }; + }, control, this); if (!manualActivation) { activate(); @@ -450,7 +449,9 @@ } private void toolTipHide(Shell tip, Event event) { + assert(this); if (tip !is null && !tip.isDisposed() && shouldHideToolTip(event)) { + assert(this); control.getShell().removeListener(DWT.Deactivate, shellListener); currentArea = null; passOnEvent(tip, event); @@ -520,27 +521,19 @@ control.getShell().addListener(DWT.Deactivate, shellListener); if (popupDelay > 0) { - control.getDisplay().timerExec(popupDelay, new class(shell,event) Runnable { - Shell shell_; - Event event_; - this(Shell a,Event b){ shell_=a; event_=b; } - public void run() { - toolTipShow(shell_, event_); - } - }); + control.getDisplay().timerExec(popupDelay, dgRunnable( (Shell shell_,Event event_, ToolTip tooltip_){ + assert(tooltip_); + tooltip_.toolTipShow(shell_, event_); + },shell,event, this)); } else { toolTipShow(CURRENT_TOOLTIP, event); } if (hideDelay > 0) { - control.getDisplay().timerExec(popupDelay + hideDelay, - new class(shell) Runnable { - Shell shell_; - this(Shell a){ shell_=a; } - public void run() { - toolTipHide(shell, null); - } - }); + control.getDisplay().timerExec(popupDelay + hideDelay, dgRunnable( (Shell shell_, ToolTip tooltip_){ + assert(tooltip_); + tooltip_.toolTipHide(shell_, null); + }, shell, this )); } }