| | 66 | |
|---|
| | 67 | |
|---|
| | 68 | |
|---|
| | 69 | /// Helper class for the dgListener template function |
|---|
| | 70 | private 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 | |
|---|
| | 93 | private 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 | |
|---|
| | 116 | SelectionListener dgSelectionListenerWidgetSelected( Dg, T... )( Dg dg, T args ){ |
|---|
| | 117 | return new _DgSelectionListenerWidgetSelectedT!( Dg, T )( dg, args ); |
|---|
| | 118 | } |
|---|
| | 119 | SelectionListener dgSelectionListenerWidgetDefaultSelected( Dg, T... )( Dg dg, T args ){ |
|---|
| | 120 | return new _DgSelectionListenerWidgetDefaultSelectedT!( Dg, T )( dg, args ); |
|---|
| | 121 | } |
|---|
| | 122 | |
|---|
| | 123 | |
|---|
| | 124 | |
|---|