Make a branch to make krunner Good Enough For Aaron™.
[kdebase/uwolfer.git] / apps / konqueror / src / konqtabs.h
blob9730eb98b4462b29346632343784868739ce6f46
1 /* This file is part of the KDE project
3 Copyright (C) 2002-2003 Konqueror Developers <konq-e@kde.org>
4 Copyright (C) 2002-2003 Douglas Hanley <douglash@caltech.edu>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 MA 02110-1301, USA.
22 #ifndef KONQTABS_H
23 #define KONQTABS_H
25 #include "konqframe.h"
26 #include "konqframecontainer.h"
28 #include <ktabwidget.h>
29 #include <QtGui/QKeyEvent>
30 #include <QtCore/QList>
32 class QMenu;
33 class QToolButton;
35 class KonqView;
36 class KonqViewManager;
37 class KonqFrameContainerBase;
38 class KonqFrameContainer;
39 class KConfig;
41 class KonqFrameTabs : public KTabWidget, public KonqFrameContainerBase
43 Q_OBJECT
44 friend class KonqFrame; //for emitting ctrlTabPressed() only, aleXXX
46 public:
47 KonqFrameTabs(QWidget* parent, KonqFrameContainerBase* parentContainer,
48 KonqViewManager* viewManager);
49 virtual ~KonqFrameTabs();
51 virtual bool accept( KonqFrameVisitor* visitor );
53 virtual void saveConfig( KConfigGroup& config, const QString &prefix, const KonqFrameBase::Options &options,
54 KonqFrameBase* docContainer, int id = 0, int depth = 0 );
55 virtual void copyHistory( KonqFrameBase *other );
57 const QList<KonqFrameBase*>& childFrameList() const { return m_childFrameList; }
59 virtual void setTitle( const QString &title, QWidget* sender );
60 virtual void setTabIcon( const KUrl &url, QWidget* sender );
62 virtual QWidget* asQWidget() { return this; }
63 virtual QByteArray frameType() { return QByteArray("Tabs"); }
65 void activateChild();
67 /**
68 * Insert a new frame into the container.
70 void insertChildFrame(KonqFrameBase * frame, int index = -1);
72 /**
73 * Call this before deleting one of our children.
75 void childFrameRemoved( KonqFrameBase * frame );
77 virtual void replaceChildFrame(KonqFrameBase* oldFrame, KonqFrameBase* newFrame);
79 void moveTabBackward(int index);
80 void moveTabForward(int index);
82 void setLoading(KonqFrameBase* frame, bool loading);
84 public Q_SLOTS:
85 void slotCurrentChanged( QWidget* newPage );
86 void setAlwaysTabbedMode( bool );
88 Q_SIGNALS:
89 void ctrlTabPressed();
90 void removeTabPopup();
92 private:
93 void refreshSubPopupMenuTab();
94 void updateTabBarVisibility();
95 void initPopupMenu();
96 /**
97 * Returns the index position of the tab where the frame @p frame is, assuming that
98 * it's the active frame in that tab,
99 * or -1 if the frame is not in the tab widget or it's not active.
101 int tabWhereActive(KonqFrameBase* frame) const;
103 private Q_SLOTS:
104 void slotContextMenu( const QPoint& );
105 void slotContextMenu( QWidget*, const QPoint& );
106 void slotCloseRequest( QWidget* );
107 void slotMovedTab( int, int );
108 void slotMouseMiddleClick();
109 void slotMouseMiddleClick( QWidget* );
111 void slotTestCanDecode(const QDragMoveEvent *e, bool &accept /* result */);
112 void slotReceivedDropEvent( QDropEvent* );
113 void slotInitiateDrag( QWidget * );
114 void slotReceivedDropEvent( QWidget *, QDropEvent * );
115 void slotSubPopupMenuTabActivated( int );
117 private:
118 QList<KonqFrameBase*> m_childFrameList;
120 KonqViewManager* m_pViewManager;
121 QMenu* m_pPopupMenu;
122 QMenu* m_pSubPopupMenuTab;
123 QToolButton* m_rightWidget;
124 QToolButton* m_leftWidget;
125 bool m_permanentCloseButtons;
126 bool m_alwaysTabBar;
127 bool m_MouseMiddleClickClosesTab;
128 int m_closeOtherTabsId;
130 friend class KonqTabsStyle;
133 #endif // KONQTABS_H