~valavanisalex/ubuntu/maverick/scidavis/fix-604811

« back to all changes in this revision

Viewing changes to scidavis/src/future/core/AbstractPart.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                 : AbstractPart.h
 
3
    Project              : SciDAVis
 
4
    Description          : Base class of Aspects with MDI windows as views.
 
5
    --------------------------------------------------------------------
 
6
    Copyright            : (C) 2008-2009 Knut Franke (knut.franke*gmx.de)
 
7
                           (replace * with @ in the email address)
 
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 ABSTRACT_PART_H
 
30
#define ABSTRACT_PART_H
 
31
 
 
32
#include "AbstractAspect.h"
 
33
 
 
34
class PartMdiView;
 
35
class QMenu;
 
36
class QToolBar;
 
37
 
 
38
//! Base class of Aspects with MDI windows as views.
 
39
/**
 
40
 * SciDAVis's Parts are somewhat similar to KDE's KParts in that they are independent application
 
41
 * components running on top of a kernel (a bit like KOffice's shell).
 
42
 */
 
43
class AbstractPart : public AbstractAspect
 
44
{
 
45
        Q_OBJECT
 
46
 
 
47
        public:
 
48
                //! Constructor.
 
49
                AbstractPart(const QString &name) : AbstractAspect(name), d_mdi_window(0) {}
 
50
                //! Construct a primary view on me.
 
51
                /**
 
52
                 * The caller recieves ownership of the view.
 
53
                 *
 
54
                 * This method may be called multiple times during the life time of a Part, or it might not get
 
55
                 * called at all. Parts must not depend on the existence of a view for their operation.
 
56
                 */
 
57
                virtual QWidget * view() = 0;
 
58
                //! Wrap the view() into a PartMdiView.
 
59
                /**
 
60
                 * A new view is only created the first time this method is called;
 
61
                 * after that, a pointer to the pre-existing view is returned.
 
62
                 */
 
63
                PartMdiView * mdiSubWindow();
 
64
                //! Return AbstractAspect::createContextMenu() plus operations on the primary view.
 
65
                virtual QMenu * createContextMenu() const;
 
66
                //! Fill the part specific menu for the main window including setting the title
 
67
                /**
 
68
                 * \return true on success, otherwise false (e.g. part has no actions).
 
69
                 */
 
70
                virtual bool fillProjectMenu(QMenu * menu) { Q_UNUSED(menu); return false; }
 
71
                //! Fill the part specific tool bar for the main window including setting the title
 
72
                /**
 
73
                 * \return true on success, otherwise false (e.g. part has no actions to be shown in a toolbar).
 
74
                 */
 
75
                virtual bool fillProjectToolBar(QToolBar * bar) { Q_UNUSED(bar); return false; }
 
76
 
 
77
        public slots:
 
78
                //! Copy current selection.
 
79
                virtual void copy() {};
 
80
                //! Cut current selection.
 
81
                virtual void cut() {};
 
82
                //! Paste at the current location or into the current selection.
 
83
                virtual void paste() {};
 
84
 
 
85
        private:
 
86
                //! The MDI sub-window that is wrapped around my primary view.
 
87
                PartMdiView *d_mdi_window;
 
88
};
 
89
 
 
90
#endif // ifndef ABSTRACT_PART_H