1/* This file is part of the KDE project
2 Copyright (C) 1999 Simon Hausmann <hausmann@kde.org>
3 (C) 1999 David Faure <faure@kde.org>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20#ifndef __MAINWINDOW_H
21#define __MAINWINDOW_H
22
23#include <kaction.h>
24
25#include <kxmlguiwindow.h>
26
27#include <kparts/part.h>
28
29class QString;
30
31namespace KParts
32{
33
34class MainWindowPrivate;
35
36/**
37 * A KPart-aware main window, whose user interface is described in XML.
38 *
39 * Inherit your main window from this class
40 * and don't forget to call setXMLFile() in the inherited constructor.
41 *
42 * It implements all internal interfaces in the case of a
43 * KMainWindow as host: the builder and servant interface (for menu
44 * merging).
45 */
46class KPARTS_EXPORT MainWindow : public KXmlGuiWindow, virtual public PartBase
47{
48 Q_OBJECT
49 public:
50 /**
51 * Constructor, same signature as KMainWindow.
52 */
53 explicit MainWindow( QWidget* parent = 0, Qt::WindowFlags f = KDE_DEFAULT_WINDOWFLAGS );
54 /// @deprecated, remove the name argument and use setObjectName instead
55#ifndef KDE_NO_DEPRECATED
56 KDE_CONSTRUCTOR_DEPRECATED explicit MainWindow( QWidget* parent, const char *name = 0, Qt::WindowFlags f = KDE_DEFAULT_WINDOWFLAGS );
57#endif
58 /**
59 * Destructor.
60 */
61 virtual ~MainWindow();
62
63public Q_SLOTS:
64 virtual void configureToolbars();
65
66protected Q_SLOTS:
67
68 /**
69 * Create the GUI (by merging the host's and the active part's)
70 * You _must_ call this in order to see any GUI being created.
71 *
72 * In a main window with multiple parts being shown (e.g. as in Konqueror)
73 * you need to connect this slot to the
74 * KPartManager::activePartChanged() signal
75 *
76 * @param part The active part (set to 0L if no part).
77 */
78 void createGUI( KParts::Part * part );
79
80 /**
81 * Called when the active part wants to change the statusbar message
82 * Reimplement if your mainwindow has a complex statusbar
83 * (with several items)
84 */
85 virtual void slotSetStatusBarText( const QString & );
86
87 /**
88 * Rebuilds the GUI after KEditToolbar changed the toolbar layout.
89 * @see configureToolbars()
90 * KDE4: make this virtual. (For now we rely on the fact that it's called
91 * as a slot, so the metaobject finds it here).
92 */
93 void saveNewToolbarConfig();
94
95protected:
96 virtual void createShellGUI( bool create = true );
97
98private:
99 MainWindowPrivate* const d;
100};
101
102}
103
104#endif
105