1
/***************************************************************************
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)
9
***************************************************************************/
11
/***************************************************************************
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. *
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. *
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 *
28
***************************************************************************/
29
#ifndef ABSTRACT_PART_H
30
#define ABSTRACT_PART_H
32
#include "AbstractAspect.h"
38
//! Base class of Aspects with MDI windows as views.
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).
43
class AbstractPart : public AbstractAspect
49
AbstractPart(const QString &name) : AbstractAspect(name), d_mdi_window(0) {}
50
//! Construct a primary view on me.
52
* The caller recieves ownership of the view.
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.
57
virtual QWidget * view() = 0;
58
//! Wrap the view() into a PartMdiView.
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.
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
68
* \return true on success, otherwise false (e.g. part has no actions).
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
73
* \return true on success, otherwise false (e.g. part has no actions to be shown in a toolbar).
75
virtual bool fillProjectToolBar(QToolBar * bar) { Q_UNUSED(bar); return false; }
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() {};
86
//! The MDI sub-window that is wrapped around my primary view.
87
PartMdiView *d_mdi_window;
90
#endif // ifndef ABSTRACT_PART_H