anatomist  5.1.2
3D neuroimaging data viewer
control_d.h
Go to the documentation of this file.
1 /* This software and supporting documentation are distributed by
2  * Institut Federatif de Recherche 49
3  * CEA/NeuroSpin, Batiment 145,
4  * 91191 Gif-sur-Yvette cedex
5  * France
6  *
7  * This software is governed by the CeCILL-B license under
8  * French law and abiding by the rules of distribution of free software.
9  * You can use, modify and/or redistribute the software under the
10  * terms of the CeCILL-B license as circulated by CEA, CNRS
11  * and INRIA at the following URL "http://www.cecill.info".
12  *
13  * As a counterpart to the access to the source code and rights to copy,
14  * modify and redistribute granted by the license, users are provided only
15  * with a limited warranty and the software's author, the holder of the
16  * economic rights, and the successive licensors have only limited
17  * liability.
18  *
19  * In this respect, the user's attention is drawn to the risks associated
20  * with loading, using, modifying and/or developing or reproducing the
21  * software by the user in light of its specific status of free software,
22  * that may mean that it is complicated to manipulate, and that also
23  * therefore means that it is reserved for developers and experienced
24  * professionals having in-depth computer knowledge. Users are therefore
25  * encouraged to load and test the software's suitability as regards their
26  * requirements in conditions enabling the security of their systems and/or
27  * data to be ensured and, more generally, to use and operate it in the
28  * same conditions as regards security.
29  *
30  * The fact that you are presently reading this means that you have had
31  * knowledge of the CeCILL-B license and that you accept its terms.
32  */
33 
34 #ifndef ANATOMIST_CONTROLER_CONTROL_D_H
35 #define ANATOMIST_CONTROLER_CONTROL_D_H
36 
40 #include <typeinfo>
41 
42 namespace anatomist
43 {
44 
45 template<typename T>
46 Control::KeyActionLinkOf<T>::KeyActionLinkOf() : actionInstance(NULL), actionCallback(NULL) {}
47 
48 
49 template<typename T>
50 Control::KeyActionLinkOf<T>::KeyActionLinkOf( Action * action, Callback actionCb) :
51  actionCallback(actionCb)
52 {
53  actionInstance = dynamic_cast<T *>(action) ;
54  ASSERT( actionInstance != 0 ) ;
55 }
56 
57 
58 template<typename T>
59 void
61 {
62  (actionInstance->*(actionCallback))();
63 }
64 
65 
66 template<typename T>
69 {
70  return new KeyActionLinkOf<T>(actionInstance, actionCallback);
71 }
72 
73 
74 template<typename T>
75 Control::MouseActionLinkOf<T>::MouseActionLinkOf() : actionInstance(NULL), actionCallback(NULL) {}
76 
77 
78 template<typename T>
80  actionCallback(actionCb)
81 {
82  actionInstance = dynamic_cast<T *>(action) ;
83  ASSERT( actionInstance );
84 }
85 
86 
87 template<typename T>
88 Action*
90 {
91  return actionInstance;
92 }
93 
94 
95 template<typename T>
96 void
97 Control::MouseActionLinkOf<T>::execute( int x, int y, int globalX, int globalY )
98 {
99  (actionInstance->*(actionCallback))( x, y, globalX, globalY );
100 }
101 
102 
103 template<typename T>
106 {
107  return new MouseActionLinkOf<T>(actionInstance, actionCallback);
108 }
109 
110 
111 template<typename T>
112 Control::WheelActionLinkOf<T>::WheelActionLinkOf() : actionInstance(NULL), actionCallback(NULL) {}
113 
114 
115 template<typename T>
117  actionCallback(actionCb)
118 {
119  actionInstance = dynamic_cast<T *>(action) ;
120  ASSERT( actionInstance != 0 ) ;
121 }
122 
123 
124 template<typename T>
125 void
126 Control::WheelActionLinkOf<T>::execute( int delta, int x, int y, int globalX, int globalY )
127 {
128  (actionInstance->*(actionCallback))( delta, x, y, globalX, globalY );
129 }
130 
131 
132 template<typename T>
135 {
136  return new WheelActionLinkOf<T>(actionInstance, actionCallback);
137 }
138 
139 
140 template<typename T>
141 Control::FocusActionLinkOf<T>::FocusActionLinkOf() : actionInstance(NULL), actionCallback(NULL) {}
142 
143 
144 template<typename T>
146  actionCallback(actionCb)
147 {
148  actionInstance = dynamic_cast<T *>(action) ;
149  ASSERT( actionInstance != 0 ) ;
150 }
151 
152 
153 template<typename T>
154 void
156 {
157  (actionInstance->*(actionCallback))();
158 }
159 
160 
161 template<typename T>
164 {
165  return new FocusActionLinkOf<T>(actionInstance, actionCallback);
166 }
167 
168 
169 template<typename T>
170 Control::EnterLeaveActionLinkOf<T>::EnterLeaveActionLinkOf() : actionInstance(NULL), actionCallback(NULL) {}
171 
172 template<typename T>
174  actionCallback(actionCb)
175 {
176  actionInstance = dynamic_cast<T *>(action) ;
177  ASSERT( actionInstance != 0 ) ;
178 }
179 
180 
181 template<typename T>
182 void
184 {
185  (actionInstance->*(actionCallback))();
186 }
187 
188 
189 template<typename T>
192 {
193  return new EnterLeaveActionLinkOf<T>(actionInstance, actionCallback);
194 }
195 
196 
197 template<typename T>
198 Control::PaintActionLinkOf<T>::PaintActionLinkOf() : actionInstance(NULL), actionCallback(NULL) {}
199 
200 
201 template<typename T>
203  actionCallback(actionCb)
204 {
205  actionInstance = dynamic_cast<T *>(action) ;
206  ASSERT( actionInstance != 0 ) ;
207 }
208 
209 
210 template<typename T>
211 void
212 Control::PaintActionLinkOf<T>::execute( int xOffset, int yOffset, int height, int width )
213 {
214  (actionInstance->*(actionCallback))( xOffset, yOffset, height, width );
215 }
216 
217 
218 template<typename T>
221 {
222  return new PaintActionLinkOf<T>(actionInstance, actionCallback);
223 }
224 
225 
226 template<typename T>
227 Control::MoveOrDragActionLinkOf<T>::MoveOrDragActionLinkOf() : actionInstance(NULL), actionCallback(NULL) {}
228 
229 
230 template<typename T>
232  actionCallback(actionCb)
233 {
234  actionInstance = dynamic_cast<T *>(action) ;
235  ASSERT( actionInstance != 0 ) ;
236 }
237 
238 
239 template<typename T>
240 void
241 Control::MoveOrDragActionLinkOf<T>::execute( int posX, int posY, int oldPosX, int oldPosY )
242 {
243  (actionInstance->*(actionCallback))( posX, posY, oldPosX, oldPosY );
244 }
245 
246 
247 template<typename T>
250 {
251  return new MoveOrDragActionLinkOf<T>(actionInstance, actionCallback);
252 }
253 
254 
255 template<typename T>
256 Control::DropActionLinkOf<T>::DropActionLinkOf() : actionInstance(NULL), actionCallback(NULL) {}
257 
258 
259 template<typename T>
261  actionCallback(actionCb)
262 {
263  actionInstance = dynamic_cast<T *>(action) ;
264  ASSERT( actionInstance != 0 ) ;
265 }
266 
267 
268 template<typename T>
269 void
271 {
272  (actionInstance->*(actionCallback))( posX, posY, action );
273 }
274 
275 
276 template<typename T>
279 {
280  return new DropActionLinkOf<T>(actionInstance, actionCallback);
281 }
282 
283 
284 template<typename T>
285 Control::ResizeActionLinkOf<T>::ResizeActionLinkOf() : actionInstance(NULL), actionCallback(NULL) {}
286 
287 template<typename T>
289  actionCallback(actionCb)
290 {
291  actionInstance = dynamic_cast<T *>(action) ;
292  ASSERT( actionInstance != 0 ) ;
293 }
294 
295 
296 template<typename T>
297 void
298 Control::ResizeActionLinkOf<T>::execute( int height, int width, int oldHeight, int oldWidth )
299 {
300  (actionInstance->*(actionCallback))( height, width, oldHeight, oldWidth );
301 }
302 
303 
304 template<typename T>
307 {
308  return new ResizeActionLinkOf<T>(actionInstance, actionCallback);
309 }
310 
311 
312 template<typename T>
313 Control::ShowHideActionLinkOf<T>::ShowHideActionLinkOf() : actionInstance(NULL), actionCallback(NULL) {}
314 
315 template<typename T>
317  actionCallback(actionCb)
318 {
319  actionInstance = dynamic_cast<T *>(action) ;
320  ASSERT( actionInstance != 0 ) ;
321 }
322 
323 
324 template<typename T>
325 void
327 {
328  (actionInstance->*(actionCallback))(spontaneous);
329 }
330 
331 
332 template<typename T>
335 {
336  return new ShowHideActionLinkOf<T>(actionInstance, actionCallback);
337 }
338 
339 
340 template<typename T>
342  : actionInstance( 0 ), actionCallback( 0 )
343 {
344 }
345 
346 
347 template<typename T>
349  Action * action, Callback actionCb )
350  : actionCallback( actionCb )
351 {
352  actionInstance = dynamic_cast<T *>( action );
353  ASSERT( actionInstance != 0 );
354 }
355 
356 
357 template<typename T>
358 void
360 {
361  (actionInstance->*(actionCallback))();
362 }
363 
364 
365 template<typename T>
368 {
369  return new SelectionChangedActionLinkOf<T>( actionInstance, actionCallback );
370 }
371 
372 
373 template<typename T>
375  : actionInstance( 0 ), actionCallback( 0 )
376 {
377 }
378 
379 
380 template<typename T>
382  Action * action, Callback actionCb )
383  : actionCallback( actionCb )
384 {
385  actionInstance = dynamic_cast<T *>( action );
386  ASSERT( actionInstance != 0 );
387 }
388 
389 
390 template<typename T>
391 void
392 Control::PinchActionLinkOf<T>::execute( QPinchGesture* gesture )
393 {
394  (actionInstance->*(actionCallback))( gesture );
395 }
396 
397 
398 template<typename T>
401 {
402  return new PinchActionLinkOf<T>( actionInstance, actionCallback );
403 }
404 
405 
406 template<typename T>
408  : actionInstance( 0 ), actionCallback( 0 )
409 {
410 }
411 
412 
413 template<typename T>
415  Action * action, Callback actionCb )
416  : actionCallback( actionCb )
417 {
418  actionInstance = dynamic_cast<T *>( action );
419  ASSERT( actionInstance != 0 );
420 }
421 
422 
423 template<typename T>
424 void
426 {
427  (actionInstance->*(actionCallback))( gesture );
428 }
429 
430 
431 template<typename T>
434 {
435  return new PanActionLinkOf<T>( actionInstance, actionCallback );
436 }
437 
438 
439 template<typename T>
441  : actionInstance( 0 ), actionCallback( 0 )
442 {
443 }
444 
445 
446 template<typename T>
448  Action * action, Callback actionCb )
449  : actionCallback( actionCb )
450 {
451  actionInstance = dynamic_cast<T *>( action );
452  ASSERT( actionInstance != 0 );
453 }
454 
455 
456 template<typename T>
457 void
458 Control::SwipeActionLinkOf<T>::execute( QSwipeGesture* gesture )
459 {
460  (actionInstance->*(actionCallback))( gesture );
461 }
462 
463 
464 template<typename T>
467 {
468  return new SwipeActionLinkOf<T>( actionInstance, actionCallback );
469 }
470 
471 
472 template<typename T>
474  : actionInstance( 0 ), actionCallback( 0 )
475 {
476 }
477 
478 
479 template<typename T>
481  Action * action, Callback actionCb )
482  : actionCallback( actionCb )
483 {
484  actionInstance = dynamic_cast<T *>( action );
485  ASSERT( actionInstance != 0 );
486 }
487 
488 
489 template<typename T>
490 void
492 {
493  (actionInstance->*(actionCallback))( gesture );
494 }
495 
496 
497 template<typename T>
500 {
501  return new TapActionLinkOf<T>( actionInstance, actionCallback );
502 }
503 
504 
505 template<typename T>
507  : actionInstance( 0 ), actionCallback( 0 )
508 {
509 }
510 
511 
512 template<typename T>
514  Action * action, Callback actionCb )
515  : actionCallback( actionCb )
516 {
517  actionInstance = dynamic_cast<T *>( action );
518  ASSERT( actionInstance != 0 );
519 }
520 
521 
522 template<typename T>
523 void
524 Control::TapAndHoldActionLinkOf<T>::execute( QTapAndHoldGesture* gesture )
525 {
526  (actionInstance->*(actionCallback))( gesture );
527 }
528 
529 
530 template<typename T>
533 {
534  return new TapAndHoldActionLinkOf<T>( actionInstance, actionCallback );
535 }
536 
537 
538 }
539 
540 
541 #endif
#define ASSERT(EX)
virtual DropActionLink * clone() const
Definition: control_d.h:278
virtual void execute(int posX, int posY, Control::DropAction action)
Definition: control_d.h:270
virtual EnterLeaveActionLink * clone() const
Definition: control_d.h:191
virtual FocusActionLink * clone() const
Definition: control_d.h:163
virtual KeyActionLink * clone() const
Definition: control_d.h:68
virtual void execute(int x, int y, int globalX, int globalY)
Definition: control_d.h:97
virtual MouseActionLink * clone() const
Definition: control_d.h:105
virtual MoveOrDragActionLink * clone() const
Definition: control_d.h:249
virtual void execute(int posX=0, int posY=0, int oldPosX=0, int oldPosY=0)
Definition: control_d.h:241
virtual PaintActionLink * clone() const
Definition: control_d.h:220
virtual void execute(int xOffset, int yOffset, int height, int width)
Definition: control_d.h:212
virtual PanActionLink * clone() const
Definition: control_d.h:433
virtual void execute(QPanGesture *)
Definition: control_d.h:425
virtual PinchActionLink * clone() const
Definition: control_d.h:400
virtual void execute(QPinchGesture *)
Definition: control_d.h:392
virtual void execute(int height, int width, int oldHeight, int oldWidth)
Definition: control_d.h:298
virtual ResizeActionLink * clone() const
Definition: control_d.h:306
virtual SelectionChangedActionLink * clone() const
Definition: control_d.h:367
virtual ShowHideActionLink * clone() const
Definition: control_d.h:334
virtual void execute(bool spontaneous)
Definition: control_d.h:326
virtual SwipeActionLink * clone() const
Definition: control_d.h:466
virtual void execute(QSwipeGesture *)
Definition: control_d.h:458
virtual TapActionLink * clone() const
Definition: control_d.h:499
virtual void execute(QTapGesture *)
Definition: control_d.h:491
virtual TapAndHoldActionLink * clone() const
Definition: control_d.h:532
virtual void execute(QTapAndHoldGesture *)
Definition: control_d.h:524
virtual void execute(int delta, int x, int y, int globalX, int globalY)
Definition: control_d.h:126
virtual WheelActionLink * clone() const
Definition: control_d.h:134
Qt::DropAction DropAction
Definition: control.h:133