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 <QtCore/QEvent>
16 #include <ktabwidget.h>
17 #include <kxmlguiclient.h>
18 #include <kparts/part.h>
19 #include <kparts/partmanager.h>
28 class DockMainWindow3;
31 /* ID of user defined event */
32 const int EVENT_CloseTab = QEvent::User + 100;
33 const int EVENT_ShowDock = QEvent::User + 101;
34 const int EVENT_FitImageToWinEvent = QEvent::User + 102;
35 const int EVENT_CancelMoszicEvent = QEvent::User + 103;
39 class KDE_EXPORT TabWidgetBase : public KTabWidget, public KXMLGUIClient
44 KParts::PartManager* m_manager;
48 explicit TabWidgetBase(QWidget* parent = 0);
49 virtual ~TabWidgetBase();
52 void slotCurrentChanged(QWidget* w);
53 void slotCloseTab(int num);
57 virtual void customEvent(QEvent * e);
58 virtual void deleteWidget(QWidget* w);
59 KParts::Part* findPartFromWidget(QWidget* w);
61 /*------------------------------------*/
62 /* common tab actions */
66 TabWidgetBase(const TabWidgetBase&);
67 TabWidgetBase& operator=(const TabWidgetBase&);
70 void slotConfigureKeys();
73 void slotCloseCurrentTab();
74 void slotCloseOtherTab(int idx = -1);
75 void slotCloseRightTab(int idx = -1);
76 void slotCloseLeftTab(int idx = -1);
77 void slotCloseAllTab();
80 /* user defined events */
81 class CloseTabEvent : public QEvent
87 CloseTabEvent(int idx)
88 : QEvent(QEvent::Type(EVENT_CloseTab)), m_pageindex(idx) {}
90 int getIndex() const { return m_pageindex; }
94 class ShowDockEvent : public QEvent
100 ShowDockEvent(bool activate, bool force) : QEvent(QEvent::Type(EVENT_ShowDock))
101 , m_activate(activate), m_force(force) {}
103 bool getActivate() const { return m_activate; }
104 bool getForce() const { return m_force; }