anatomist  5.0.5
3D neuroimaging data viewer
qSelMenu.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 
35 #ifndef ANAQT_SELECTION_QSELMENU_H
36 #define ANAQT_SELECTION_QSELMENU_H
37 
39 #include <QMenu>
40 
41 class Tree;
42 class QPixmap;
43 
44 namespace anatomist
45 {
46  class AWindow;
47  class AObject;
48 }
49 
50 
52 class MenuCallback : public QObject
53 {
54 private:
55  Q_OBJECT
56 
57 public:
58  MenuCallback( void (*func)( void * ), void *clientdata )
59  : _func( func ), _clientdata( clientdata )
60  {}
61  virtual ~MenuCallback();
62 
63 public slots:
64  virtual void activated();
65 
66 protected:
67  void (*_func)( void * );
68  void *_clientdata;
69 };
70 
71 
72 // private class
73 
75 {
76  Q_OBJECT
77 
78 public:
79  QAOptionMenuCallback( void (*func)( const std::set<anatomist::AObject *> & ),
80  const std::set<anatomist::AObject *> *obj );
82  const std::set<anatomist::AObject *> *obj )
83  : MenuCallback( 0, (void *) obj ), _callback( cbk ) {}
84  virtual ~QAOptionMenuCallback();
85 
86 public slots:
87  virtual void activated();
88 
89 private:
91 // void (*_optfunc)( const std::set<anatomist::AObject *> & );
92 };
93 
94 
96 class QSelectMenu : public QMenu
97 {
98  Q_OBJECT
99 
100 public:
101  QSelectMenu( QWidget* parent = 0 );
102  QSelectMenu( const QString & title, QWidget* parent = 0 );
103  virtual ~QSelectMenu();
104 
105  virtual void update( anatomist::AWindow* win, const Tree* specific = 0 );
106  void addOptionMenus( QMenu* menu, const Tree* tr );
107  void addMenus( QMenu* menu, const Tree* tr );
108  void setObjects( const std::set<anatomist::AObject *> & obj )
109  { _objects = obj; }
110 
111 signals:
112  void viewSignal( anatomist::AWindow* win );
113  void unselectSignal( anatomist::AWindow* win );
114  void selectAllSignal( anatomist::AWindow* win );
115  void removeSignal( anatomist::AWindow* win );
116  void removeThisWinSignal( anatomist::AWindow* win );
117  void neighboursSignal( anatomist::AWindow* win );
118  void selAttribSignal( anatomist::AWindow* win );
119 
120 public slots:
121  void viewSlot();
122  void unselectSlot();
123  void selectAllSlot();
124  void removeSlot();
125  void removeThisWinSlot();
126  void neighboursSlot();
127  void selAttribSlot();
128 
129 protected:
130  void eraseCallbacks();
131 
133  std::set<MenuCallback *> _callbacks;
134  static QPixmap *_defPixmap;
135  std::set<anatomist::AObject *> _objects;
136 
137 private:
138 };
139 
140 
141 #endif
static QPixmap * _defPixmap
Definition: qSelMenu.h:134
void * _clientdata
Definition: qSelMenu.h:68
void setObjects(const std::set< anatomist::AObject *> &obj)
Definition: qSelMenu.h:108
anatomist::AWindow * _win
Definition: qSelMenu.h:132
Selection menu widget.
Definition: qSelMenu.h:96
Abstract base class Anatomist window.
Definition: Window.h:57
#define slots
MenuCallback(void(*func)(void *), void *clientdata)
Definition: qSelMenu.h:58
std::set< MenuCallback * > _callbacks
Definition: qSelMenu.h:133
std::set< anatomist::AObject * > _objects
Definition: qSelMenu.h:135
QAOptionMenuCallback(carto::rc_ptr< anatomist::ObjectMenuCallback > cbk, const std::set< anatomist::AObject *> *obj)
Definition: qSelMenu.h:81
Private class.
Definition: qSelMenu.h:52