~ubuntu-branches/ubuntu/maverick/scidavis/maverick

« back to all changes in this revision

Viewing changes to scidavis/src/future/core/interfaces.h

  • Committer: Bazaar Package Importer
  • Author(s): Ruben Molina
  • Date: 2009-09-06 11:34:04 UTC
  • Revision ID: james.westby@ubuntu.com-20090906113404-4awaey82l3686w4q
Tags: upstream-0.2.3
ImportĀ upstreamĀ versionĀ 0.2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
    File                 : interfaces.h
 
3
    Project              : SciDAVis
 
4
    --------------------------------------------------------------------
 
5
    Copyright            : (C) 2008-2009 by Knut Franke
 
6
    Email (use @ for *)  : knut.franke*gmx.de
 
7
    Description          : Interfaces the kernel uses to talk to modules
 
8
 
 
9
 ***************************************************************************/
 
10
 
 
11
/***************************************************************************
 
12
 *                                                                         *
 
13
 *  This program is free software; you can redistribute it and/or modify   *
 
14
 *  it under the terms of the GNU General Public License as published by   *
 
15
 *  the Free Software Foundation; either version 2 of the License, or      *
 
16
 *  (at your option) any later version.                                    *
 
17
 *                                                                         *
 
18
 *  This program is distributed in the hope that it will be useful,        *
 
19
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
 
20
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
 
21
 *  GNU General Public License for more details.                           *
 
22
 *                                                                         *
 
23
 *   You should have received a copy of the GNU General Public License     *
 
24
 *   along with this program; if not, write to the Free Software           *
 
25
 *   Foundation, Inc., 51 Franklin Street, Fifth Floor,                    *
 
26
 *   Boston, MA  02110-1301  USA                                           *
 
27
 *                                                                         *
 
28
 ***************************************************************************/
 
29
#ifndef INTERFACES_H
 
30
#define INTERFACES_H
 
31
 
 
32
#include "lib/ConfigPageWidget.h"
 
33
#include "core/AbstractAspect.h"
 
34
#include "lib/XmlStreamReader.h"
 
35
 
 
36
#include <QtPlugin>
 
37
 
 
38
class AbstractPart;
 
39
class QAction;
 
40
class QMenu;
 
41
class ProjectWindow;
 
42
class AbstractFilter;
 
43
class AbstractImportFilter;
 
44
class AbstractExportFilter;
 
45
class ActionManager;
 
46
 
 
47
//! Factory for AbstractPart objects.
 
48
class PartMaker
 
49
{
 
50
        public:
 
51
                virtual ~PartMaker() {}
 
52
                //! The factory method.
 
53
                virtual AbstractPart *makePart() = 0;
 
54
                //! The action to be used for making new parts.
 
55
                /**
 
56
                 * The caller takes care of connecting the action. If the parent argument is zero, it
 
57
                 * also recieves ownership of the action.
 
58
                 * Implementations should only set things like name and icon.
 
59
                 */
 
60
                virtual QAction *makeAction(QObject *parent) = 0;
 
61
};
 
62
 
 
63
Q_DECLARE_INTERFACE(PartMaker, "net.sf.scidavis.partmaker/0.1")
 
64
 
 
65
//! Factory for filters.
 
66
/**
 
67
 * A FilterMaker introduces one or more filters to the kernel.
 
68
 */
 
69
class FilterMaker
 
70
{
 
71
        public:
 
72
                virtual ~FilterMaker() {}
 
73
                virtual AbstractFilter * makeFilter(int id=0) = 0;
 
74
                virtual int filterCount() const { return 1; }
 
75
                virtual QAction *makeAction(QObject *parent, int id=0) = 0;
 
76
};
 
77
 
 
78
Q_DECLARE_INTERFACE(FilterMaker, "net.sf.scidavis.filtermaker/0.1")
 
79
 
 
80
//! Factory for import/export filters.
 
81
class FileFormat
 
82
{
 
83
        public:
 
84
                virtual ~FileFormat() {}
 
85
                virtual AbstractImportFilter * makeImportFilter() = 0;
 
86
                virtual AbstractExportFilter * makeExportFilter() = 0;
 
87
};
 
88
 
 
89
Q_DECLARE_INTERFACE(FileFormat, "net.sf.scidavis.fileformat/0.1")
 
90
 
 
91
//! A module (typically a PartMaker) that has an ActionManager
 
92
class ActionManagerOwner
 
93
{
 
94
        public:
 
95
                //! Return the action manager of the module
 
96
                virtual ActionManager * actionManager() = 0;
 
97
                //! Method that contains initialization that has to be done after loading the plugin
 
98
                virtual void initActionManager() {}
 
99
};
 
100
 
 
101
Q_DECLARE_INTERFACE(ActionManagerOwner, "net.sf.scidavis.actionmanagerowner/0.1")
 
102
 
 
103
//! A module with application-wide settings
 
104
class ConfigPageMaker {
 
105
        public:
 
106
                virtual ConfigPageWidget * makeConfigPage() = 0;
 
107
                virtual QString configPageLabel() = 0;
 
108
                virtual void loadSettings() = 0;
 
109
                virtual void saveSettings() = 0;
 
110
                // TODO (maybe): icons instead of tabs to select the pages
 
111
                //              virtual QIcon icon() = 0;
 
112
};
 
113
 
 
114
Q_DECLARE_INTERFACE(ConfigPageMaker, "net.sf.scidavis.configpagemaker/0.1")
 
115
 
 
116
//! Factory that creates an aspect out of an XML element.
 
117
class XmlElementAspectMaker
 
118
{
 
119
        public:
 
120
                virtual ~XmlElementAspectMaker() {}
 
121
                //! Determine whether the loader can handle the given element.
 
122
                virtual bool canCreate(const QString & element_name) = 0;
 
123
                //! The factory method.
 
124
                virtual AbstractAspect * createAspectFromXml(XmlStreamReader * reader) = 0;
 
125
};
 
126
 
 
127
Q_DECLARE_INTERFACE(XmlElementAspectMaker, "net.sf.scidavis.xmlelementaspectmaker/0.1")
 
128
 
 
129
#endif // ifndef INTERFACES_H