Add (and install) svg for the new krunner interface.
[kdebase/uwolfer.git] / apps / konqueror / src / konqframe.h
blobbd02a8df363c4e811ecd1ebdcb77f641350df5c4
1 /* This file is part of the KDE project
2 Copyright (C) 1998, 1999 Michael Reiher <michael.reiher@gmx.de>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 #ifndef __konq_frame_h__
20 #define __konq_frame_h__
22 #include "konqfactory.h"
23 #include <kparts/part.h> // for the inline QPointer usage
25 #include <QtCore/QPointer>
26 #include <QtGui/QColor>
27 #include <QtGui/QWidget>
28 #include <QtGui/QCheckBox>
29 #include <QtGui/QLabel>
30 #include <QtGui/QPixmap>
31 #include <QtGui/QKeyEvent>
32 #include <QtCore/QEvent>
33 #include <QtCore/QList>
35 #include <KConfig>
37 class KonqFrameStatusBar;
38 class KonqFrameVisitor;
39 class QPixmap;
40 class QVBoxLayout;
41 class QProgressBar;
43 class KonqView;
44 class KonqViewManager;
45 class KonqFrameBase;
46 class KonqFrame;
47 class KonqFrameContainerBase;
48 class KonqFrameContainer;
49 class KConfig;
50 class KSeparator;
51 class KSqueezedTextLabel;
53 namespace KParts
55 class ReadOnlyPart;
58 typedef QList<KonqView*> ChildViewList;
60 class KonqFrameBase
62 public:
63 enum Option {
64 None = 0x0,
65 saveURLs = 0x1,
66 saveHistoryItems = 0x02
68 Q_DECLARE_FLAGS(Options, Option)
70 virtual ~KonqFrameBase() {}
72 virtual bool isContainer() const = 0;
74 virtual bool accept( KonqFrameVisitor* visitor ) = 0;
76 virtual void saveConfig( KConfigGroup& config, const QString &prefix, const KonqFrameBase::Options &options, KonqFrameBase* docContainer, int id = 0, int depth = 0) = 0;
78 virtual void copyHistory( KonqFrameBase *other ) = 0;
80 KonqFrameContainerBase* parentContainer() const { return m_pParentContainer; }
81 void setParentContainer(KonqFrameContainerBase* parent) { m_pParentContainer = parent; }
83 virtual void setTitle( const QString &title , QWidget* sender) = 0;
84 virtual void setTabIcon( const KUrl &url, QWidget* sender ) = 0;
86 virtual QWidget* asQWidget() = 0;
88 virtual QByteArray frameType() = 0;
90 virtual void activateChild() = 0;
92 virtual KonqView* activeChildView() const = 0;
94 protected:
95 KonqFrameBase() {}
97 KonqFrameContainerBase* m_pParentContainer;
100 Q_DECLARE_OPERATORS_FOR_FLAGS ( KonqFrameBase::Options )
103 * The KonqFrame is the actual container for the views. It takes care of the
104 * widget handling i.e. it attaches/detaches the view widget and activates
105 * them on click at the statusbar.
107 * We create a vertical layout in the frame, with the view and the KonqFrameStatusBar.
110 class KonqFrame : public QWidget, public KonqFrameBase
112 Q_OBJECT
114 public:
115 explicit KonqFrame( QWidget* parent, KonqFrameContainerBase *parentContainer = 0 );
116 virtual ~KonqFrame();
118 virtual bool isContainer() const { return false; }
120 virtual bool accept( KonqFrameVisitor* visitor );
123 * Attach a view to the KonqFrame.
124 * @param viewFactory the view to attach (instead of the current one, if any)
126 KParts::ReadOnlyPart *attach( const KonqViewFactory &viewFactory );
129 * Filters the CTRL+Tab event from the views and emits ctrlTabPressed to
130 make KonqMainWindow switch to the next view
132 virtual bool eventFilter(QObject*obj, QEvent *ev);
135 * Inserts the widget and the statusbar into the layout
137 void attachWidget(QWidget* widget);
140 * Inserts a widget at the top of the part's widget, in the layout
141 * (used for the find functionality)
143 void insertTopWidget( QWidget * widget );
146 * Returns the part that is currently connected to the Frame.
148 KParts::ReadOnlyPart *part() { return m_pPart; }
150 * Returns the view that is currently connected to the Frame.
152 KonqView* childView() const;
154 bool isActivePart();
156 void setView( KonqView* child );
158 virtual void saveConfig( KConfigGroup& config, const QString &prefix, const KonqFrameBase::Options &options, KonqFrameBase* docContainer, int id = 0, int depth = 0 );
159 virtual void copyHistory( KonqFrameBase *other );
161 virtual void setTitle( const QString &title, QWidget* sender );
162 virtual void setTabIcon( const KUrl &url, QWidget* sender );
164 virtual QWidget* asQWidget() { return this; }
165 virtual QByteArray frameType() { return QByteArray("View"); }
167 QVBoxLayout *layout()const { return m_pLayout; }
169 KonqFrameStatusBar *statusbar() const { return m_pStatusBar; }
171 virtual void activateChild();
173 virtual KonqView* activeChildView() const;
175 QString title() const { return m_title; }
177 public Q_SLOTS:
180 * Is called when the frame statusbar has been clicked
182 void slotStatusBarClicked();
184 void slotLinkedViewClicked( bool mode );
187 * Is called when 'Remove View' is called from the popup menu
189 void slotRemoveView();
191 protected:
192 virtual void paintEvent( QPaintEvent* );
194 private:
195 QVBoxLayout *m_pLayout;
196 QPointer<KonqView> m_pView;
198 QPointer<KParts::ReadOnlyPart> m_pPart;
200 KSeparator *m_separator;
201 KonqFrameStatusBar* m_pStatusBar;
203 QString m_title;
206 #endif