anatomist 6.0.4
3D neuroimaging data viewer
winFactory.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_WINDOW_WINFACTORY
36#define ANA_WINDOW_WINFACTORY
37
38
39#include <cartobase/object/object.h>
40
41
42namespace anatomist
43{
44
45 class AWindow;
46
49 {
50 public:
51 virtual ~AWindowCreator();
52 virtual AWindow* operator() ( void *dock, carto::Object ) const = 0;
53 };
54
55
60 {
61 public:
62 typedef AWindow* (*WinCreator)( void *dock, carto::Object );
63
64 //AWindowFactory();
65 //virtual ~AWindowFactory();
66
67 static AWindow* createWindow( const std::string & type, void *dock = 0,
68 carto::Object params = carto::none() );
69 static AWindow* createWindow( int type, void *dock = 0,
70 carto::Object params = carto::none() );
71 static bool initTypes();
72 static std::string typeString( int type, int subtype = 0 );
73 static int typeID( const std::string & type );
74 static bool exist( int type );
75 static bool exist( const std::string & type );
76 static int registerType( const std::string & type, WinCreator creator,
77 bool visibleinCtrlWin=false );
78 static int registerType( const std::string & type, AWindowCreator *c,
79 bool visibleinCtrlWin=false );
80 static void unregisterType( const std::string & type );
81 static std::set<std::string> types();
82 static const std::map<std::string, int> & typeID() { return( TypeID ); }
83 static const std::map<int, std::string> & typeNames()
84 { return( TypeNames ); }
85 static const std::map<int, carto::rc_ptr<AWindowCreator> > & creators()
86 { return( Creators ); }
87 static bool hasControlWindowButton( int type );
88 static void setHasControlWindowButton( int type, bool visible );
89
90 protected:
91 static AWindow* createAxial( void *, carto::Object );
94 static AWindow* create3D( void *, carto::Object );
95 static void applyCommonOptions( AWindow* win, carto::Object params );
96
97 static std::map<int, std::string> TypeNames;
98 static std::map<std::string, int> TypeID;
99 static std::map<int, carto::rc_ptr<AWindowCreator> > Creators;
100 static std::set<int> CtrlWinVisibleTypes;
101
102 friend class StaticInitializers;
103
104 private:
105 };
106
107
110 {
111 public:
113 : _func( func ) {}
115
116 virtual AWindow* operator() ( void *dock, carto::Object ) const;
117
118 private:
120 };
121
122}
123
124
125#endif
AWindowCreatorFunc(AWindowFactory::WinCreator func)
Definition winFactory.h:112
virtual AWindow * operator()(void *dock, carto::Object) const
Virtual functor for AWindowFactory.
Definition winFactory.h:49
virtual AWindow * operator()(void *dock, carto::Object) const =0
Window creator: (string) type -> new window.
Definition winFactory.h:60
static std::map< std::string, int > TypeID
Definition winFactory.h:98
static std::set< std::string > types()
static AWindow * createWindow(const std::string &type, void *dock=0, carto::Object params=carto::none())
static void unregisterType(const std::string &type)
AWindow *(* WinCreator)(void *dock, carto::Object)
Definition winFactory.h:62
static std::set< int > CtrlWinVisibleTypes
Definition winFactory.h:100
static AWindow * createSagittal(void *, carto::Object)
friend class StaticInitializers
Definition winFactory.h:102
static std::map< int, carto::rc_ptr< AWindowCreator > > Creators
Definition winFactory.h:99
static int registerType(const std::string &type, AWindowCreator *c, bool visibleinCtrlWin=false)
static AWindow * create3D(void *, carto::Object)
static bool exist(int type)
static bool exist(const std::string &type)
static int typeID(const std::string &type)
static std::string typeString(int type, int subtype=0)
static const std::map< int, std::string > & typeNames()
Definition winFactory.h:83
static int registerType(const std::string &type, WinCreator creator, bool visibleinCtrlWin=false)
static std::map< int, std::string > TypeNames
Definition winFactory.h:97
static AWindow * createCoronal(void *, carto::Object)
static const std::map< std::string, int > & typeID()
Definition winFactory.h:82
static bool hasControlWindowButton(int type)
static const std::map< int, carto::rc_ptr< AWindowCreator > > & creators()
Definition winFactory.h:85
static AWindow * createAxial(void *, carto::Object)
static AWindow * createWindow(int type, void *dock=0, carto::Object params=carto::none())
static void setHasControlWindowButton(int type, bool visible)
static void applyCommonOptions(AWindow *win, carto::Object params)
Abstract base class Anatomist window.
Definition Window.h:59
Object none()