# HG changeset patch # User John Reimer # Date 1223788614 25200 # Node ID f979673f7d4720a6fd697f784dabd949f2280dda # Parent 5073c0da393a7b91dc11b091eaeb180679f730c7# Parent 68adc3a367d9dbaac4429e2f268c470b62b7fc25 merge branches diff -r 5073c0da393a -r f979673f7d47 dwt/accessibility/Accessible.d --- a/dwt/accessibility/Accessible.d Sun Aug 17 09:04:23 2008 -0700 +++ b/dwt/accessibility/Accessible.d Sat Oct 11 22:16:54 2008 -0700 @@ -239,7 +239,7 @@ public void removeAccessibleControlListener (AccessibleControlListener listener) { checkWidget (); if (listener is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); - remove( controlListeners, listener, delegate bool(AccessibleControlListener a1, AccessibleControlListener a2 ){ return a1 is a2; }); + controlListeners.length = remove( controlListeners, listener, delegate bool(AccessibleControlListener a1, AccessibleControlListener a2 ){ return a1 is a2; }); } /** @@ -264,7 +264,7 @@ public void removeAccessibleListener (AccessibleListener listener) { checkWidget (); if (listener is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); - remove( accessibleListeners, listener, delegate bool( AccessibleListener a1, AccessibleListener a2 ){ return a1 is a2; }); + accessibleListeners.length = remove( accessibleListeners, listener, delegate bool( AccessibleListener a1, AccessibleListener a2 ){ return a1 is a2; }); } /** @@ -291,7 +291,7 @@ public void removeAccessibleTextListener (AccessibleTextListener listener) { checkWidget (); if (listener is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); - remove( textListeners, listener, delegate bool(AccessibleTextListener a1, AccessibleTextListener a2 ){ return a1 is a2; }); + textListeners.length = remove( textListeners, listener, delegate bool(AccessibleTextListener a1, AccessibleTextListener a2 ){ return a1 is a2; }); } /** diff -r 5073c0da393a -r f979673f7d47 dwt/accessibility/AccessibleObject.d --- a/dwt/accessibility/AccessibleObject.d Sun Aug 17 09:04:23 2008 -0700 +++ b/dwt/accessibility/AccessibleObject.d Sat Oct 11 22:16:54 2008 -0700 @@ -1224,7 +1224,7 @@ return result !is null ? result : new AccessibleTextListener [0]; } - private static extern(C) void gObjectClass_finalize (GObject* atkObject) { + package static extern(C) void gObjectClass_finalize (GObject* atkObject) { auto superType = ATK.g_type_class_peek_parent (ATK.G_OBJECT_GET_CLASS (cast(GTypeInstance*)atkObject)); auto objectClassStruct = cast(GObjectClass*)ATK.G_OBJECT_CLASS (cast(GTypeClass*)superType); objectClassStruct.finalize(atkObject); diff -r 5073c0da393a -r f979673f7d47 dwt/custom/CTabFolder2Listener.d --- a/dwt/custom/CTabFolder2Listener.d Sun Aug 17 09:04:23 2008 -0700 +++ b/dwt/custom/CTabFolder2Listener.d Sat Oct 11 22:16:54 2008 -0700 @@ -15,6 +15,9 @@ import dwt.internal.DWTEventListener; import dwt.custom.CTabFolderEvent; +import tango.core.Traits; +import tango.core.Tuple; + /** * Classes which implement this interface provide methods * that deal with the events that are generated by the CTabFolder @@ -34,6 +37,13 @@ * @since 3.0 */ public interface CTabFolder2Listener : DWTEventListener { + public enum { + MINIMIZE, + MAXIMIZE, + SHOWLIST, + RESTORE, + CLOSE + } /** * Sent when the user clicks on the close button of an item in the CTabFolder. @@ -113,3 +123,73 @@ */ public void showList(CTabFolderEvent event); } + + + +/// Helper class for the dgListener template function +private class _DgCTabFolder2ListenerT(Dg,T...) : CTabFolder2Listener { + + alias ParameterTupleOf!(Dg) DgArgs; + static assert( is(DgArgs == Tuple!(CTabFolderEvent,T)), + "Delegate args not correct: "~DgArgs.stringof~" vs. (Event,"~T.stringof~")" ); + + Dg dg; + T t; + int type; + + private this( int type, Dg dg, T t ){ + this.type = type; + this.dg = dg; + static if( T.length > 0 ){ + this.t = t; + } + } + + void itemClosed( CTabFolderEvent e ){ + dg(e,t); + } + public void close(CTabFolderEvent e){ + if( type is CTabFolder2Listener.CLOSE ){ + dg(e,t); + } + } + public void minimize(CTabFolderEvent e){ + if( type is CTabFolder2Listener.MINIMIZE ){ + dg(e,t); + } + } + public void maximize(CTabFolderEvent e){ + if( type is CTabFolder2Listener.MAXIMIZE ){ + dg(e,t); + } + } + public void restore(CTabFolderEvent e){ + if( type is CTabFolder2Listener.RESTORE ){ + dg(e,t); + } + } + public void showList(CTabFolderEvent e){ + if( type is CTabFolder2Listener.SHOWLIST ){ + dg(e,t); + } + } +} + +/++ + + dgListener creates a class implementing the Listener interface and delegating the call to + + handleEvent to the users delegate. This template function will store also additional parameters. + + + + Examle of usage: + + --- + + void handleTextEvent ( Event e, int inset ) { + + // ... + + } + + text.addListener (DWT.FocusOut, dgListener( &handleTextEvent, inset )); + + --- + +/ +CTabFolder2Listener dgCTabFolder2Listener( Dg, T... )( int type, Dg dg, T args ){ + return new _DgCTabFolder2ListenerT!( Dg, T )( type, dg, args ); +} + + + diff -r 5073c0da393a -r f979673f7d47 dwt/custom/CTabFolderLayout.d --- a/dwt/custom/CTabFolderLayout.d Sun Aug 17 09:04:23 2008 -0700 +++ b/dwt/custom/CTabFolderLayout.d Sat Oct 11 22:16:54 2008 -0700 @@ -12,6 +12,7 @@ *******************************************************************************/ module dwt.custom.CTabFolderLayout; +import dwt.dwthelper.utils; import dwt.DWT; import dwt.graphics.GC; diff -r 5073c0da393a -r f979673f7d47 dwt/custom/CTabFolderListener.d --- a/dwt/custom/CTabFolderListener.d Sun Aug 17 09:04:23 2008 -0700 +++ b/dwt/custom/CTabFolderListener.d Sat Oct 11 22:16:54 2008 -0700 @@ -15,6 +15,9 @@ import dwt.internal.DWTEventListener; import dwt.custom.CTabFolderEvent; +import tango.core.Traits; +import tango.core.Tuple; + /** * Classes which implement this interface provide a method * that deals with events generated in the CTabFolder. @@ -42,3 +45,46 @@ */ public void itemClosed(CTabFolderEvent event); } + + + +/// Helper class for the dgListener template function +private class _DgCTabFolderListenerT(Dg,T...) : CTabFolderListener { + + alias ParameterTupleOf!(Dg) DgArgs; + static assert( is(DgArgs == Tuple!(CTabFolderEvent,T)), + "Delegate args not correct" ); + + Dg dg; + T t; + + private this( Dg dg, T t ){ + this.dg = dg; + static if( T.length > 0 ){ + this.t = t; + } + } + + void itemClosed( CTabFolderEvent e ){ + dg(e,t); + } +} + +/++ + + dgListener creates a class implementing the Listener interface and delegating the call to + + handleEvent to the users delegate. This template function will store also additional parameters. + + + + Examle of usage: + + --- + + void handleTextEvent (Event e, int inset ) { + + // ... + + } + + text.addListener (DWT.FocusOut, dgListener( &handleTextEvent, inset )); + + --- + +/ +CTabFolderListener dgCTabFolderListener( Dg, T... )( Dg dg, T args ){ + return new _DgCTabFolderListenerT!( Dg, T )( dg, args ); +} + + + diff -r 5073c0da393a -r f979673f7d47 dwt/custom/ControlEditor.d --- a/dwt/custom/ControlEditor.d Sun Aug 17 09:04:23 2008 -0700 +++ b/dwt/custom/ControlEditor.d Sat Oct 11 22:16:54 2008 -0700 @@ -12,7 +12,7 @@ *******************************************************************************/ module dwt.custom.ControlEditor; - +import dwt.dwthelper.utils; import dwt.DWT; import dwt.graphics.Rectangle; diff -r 5073c0da393a -r f979673f7d47 dwt/custom/TableTree.d --- a/dwt/custom/TableTree.d Sun Aug 17 09:04:23 2008 -0700 +++ b/dwt/custom/TableTree.d Sat Oct 11 22:16:54 2008 -0700 @@ -764,7 +764,6 @@ * @param items the array of items * * @exception IllegalArgumentException * @exception DWTException