anatomist  5.1.2
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 ) {}
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:
119 
120 public slots:
121  void viewSlot();
122  void unselectSlot();
124  void removeSlot();
128 
129 protected:
131 
133  std::set<MenuCallback *> _callbacks;
134  static QPixmap *_defPixmap;
135  std::set<anatomist::AObject *> _objects;
136 
137 private:
138 };
139 
140 
141 #endif
#define slots
Private class.
Definition: qSelMenu.h:53
void * _clientdata
Definition: qSelMenu.h:68
void(* _func)(void *)
Definition: qSelMenu.h:67
MenuCallback(void(*func)(void *), void *clientdata)
Definition: qSelMenu.h:58
virtual void activated()
virtual ~MenuCallback()
QAOptionMenuCallback(carto::rc_ptr< anatomist::ObjectMenuCallback > cbk, const std::set< anatomist::AObject * > *obj)
Definition: qSelMenu.h:81
virtual ~QAOptionMenuCallback()
QAOptionMenuCallback(void(*func)(const std::set< anatomist::AObject * > &), const std::set< anatomist::AObject * > *obj)
virtual void activated()
Selection menu widget.
Definition: qSelMenu.h:97
static QPixmap * _defPixmap
Definition: qSelMenu.h:134
std::set< MenuCallback * > _callbacks
Definition: qSelMenu.h:133
void unselectSlot()
void selectAllSlot()
void unselectSignal(anatomist::AWindow *win)
std::set< anatomist::AObject * > _objects
Definition: qSelMenu.h:135
void selectAllSignal(anatomist::AWindow *win)
void removeSlot()
void viewSignal(anatomist::AWindow *win)
anatomist::AWindow * _win
Definition: qSelMenu.h:132
void selAttribSignal(anatomist::AWindow *win)
void removeSignal(anatomist::AWindow *win)
void setObjects(const std::set< anatomist::AObject * > &obj)
Definition: qSelMenu.h:108
void removeThisWinSlot()
void selAttribSlot()
virtual void update(anatomist::AWindow *win, const Tree *specific=0)
void eraseCallbacks()
void addOptionMenus(QMenu *menu, const Tree *tr)
virtual ~QSelectMenu()
void neighboursSignal(anatomist::AWindow *win)
QSelectMenu(QWidget *parent=0)
void addMenus(QMenu *menu, const Tree *tr)
QSelectMenu(const QString &title, QWidget *parent=0)
void viewSlot()
void neighboursSlot()
void removeThisWinSignal(anatomist::AWindow *win)
Abstract base class Anatomist window.
Definition: Window.h:58