comparison dwt/events/SelectionListener.d @ 253:fbb9174f2a2c

Reuse the tango windows api
author Frank Benoit <benoit@tionex.de>
date Fri, 11 Jul 2008 23:01:25 +0200
parents bef1ed4ebc50
children 02332a154347
comparison
equal deleted inserted replaced
252:dffb802cad03 253:fbb9174f2a2c
61 * 61 *
62 * @param e an event containing information about the default selection 62 * @param e an event containing information about the default selection
63 */ 63 */
64 public void widgetDefaultSelected(SelectionEvent e); 64 public void widgetDefaultSelected(SelectionEvent e);
65 } 65 }
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