1 /***************************************************************************
2 * Copyright (C) 2003 by Hideki Ikemoto, 2004 by 421 *
3 * ikemo@users.sourceforge.jp *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 ***************************************************************************/
11 #ifndef KITATABWIDGETBASE_H
12 #define KITATABWIDGETBASE_H
14 #include <ktabwidget.h>
15 #include <kxmlguiclient.h>
16 #include <kparts/partmanager.h>
17 #include <kparts/browserextension.h>
21 #include <kdockwidget.h>
36 /* ID of user defined event */
37 #define EVENT_CloseTab ( QEvent::User + 100 )
38 #define EVENT_ShowDock ( QEvent::User + 101 )
39 #define EVENT_FitImageToWinEvent ( QEvent::User + 102 )
40 #define EVENT_CancelMoszicEvent ( QEvent::User + 103 )
44 /*-----------------------------------------------*/
47 class KitaTabWidgetBase : public KTabWidget, public KXMLGUIClient
52 KParts::PartManager* m_manager;
56 KitaTabWidgetBase( QWidget* parent = 0, const char* name = 0, WFlags f = 0 );
57 virtual ~KitaTabWidgetBase();
60 void slotCurrentChanged( QWidget* w );
61 void slotShowPart( const KURL&, const QString&, const QString& );
62 void slotCloseTab( int num );
66 virtual void customEvent( QCustomEvent * e );
67 virtual void deleteWidget( QWidget* w );
68 KParts::Part* findPartFromWidget( QWidget* w );
72 void connectSignals();
76 /*------------------------------------*/
77 /* common tab actions */
83 void slotConfigureKeys();
86 void slotCloseCurrentTab();
87 void slotCloseOtherTab( int idx = -1 );
88 void slotCloseRightTab( int idx = -1 );
89 void slotCloseLeftTab( int idx = -1 );
90 void slotCloseAllTab();
93 void openURLRequestExt( const KURL& url, const QString mimetype = QString::null );
97 /*-------------------------------------------------*/
99 class KitaDockWidgetBase : public KDockWidget
106 bool m_closeButtonClicked;
107 KParts::DockMainWindow* m_parentDock;
108 QDict<KDockWidget>* m_dockDict;
111 KitaDockWidgetBase( KDockManager* dockManager,
113 const QPixmap &pixmap,
114 QWidget* parent = 0L,
115 const QString& strCaption = QString::null,
116 const QString& strTabPageLabel = QString::fromLatin1( " " ),
118 ~KitaDockWidgetBase();
120 void showDock( bool active = TRUE, bool force = TRUE );
123 void setSession( bool docked, bool tabbed );
127 void slotShowPart( const KURL&, const QString&, const QString& );
128 void slotShowDock( bool activate = TRUE , bool force = TRUE );
130 void slotToggleShowHide();
134 void windowActivationChange( bool );
135 virtual void closeEvent( QCloseEvent* e );
136 virtual void customEvent( QCustomEvent * e );
140 void slotSaveDocStatus();
141 void slotHeaderCloseButtonClicked();
144 void windowDeactivated();
145 void checkToggleAction( bool );
150 /*------------------------------------------------------------------*/
152 /* user defined events */
154 class CloseTabEvent : public QCustomEvent
160 CloseTabEvent( int idx )
161 : QCustomEvent( EVENT_CloseTab ), m_pageindex( idx ) {}
163 const int getIndex() const { return m_pageindex; }
167 class ShowDockEvent : public QCustomEvent
173 ShowDockEvent( bool activate, bool force ) : QCustomEvent( EVENT_ShowDock )
174 , m_activate( activate ), m_force( force ) {}
176 const bool getActivate() const { return m_activate; }
177 const bool getForce() const { return m_force; }