Show
Ignore:
Timestamp:
07/11/08 17:01:25 (4 months ago)
Author:
Frank Benoit <benoit@tionex.de>
branch:
default
Message:

Reuse the tango windows api

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • dwt/events/SelectionListener.d

    r86 r253  
    6464public void widgetDefaultSelected(SelectionEvent e); 
    6565} 
     66 
     67 
     68 
     69/// Helper class for the dgListener template function 
     70private class _DgSelectionListenerWidgetSelectedT(Dg,T...) : SelectionListener { 
     71 
     72    alias ParameterTupleOf!(DgSel) DgArgs; 
     73    static assert( is(DgArgs == Tuple!(SelectionEvent,T)), 
     74                "Delegate args not correct" ); 
     75 
     76    Dg dg; 
     77    T  t; 
     78 
     79    private this( Dg dg, T t ){ 
     80        this.dg = dg; 
     81        static if( T.length > 0 ){ 
     82            this.t = t; 
     83        } 
     84    } 
     85 
     86    public void widgetSelected(SelectionEvent e){ 
     87        dg(e,t); 
     88    } 
     89    public void widgetDefaultSelected(SelectionEvent e){ 
     90    } 
     91} 
     92 
     93private class _DgSelectionListenerWidgetDefaultSelectedT(Dg,T...) : SelectionListener { 
     94 
     95    alias ParameterTupleOf!(DgSel) DgArgs; 
     96    static assert( is(DgArgs == Tuple!(SelectionEvent,T)), 
     97                "Delegate args not correct" ); 
     98 
     99    Dg dg; 
     100    T  t; 
     101 
     102    private this( Dg dg, T t ){ 
     103        this.dg = dg; 
     104        static if( T.length > 0 ){ 
     105            this.t = t; 
     106        } 
     107    } 
     108 
     109    public void widgetSelected(SelectionEvent e){ 
     110    } 
     111    public void widgetDefaultSelected(SelectionEvent e){ 
     112        dg(e,t); 
     113    } 
     114} 
     115 
     116SelectionListener dgSelectionListenerWidgetSelected( Dg, T... )( Dg dg, T args ){ 
     117    return new _DgSelectionListenerWidgetSelectedT!( Dg, T )( dg, args ); 
     118} 
     119SelectionListener dgSelectionListenerWidgetDefaultSelected( Dg, T... )( Dg dg, T args ){ 
     120    return new _DgSelectionListenerWidgetDefaultSelectedT!( Dg, T )( dg, args ); 
     121} 
     122 
     123 
     124