anatomist 6.0.4
3D neuroimaging data viewer
objectmenu.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 ANA_OBJECT_OBJECTMENU_H
36#define ANA_OBJECT_OBJECTMENU_H
37
38#include <cartobase/smart/rcptr.h>
39#include <cartobase/object/object.h>
40#include <string>
41#include <vector>
42#include <set>
43
44class Tree;
45
46namespace anatomist
47{
48
49 class AObject;
50
52 {
53 public:
56
60 virtual void doit( const std::set<AObject *> & obj ) = 0;
61 virtual bool operator == ( const ObjectMenuCallback & ) const;
62 virtual bool operator != ( const ObjectMenuCallback & ) const;
63 };
64
65
67 {
68 public:
69 typedef void (*CallbackFunc)( const std::set<AObject *> & );
72
73 virtual void doit( const std::set<AObject *> & obj );
74 virtual bool operator == ( const ObjectMenuCallback & ) const;
75
76 private:
77 CallbackFunc _func;
78 };
79
80
82 {
83 public:
88
90
92 void insertItem( const std::vector<std::string> & inside,
93 const std::string & text );
98 void insertItem( const std::vector<std::string> & inside,
99 const std::string & text, ObjectMenuCallback* cbk );
101 void insertItem( const std::vector<std::string> & inside,
102 const std::string & text,
104 void removeItem( const std::vector<std::string> & inside,
105 const std::string & text );
106 Tree* item( const std::vector<std::string> & pos,
107 bool createSubtrees = true );
109 const Tree* tree() const;
112
113 private:
114 struct Private;
115 Private *d;
116 };
117
118
120 {
121 public:
124
125 virtual ObjectMenu* doit( const AObject*, ObjectMenu* ) = 0;
126 };
127
128
130 {
131 public:
132 typedef ObjectMenu* (*RegistrerFunc)( const AObject*, ObjectMenu* );
135
136 virtual ObjectMenu* doit( const AObject*, ObjectMenu* );
137
138 private:
139 RegistrerFunc _f;
140 };
141
142}
143
144namespace carto
145{
147}
148#endif
149
Base Anatomist object (abstract)
Definition Object.h:97
virtual void doit(const std::set< AObject * > &obj)
executes the callback
ObjectMenuCallbackFunc(CallbackFunc cbk)
virtual bool operator==(const ObjectMenuCallback &) const
void(* CallbackFunc)(const std::set< AObject * > &)
Definition objectmenu.h:69
virtual bool operator!=(const ObjectMenuCallback &) const
virtual void doit(const std::set< AObject * > &obj)=0
executes the callback
virtual bool operator==(const ObjectMenuCallback &) const
virtual ObjectMenu * doit(const AObject *, ObjectMenu *)=0
ObjectMenu *(* RegistrerFunc)(const AObject *, ObjectMenu *)
Definition objectmenu.h:132
virtual ObjectMenu * doit(const AObject *, ObjectMenu *)
void insertItem(const std::vector< std::string > &inside, const std::string &text, ObjectMenuCallbackFunc::CallbackFunc cbk)
inserts a terminal menu (with callback as a function)
Tree * item(const std::vector< std::string > &pos, bool createSubtrees=true)
ObjectMenu & operator=(const ObjectMenu &)
ObjectMenu(const ObjectMenu &)
Tree * releaseTree()
returns the internal tree and release ownership on it
void removeItem(const std::vector< std::string > &inside, const std::string &text)
const Tree * tree() const
void insertItem(const std::vector< std::string > &inside, const std::string &text, ObjectMenuCallback *cbk)
inserts a terminal menu (with callback).
void insertItem(const std::vector< std::string > &inside, const std::string &text)
inserts a sub-menu
#define DECLARE_GENERIC_OBJECT_TYPE(T)