anatomist 6.0.4
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
42namespace anatomist
43{
44
45template<typename T>
46Control::KeyActionLinkOf<T>::KeyActionLinkOf() : actionInstance(NULL), actionCallback(NULL) {}
47
48
49template<typename T>
51 actionCallback(actionCb)
52{
53 actionInstance = dynamic_cast<T *>(action) ;
54 ASSERT( actionInstance != 0 ) ;
55}
56
57
58template<typename T>
59void
61{
62 (actionInstance->*(actionCallback))();
63}
64
65
66template<typename T>
69{
70 return new KeyActionLinkOf<T>(actionInstance, actionCallback);
71}
72
73
74template<typename T>
75Control::MouseActionLinkOf<T>::MouseActionLinkOf() : actionInstance(NULL), actionCallback(NULL) {}
76
77
78template<typename T>
80 actionCallback(actionCb)
81{
82 actionInstance = dynamic_cast<T *>(action) ;
83 ASSERT( actionInstance );
84}
85
86
87template<typename T>
88Action*
90{
91 return actionInstance;
92}
93
94
95template<typename T>
96void
97Control::MouseActionLinkOf<T>::execute( int x, int y, int globalX, int globalY )
98{
99 (actionInstance->*(actionCallback))( x, y, globalX, globalY );
100}
101
102
103template<typename T>
106{
107 return new MouseActionLinkOf<T>(actionInstance, actionCallback);
108}
109
110
111template<typename T>
112Control::WheelActionLinkOf<T>::WheelActionLinkOf() : actionInstance(NULL), actionCallback(NULL) {}
113
114
115template<typename T>
117 actionCallback(actionCb)
118{
119 actionInstance = dynamic_cast<T *>(action) ;
120 ASSERT( actionInstance != 0 ) ;
121}
122
123
124template<typename T>
125void
126Control::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
132template<typename T>
135{
136 return new WheelActionLinkOf<T>(actionInstance, actionCallback);
137}
138
139
140template<typename T>
141Control::FocusActionLinkOf<T>::FocusActionLinkOf() : actionInstance(NULL), actionCallback(NULL) {}
142
143
144template<typename T>
146 actionCallback(actionCb)
147{
148 actionInstance = dynamic_cast<T *>(action) ;
149 ASSERT( actionInstance != 0 ) ;
150}
151
152
153template<typename T>
154void
156{
157 (actionInstance->*(actionCallback))();
158}
159
160
161template<typename T>
164{
165 return new FocusActionLinkOf<T>(actionInstance, actionCallback);
166}
167
168
169template<typename T>
170Control::EnterLeaveActionLinkOf<T>::EnterLeaveActionLinkOf() : actionInstance(NULL), actionCallback(NULL) {}
171
172template<typename T>
174 actionCallback(actionCb)
175{
176 actionInstance = dynamic_cast<T *>(action) ;
177 ASSERT( actionInstance != 0 ) ;
178}
179
180
181template<typename T>
182void
184{
185 (actionInstance->*(actionCallback))();
186}
187
188
189template<typename T>
192{
193 return new EnterLeaveActionLinkOf<T>(actionInstance, actionCallback);
194}
195
196
197template<typename T>
198Control::PaintActionLinkOf<T>::PaintActionLinkOf() : actionInstance(NULL), actionCallback(NULL) {}
199
200
201template<typename T>
203 actionCallback(actionCb)
204{
205 actionInstance = dynamic_cast<T *>(action) ;
206 ASSERT( actionInstance != 0 ) ;
207}
208
209
210template<typename T>
211void
212Control::PaintActionLinkOf<T>::execute( int xOffset, int yOffset, int height, int width )
213{
214 (actionInstance->*(actionCallback))( xOffset, yOffset, height, width );
215}
216
217
218template<typename T>
221{
222 return new PaintActionLinkOf<T>(actionInstance, actionCallback);
223}
224
225
226template<typename T>
227Control::MoveOrDragActionLinkOf<T>::MoveOrDragActionLinkOf() : actionInstance(NULL), actionCallback(NULL) {}
228
229
230template<typename T>
232 actionCallback(actionCb)
233{
234 actionInstance = dynamic_cast<T *>(action) ;
235 ASSERT( actionInstance != 0 ) ;
236}
237
238
239template<typename T>
240void
241Control::MoveOrDragActionLinkOf<T>::execute( int posX, int posY, int oldPosX, int oldPosY )
242{
243 (actionInstance->*(actionCallback))( posX, posY, oldPosX, oldPosY );
244}
245
246
247template<typename T>
250{
251 return new MoveOrDragActionLinkOf<T>(actionInstance, actionCallback);
252}
253
254
255template<typename T>
256Control::DropActionLinkOf<T>::DropActionLinkOf() : actionInstance(NULL), actionCallback(NULL) {}
257
258
259template<typename T>
261 actionCallback(actionCb)
262{
263 actionInstance = dynamic_cast<T *>(action) ;
264 ASSERT( actionInstance != 0 ) ;
265}
266
267
268template<typename T>
269void
271{
272 (actionInstance->*(actionCallback))( posX, posY, action );
273}
274
275
276template<typename T>
279{
280 return new DropActionLinkOf<T>(actionInstance, actionCallback);
281}
282
283
284template<typename T>
285Control::ResizeActionLinkOf<T>::ResizeActionLinkOf() : actionInstance(NULL), actionCallback(NULL) {}
286
287template<typename T>
289 actionCallback(actionCb)
290{
291 actionInstance = dynamic_cast<T *>(action) ;
292 ASSERT( actionInstance != 0 ) ;
293}
294
295
296template<typename T>
297void
298Control::ResizeActionLinkOf<T>::execute( int height, int width, int oldHeight, int oldWidth )
299{
300 (actionInstance->*(actionCallback))( height, width, oldHeight, oldWidth );
301}
302
303
304template<typename T>
307{
308 return new ResizeActionLinkOf<T>(actionInstance, actionCallback);
309}
310
311
312template<typename T>
313Control::ShowHideActionLinkOf<T>::ShowHideActionLinkOf() : actionInstance(NULL), actionCallback(NULL) {}
314
315template<typename T>
317 actionCallback(actionCb)
318{
319 actionInstance = dynamic_cast<T *>(action) ;
320 ASSERT( actionInstance != 0 ) ;
321}
322
323
324template<typename T>
325void
327{
328 (actionInstance->*(actionCallback))(spontaneous);
329}
330
331
332template<typename T>
335{
336 return new ShowHideActionLinkOf<T>(actionInstance, actionCallback);
337}
338
339
340template<typename T>
342 : actionInstance( 0 ), actionCallback( 0 )
343{
344}
345
346
347template<typename T>
349 Action * action, Callback actionCb )
350 : actionCallback( actionCb )
351{
352 actionInstance = dynamic_cast<T *>( action );
353 ASSERT( actionInstance != 0 );
354}
355
356
357template<typename T>
358void
360{
361 (actionInstance->*(actionCallback))();
362}
363
364
365template<typename T>
368{
369 return new SelectionChangedActionLinkOf<T>( actionInstance, actionCallback );
370}
371
372
373template<typename T>
375 : actionInstance( 0 ), actionCallback( 0 )
376{
377}
378
379
380template<typename T>
382 Action * action, Callback actionCb )
383 : actionCallback( actionCb )
384{
385 actionInstance = dynamic_cast<T *>( action );
386 ASSERT( actionInstance != 0 );
387}
388
389
390template<typename T>
391void
393{
394 (actionInstance->*(actionCallback))( gesture );
395}
396
397
398template<typename T>
401{
402 return new PinchActionLinkOf<T>( actionInstance, actionCallback );
403}
404
405
406template<typename T>
408 : actionInstance( 0 ), actionCallback( 0 )
409{
410}
411
412
413template<typename T>
415 Action * action, Callback actionCb )
416 : actionCallback( actionCb )
417{
418 actionInstance = dynamic_cast<T *>( action );
419 ASSERT( actionInstance != 0 );
420}
421
422
423template<typename T>
424void
426{
427 (actionInstance->*(actionCallback))( gesture );
428}
429
430
431template<typename T>
434{
435 return new PanActionLinkOf<T>( actionInstance, actionCallback );
436}
437
438
439template<typename T>
441 : actionInstance( 0 ), actionCallback( 0 )
442{
443}
444
445
446template<typename T>
448 Action * action, Callback actionCb )
449 : actionCallback( actionCb )
450{
451 actionInstance = dynamic_cast<T *>( action );
452 ASSERT( actionInstance != 0 );
453}
454
455
456template<typename T>
457void
459{
460 (actionInstance->*(actionCallback))( gesture );
461}
462
463
464template<typename T>
467{
468 return new SwipeActionLinkOf<T>( actionInstance, actionCallback );
469}
470
471
472template<typename T>
474 : actionInstance( 0 ), actionCallback( 0 )
475{
476}
477
478
479template<typename T>
481 Action * action, Callback actionCb )
482 : actionCallback( actionCb )
483{
484 actionInstance = dynamic_cast<T *>( action );
485 ASSERT( actionInstance != 0 );
486}
487
488
489template<typename T>
490void
492{
493 (actionInstance->*(actionCallback))( gesture );
494}
495
496
497template<typename T>
500{
501 return new TapActionLinkOf<T>( actionInstance, actionCallback );
502}
503
504
505template<typename T>
507 : actionInstance( 0 ), actionCallback( 0 )
508{
509}
510
511
512template<typename T>
514 Action * action, Callback actionCb )
515 : actionCallback( actionCb )
516{
517 actionInstance = dynamic_cast<T *>( action );
518 ASSERT( actionInstance != 0 );
519}
520
521
522template<typename T>
523void
525{
526 (actionInstance->*(actionCallback))( gesture );
527}
528
529
530template<typename T>
533{
534 return new TapAndHoldActionLinkOf<T>( actionInstance, actionCallback );
535}
536
537
538template<typename T>
540 : actionInstance( 0 ), actionCallback( 0 )
541{
542}
543
544
545template<typename T>
547 Action * action, Callback actionCb )
548 : actionCallback( actionCb )
549{
550 actionInstance = dynamic_cast<T *>( action );
551 ASSERT( actionInstance != 0 );
552}
553
554
555template<typename T>
556void
558{
559 (actionInstance->*(actionCallback))( event );
560}
561
562
563template<typename T>
566{
567 return new TouchActionLinkOf<T>( actionInstance, actionCallback );
568}
569
570
571}
572
573
574#endif
#define ASSERT(EX)
void(T::* Callback)(int posX, int posY, Control::DropAction action)
Definition control.h:374
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
void(T::* Callback)(int x, int y, int globalX, int globalY)
Definition control.h:220
void(T::* Callback)(int, int, int, int)
Definition control.h:349
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
void(T::* Callback)(int xOffset, int yOffset, int height, int width)
Definition control.h:324
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
void(T::* Callback)(QPanGesture *)
Definition control.h:502
virtual void execute(QPanGesture *)
Definition control_d.h:425
virtual PinchActionLink * clone() const
Definition control_d.h:400
void(T::* Callback)(QPinchGesture *)
Definition control.h:476
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
void(T::* Callback)(int height, int width, int oldHeight, int oldWidth)
Definition control.h:398
virtual SelectionChangedActionLink * clone() const
Definition control_d.h:367
void(T::* Callback)(bool spontaneous)
Definition control.h:450
virtual ShowHideActionLink * clone() const
Definition control_d.h:334
virtual void execute(bool spontaneous)
Definition control_d.h:326
void(T::* Callback)(bool spontaneous)
Definition control.h:425
virtual SwipeActionLink * clone() const
Definition control_d.h:466
virtual void execute(QSwipeGesture *)
Definition control_d.h:458
void(T::* Callback)(QSwipeGesture *)
Definition control.h:580
virtual TapActionLink * clone() const
Definition control_d.h:499
virtual void execute(QTapGesture *)
Definition control_d.h:491
void(T::* Callback)(QTapGesture *)
Definition control.h:528
virtual TapAndHoldActionLink * clone() const
Definition control_d.h:532
void(T::* Callback)(QTapAndHoldGesture *)
Definition control.h:554
virtual void execute(QTapAndHoldGesture *)
Definition control_d.h:524
void(T::* Callback)(QTouchEvent *)
Definition control.h:606
virtual void execute(QTouchEvent *)
Definition control_d.h:557
virtual TouchActionLink * clone() const
Definition control_d.h:565
void(T::* Callback)(int delta, int x, int y, int globalX, int globalY)
Definition control.h:248
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