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,
25 #include "konqframe.h"
26 #include "konqframecontainer.h"
28 #include <ktabwidget.h>
29 #include <QtGui/QKeyEvent>
30 #include <QtCore/QList>
36 class KonqViewManager
;
37 class KonqFrameContainerBase
;
38 class KonqFrameContainer
;
41 class KonqFrameTabs
: public KTabWidget
, public KonqFrameContainerBase
44 friend class KonqFrame
; //for emitting ctrlTabPressed() only, aleXXX
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"); }
68 * Insert a new frame into the container.
70 void insertChildFrame(KonqFrameBase
* frame
, int index
= -1);
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
);
85 void slotCurrentChanged( QWidget
* newPage
);
86 void setAlwaysTabbedMode( bool );
89 void ctrlTabPressed();
90 void removeTabPopup();
93 void refreshSubPopupMenuTab();
94 void updateTabBarVisibility();
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;
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 );
118 QList
<KonqFrameBase
*> m_childFrameList
;
120 KonqViewManager
* m_pViewManager
;
122 QMenu
* m_pSubPopupMenuTab
;
123 QToolButton
* m_rightWidget
;
124 QToolButton
* m_leftWidget
;
125 bool m_permanentCloseButtons
;
127 bool m_MouseMiddleClickClosesTab
;
128 int m_closeOtherTabsId
;
130 friend class KonqTabsStyle
;