Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

ActionExtension.h 2.95 KB
Newer Older
1
/*****************************************************************************
2
3
4
 * $CAMITK_LICENCE_BEGIN$
 *
 * CamiTK - Computer Assisted Medical Intervention ToolKit
promayon's avatar
promayon committed
5
 * (c) 2001-2014 UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 *
 * Visit http://camitk.imag.fr for more information
 *
 * This file is part of CamiTK.
 *
 * CamiTK is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License version 3
 * only, as published by the Free Software Foundation.
 *
 * CamiTK is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License version 3 for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3 along with CamiTK.  If not, see <http://www.gnu.org/licenses/>.
 *
 * $CAMITK_LICENCE_END$
 ****************************************************************************/
25
26
27
28
29
30
31


#ifndef ACTION_EXTENSION_H
#define ACTION_EXTENSION_H


#include "CamiTKAPI.h"
32

33
34
35
36
37
38
39
// -- QT stuff
#include <QtPlugin>
#include <QPluginLoader>
#include <QObject>

namespace camitk
{
40
41
class Action;
    
42
// a bit simplistic, but greatly simply syntax (and explanation)
43
44
45
// to be used in an ActionExtension register method
#define registerNewAction(X) registerAction(new X(this))

46
47
/** This class describes what is a generic Action extension.
* To add a ActionExtension to CamiTK core, write a new class that inherits from this class.
48
* 
49
* The following methods HAVE to be redefined in your subclass:
50
51
52
53
54
* - getName: return the name of your extension
* - getDescription: return a small description
* - init: a simple enough method, just call registerNewAction(MyAction) for any
*   MyAction class inheriting from camitk::Action
*
55
* @see BasicMeshExtension For an example of an extension registering more than one actions
56
57
58
59
60
*/
class CAMITK_API ActionExtension : public QObject {

protected :
    /// constructor
61
    ActionExtension() {};
62
63
64

public :
    /// destructor
65
    virtual ~ActionExtension();
66

67
    /// returns the action extension name (to be overriden in your ActionExtension)
68
69
    virtual QString getName() = 0;

70
    /// returns the action extension small description (to be overriden in your ActionExtension)
71
    virtual QString getDescription() = 0;
72
73
74

    /// this method should just call registerNewAction(MyAction) for any MyAction class you need to register by this extension
    virtual void init() = 0;
75
76
77

    /// get the list of actions registered y this extension
    const ActionList & getActions();
78
79
80
81
    
protected:
    /// register an action instance
    void registerAction(Action *);
82
83
84

    /// the list of actions
    ActionList actions;
85
86
87
88
};

}
// -------------------- declare the interface for QPluginLoader --------------------
89
Q_DECLARE_INTERFACE(camitk::ActionExtension, "TIMC-IMAG. Action Extension/2.1") //TODO use variable from CMake?
90
91
92


#endif //ACTION_EXTENSION_H