--- /dev/null
+/***************************************************************************
+* Copyright (C) 2004 by Hideki Ikemoto , (c) 2004 by 421 *
+* ikemo@users.sourceforge.jp *
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+***************************************************************************/
+
+/* Basic class of Tab widget, Tab bar, and Dock widget. */
+
+#include "kitatabwidgetbase.h"
+
+#include "libkita/kita_misc.h"
+#include "libkita/parsemisc.h"
+#include "libkita/signalcollection.h"
+#include "libkita/datmanager.h"
+
+#include <klibloader.h>
+#include <kpopupmenu.h>
+#include <kdebug.h>
+#include <kstdaccel.h>
+#include <kaction.h>
+#include <klocale.h>
+#include <kkeydialog.h>
+#include <kparts/dockmainwindow.h>
+#include <kparts/factory.h>
+#include <kdeversion.h>
+
+#include <qapplication.h>
+#include <qmessagebox.h>
+#include <qptrlist.h>
+
+#define MAX_TABLABEL_LEN 20
+
+
+/*--------------------------------------------------------------*/
+
+
+KitaTabWidgetBase::KitaTabWidgetBase( QWidget* parent, const char* name, WFlags f )
+ : QTabWidget( parent, name, f )
+{
+ connectSignals();
+ setupActions();
+
+ /* setup part manager */
+ m_manager = new KParts::PartManager( parent, this, "KitaPartManager" );
+ m_manager->addManagedTopLevelWidget( parent );
+}
+
+
+KitaTabWidgetBase::~KitaTabWidgetBase()
+{
+ KParts::Part * part;
+ while ( ( part = m_manager->parts()->getFirst() ) != NULL ){
+ m_manager->removePart( part );
+ removePage( part->widget() );
+ delete part;
+ }
+ delete m_manager;
+
+ QWidget* view = currentPage();
+ while( count() > 0 && view){
+ removePage( view );
+ delete view;
+ view = currentPage();
+ }
+}
+
+
+/* public slot */
+void KitaTabWidgetBase::slotCurrentChanged( QWidget * w )
+{
+ if( m_manager == NULL ) return;
+ if ( w == NULL ) return;
+ w->setActiveWindow();
+ w->setFocus();
+
+ KParts::Part* part = findPartFromWidget( w );
+ if( part ) {
+ m_manager->setActivePart( part );
+ }
+}
+
+
+/* show url with part. */ /* public slot */
+void KitaTabWidgetBase::slotShowPart( const KURL& url, const QString& libName, const QString& mimetype )
+{
+ if( m_manager == NULL ) return;
+
+ KLibFactory *factory = KLibLoader::self()->factory( libName );
+ if ( !factory ) {
+ QMessageBox::critical( parentWidget(), i18n( " Load Error" ),
+ QString( i18n( "can't load %1.") ).arg( libName ) );
+ return;
+ }
+
+ if ( factory->inherits( "KParts::Factory" ) ) {
+ KParts::Part *part
+ = static_cast< KParts::Factory* >( factory )->createPart( this );
+ m_manager->addPart( part );
+ addTab( part->widget(), getTabLabel( url.url() ) );
+ showPage( part->widget() );
+ setTabToolTip( currentPage(), url.url() );
+
+ KParts::BrowserExtension *ext = KParts::BrowserExtension::childObject( part );
+ if ( ext ) {
+ KParts::URLArgs arg( false, 0, 0, mimetype );
+ ext->setURLArgs( arg );
+ }
+
+ static_cast<KParts::ReadOnlyPart*>( part )->openURL( url );
+ }
+}
+
+
+/* close num-th tab */
+/* see also customEvent */ /* public slot */
+void KitaTabWidgetBase::slotCloseTab( int num )
+{
+ CloseTabEvent* e = new CloseTabEvent( num );
+ QApplication::postEvent( this, e ); // Qt will delete it when done
+}
+
+
+/* Calling deleteWidget in the child part will be the
+ cause of crash. So you need to call deleteWidget
+ via custom event. */ /* protected */ /* virtual */
+void KitaTabWidgetBase::customEvent( QCustomEvent * e )
+{
+ if ( e->type() == EVENT_CloseTab ) {
+ deleteWidget ( page( static_cast< CloseTabEvent* >( e )->getIndex() ) );
+ }
+}
+
+
+/* protected */ /* virtual */
+void KitaTabWidgetBase::deleteWidget( QWidget* w )
+{
+ if( w == NULL ) return;
+
+ removePage( w );
+ KParts::Part* part = findPartFromWidget( w );
+ if( part ) m_manager->removePart( part );
+ delete w;
+}
+
+
+/* protected */
+const QString KitaTabWidgetBase::getTabLabel( const QString &label )
+{
+ QString tmpstr = Kita::unescape( label );
+ QString newlabel = ( tmpstr.length() > MAX_TABLABEL_LEN )
+ ? tmpstr.left( MAX_TABLABEL_LEN ) + "..." : tmpstr;
+
+ return newlabel;
+}
+
+
+/* protected */
+KParts::Part* KitaTabWidgetBase::findPartFromWidget( QWidget* w )
+{
+ if( w == NULL ) return NULL;
+ if( m_manager == NULL ) return NULL;
+
+ KParts::Part *part;
+ QPtrListIterator<KParts::Part> it( *( m_manager->parts() ) );
+ while ( ( part = (*it) ) != NULL )
+ {
+ if ( part->widget() == w ) return part;
+ ++it;
+ }
+
+ return NULL;
+}
+
+
+/* private */
+void KitaTabWidgetBase::connectSignals()
+{
+ /* connect signals */
+ Kita::SignalCollection* signalCollection = Kita::SignalCollection::getInstance();
+
+ connect( this, SIGNAL( switchSubjectView() ),
+ signalCollection, SIGNAL( switchSubjectView() ));
+
+ connect( this, SIGNAL( switchToBoard() ),
+ signalCollection, SIGNAL( switchToBoard() ));
+
+ connect( this, SIGNAL( switchToSubject() ),
+ signalCollection, SIGNAL( switchToSubject() ));
+
+ connect( this, SIGNAL( switchToThread() ),
+ signalCollection, SIGNAL( switchToThread() ));
+
+ connect( this, SIGNAL( switchToKitanavi() ),
+ signalCollection, SIGNAL( switchToKitanavi() ));
+
+ connect( this, SIGNAL( switchToImgview() ),
+ signalCollection, SIGNAL( switchToImgview() ));
+
+ connect( this, SIGNAL( switchToWritedock() ),
+ signalCollection, SIGNAL( switchToWritedock() ));
+
+ connect( this, SIGNAL( currentChanged ( QWidget * ) ),
+ SLOT( slotCurrentChanged ( QWidget * ) ) );
+}
+
+
+/*------------------------------------*/
+/* common tab actions */
+
+
+/* private */
+void KitaTabWidgetBase::setupActions()
+{
+ actionCollection()->setWidget( this );
+
+
+ QString str = i18n( "Configure S&hortcuts..." ) + "(" +QString( name() ) +")";
+ new KAction( str,
+ 0,
+ this,
+ SLOT( slotConfigureKeys() ),
+ actionCollection(),
+ "tab_configkeys" );
+
+ new KAction( i18n("Activate Next Tab"),
+// KStdAccel::tabNext(), // KDE 3.1.x does not support this.
+ 0,
+ this,
+ SLOT( slotNextTab() ),
+ actionCollection(),
+ "tab_nexttab");
+
+ new KAction( i18n("Activate Previous Tab"),
+// KStdAccel::tabPrev(), // KDE 3.1.x does not support this.
+ 0,
+ this,
+ SLOT( slotPrevTab() ),
+ actionCollection(),
+ "tab_prevtab");
+
+ new KAction( i18n( "Close this tab" ),
+ KStdAccel::close(),
+ this,
+ SLOT( slotCloseCurrentTab() ),
+ actionCollection(),
+ "tab_closetab" );
+
+ new KAction( i18n( "Close Other Tabs" ),
+ 0,
+ this,
+ SLOT( slotCloseOtherTab() ),
+ actionCollection(),
+ "tab_closeothertab" );
+
+ new KAction( i18n( "Close right tabs" ),
+ 0,
+ this,
+ SLOT( slotCloseRightTab() ),
+ actionCollection(),
+ "tab_closerighttab" );
+
+ new KAction( i18n( "Close left tabs" ),
+ 0,
+ this,
+ SLOT( slotCloseLeftTab() ),
+ actionCollection(),
+ "tab_closelefttab" );
+
+ new KAction( i18n( "Close all tabs" ),
+ 0,
+ this,
+ SLOT( slotCloseAllTab() ),
+ actionCollection(),
+ "tab_closealltab" );
+
+ new KAction( i18n( "Switch to Board" ),
+ Key_1,
+ this,
+ SIGNAL( switchToBoard() ),
+ actionCollection(),
+ "tab_toboard" );
+
+ new KAction( i18n( "Switch to Subject" ),
+ Key_2,
+ this,
+ SIGNAL( switchToSubject() ),
+ actionCollection(),
+ "tab_tosubject" );
+
+ new KAction( i18n( "Switch to Thread" ),
+ Key_3,
+ this,
+ SIGNAL( switchToThread() ),
+ actionCollection(),
+ "tab_tothread" );
+
+ new KAction( i18n( "Switch to KitaNavi" ),
+ Key_4,
+ this,
+ SIGNAL( switchToKitanavi() ),
+ actionCollection(),
+ "tab_tokitanavi" );
+
+ new KAction( i18n( "Switch to Imgviewer" ),
+ Key_5,
+ this,
+ SIGNAL( switchToImgview() ),
+ actionCollection(),
+ "tab_toimgview" );
+
+ new KAction( i18n( "Switch to writedock" ),
+ Key_6,
+ this,
+ SIGNAL( switchToWritedock() ),
+ actionCollection(),
+ "tab_towritedock" );
+}
+
+
+
+/* public slot */
+void KitaTabWidgetBase::slotConfigureKeys()
+{
+ QString str = "Tab Actions (" +QString( name() ) +")";
+ KKeyDialog dlg( TRUE, this);
+ dlg.insert( actionCollection(), str );
+ dlg.configure();
+}
+
+
+/* public slot */
+void KitaTabWidgetBase::slotPrevTab()
+{
+ int max = count();
+ int curpage = currentPageIndex();
+ if( max <= 1 ) return;
+
+ if( curpage == 0 ) setCurrentPage( max-1 );
+ else setCurrentPage( curpage-1 );
+}
+
+/* public slot */
+void KitaTabWidgetBase::slotNextTab()
+{
+ int max = count();
+ int curpage = currentPageIndex();
+ if( max <= 1 ) return;
+
+ if( curpage == max-1 ) setCurrentPage( 0 );
+ else setCurrentPage( curpage+1 );
+}
+
+
+/* see also customEvent */ /* public slot */
+void KitaTabWidgetBase::slotCloseCurrentTab()
+{
+ slotCloseTab( currentPageIndex() );
+}
+
+
+/* see also customEvent */ /* public slot */
+void KitaTabWidgetBase::slotCloseOtherTab()
+{
+ int max = count();
+ if( max == 0 ) return;
+
+ int i = 0;
+
+ while( i < max && page( i ) != currentPage() ){
+ slotCloseTab( 0 );
+ i++;
+ }
+
+ i++;
+ while( i < max ){
+ slotCloseTab( 1 );
+ i++;
+ }
+}
+
+
+/* see also customEvent */ /* public slot */
+void KitaTabWidgetBase::slotCloseRightTab()
+{
+ int max = count();
+ if( max == 0 ) return;
+
+ int i, i2;
+
+ i = i2 = indexOf( currentPage() ) +1;
+ while( i < max ){
+ slotCloseTab( i2 );
+ i++;
+ }
+}
+
+
+/* see also customEvent */ /* public slot */
+void KitaTabWidgetBase::slotCloseLeftTab()
+{
+ int max = count();
+ if( max == 0 ) return;
+
+ int i = 0;
+
+ while( i < max && page( i ) != currentPage() ){
+ slotCloseTab( 0 );
+ i++;
+ }
+}
+
+
+/* see also customEvent */ /* public slot */
+void KitaTabWidgetBase::slotCloseAllTab()
+{
+ int max = count();
+ if( max == 0 ) return;
+
+ int i = 0;
+
+ while( i < max ){
+ slotCloseTab( 0 );
+ i++;
+ }
+}
+
+
+
+
+
+/*--------------------------------------------------------------------------------*/
+/*--------------------------------------------------------------------------------*/
+/*--------------------------------------------------------------------------------*/
+
+
+
+
+KitaTabBarBase::KitaTabBarBase( QWidget* parent, const char* name ) : QTabBar( parent, name ){}
+
+KitaTabBarBase::~KitaTabBarBase(){}
+
+
+/* protected */
+void KitaTabBarBase::plugDefaultActions( KPopupMenu* popup )
+{
+ KActionCollection * collection = static_cast<KitaTabWidgetBase*>( parentWidget() )->actionCollection();
+ collection->action( "tab_closetab" )->plug( popup );
+ collection->action( "tab_prevtab" )->plug( popup );
+ collection->action( "tab_nexttab" )->plug( popup );
+ popup->insertSeparator();
+ collection->action( "tab_closeothertab" )->plug( popup );
+ collection->action( "tab_closerighttab" )->plug( popup );
+ collection->action( "tab_closelefttab" )->plug( popup );
+ collection->action( "tab_closealltab" )->plug( popup );
+}
+
+
+/* popup menu */ /* protected */ /* virtual */
+void KitaTabBarBase::contextMenuEvent( QContextMenuEvent* e )
+{
+ KPopupMenu* popup = new KPopupMenu( this );
+
+ plugDefaultActions( popup );
+
+ popup->exec( e->globalPos() );
+ delete popup;
+}
+
+
+
+/*--------------------------------------------------------------------------------*/
+/*--------------------------------------------------------------------------------*/
+/*--------------------------------------------------------------------------------*/
+
+
+
+KitaDockWidgetBase::KitaDockWidgetBase( KDockManager* dockManager,
+ const char* name,
+ const QPixmap &pixmap,
+ QWidget* parent,
+ const QString& strCaption,
+ const QString& strTabPageLabel,
+ WFlags f )
+ :KDockWidget( dockManager, name, pixmap, parent, strCaption, strTabPageLabel, f )
+{
+ setDockSite( KDockWidget::DockNone );
+ m_docked = TRUE;
+ m_parentDock = static_cast< KParts::DockMainWindow* >( parent );
+ m_brotherDock = NULL;
+
+ /* connect signals */
+ connect( this, SIGNAL( headerCloseButtonClicked() ), SLOT( slotSaveDocStatus() ) );
+ connect( this, SIGNAL( iMBeingClosed() ), SLOT( slotSaveDocStatus() ));
+
+ Kita::SignalCollection* signalCollection = Kita::SignalCollection::getInstance();
+
+ /* emit when this widget is deactivated */
+ connect( this, SIGNAL( windowDeactivated() ),
+ signalCollection, SIGNAL( windowDeactivated() ));
+
+ /* If this widget is active and receives
+ signal isKitaActive, then emit signal kitaIsActive. */
+ /* see also KitaHTMLPart::slotOnURL */
+ connect( signalCollection, SIGNAL( isKitaActive() ),
+ this, SLOT( slotIsKitaActive() ) );
+
+ connect( this, SIGNAL( kitaIsActive() ),
+ signalCollection, SIGNAL( kitaIsActive() ) );
+}
+
+
+KitaDockWidgetBase::~KitaDockWidgetBase(){}
+
+
+/* public slot */
+void KitaDockWidgetBase::slotShowPart( const KURL& url, const QString& libName, const QString& mimetype )
+{
+ slotShowDock();
+
+ static_cast<KitaTabWidgetBase*> ( getWidget() )->slotShowPart( url, libName, mimetype );
+}
+
+
+/* save the current dock status. */
+/* This slot is called before this
+ widget is closed. */ /* public slot */
+void KitaDockWidgetBase::slotSaveDocStatus()
+{
+ if( isVisible() ){
+ m_brotherDock = NULL;
+ m_docked = FALSE;
+ m_tabbed = FALSE;
+
+ /* This widget is docked.*/
+ if( parent() ){
+ m_docked = TRUE;
+ if( parentDockTabGroup() ) m_tabbed = TRUE; /* This widget is in the tab group.*/
+ }
+
+ emit checkToggleAction( FALSE ); /* to KitaMainWindow */
+ }
+}
+
+/* show & activate dock widget */ /* public slot */
+void KitaDockWidgetBase::slotShowDock()
+{
+ ShowDockEvent* e = new ShowDockEvent( TRUE );
+ QApplication::postEvent( this, e ); // Qt will delete it when done
+}
+
+/* show but not activate dock widget */ /* public slot */
+void KitaDockWidgetBase::slotShowDockNoActive()
+{
+ ShowDockEvent* e = new ShowDockEvent( FALSE );
+ QApplication::postEvent( this, e ); // Qt will delete it when done
+}
+
+
+/* show dock widget immediately */ /* public */
+void KitaDockWidgetBase::showDock( bool activate )
+{
+ if( !isVisible() ){
+
+ if( m_docked ){ /* This dock was docked to the other dock. */
+
+#if KDE_IS_VERSION( 3, 2, 0 )
+
+ /* Sometimes the dock widget loses the former brother DockWidget.
+ because the brogher widget had transformed. So, set new brogher widget here. */
+
+ /* find new brother dock widget */
+ KDockWidget* newBrsDock = dockManager()->getDockWidgetFromName( "Thread" );
+ if( newBrsDock ){
+ /* Is threadDock on the tab? */
+ QWidget* tmpwidget = newBrsDock->parentDockTabGroup();
+ if( tmpwidget ){
+ tmpwidget = tmpwidget->parentWidget();
+ if( tmpwidget->inherits( "KDockWidget" ) )
+ newBrsDock = static_cast< KDockWidget* >( tmpwidget );
+ }
+ }
+
+ /* set the new brogher widget */
+ if( !formerBrotherDockWidget ||
+ ( !m_tabbed && newBrsDock && formerBrotherDockWidget->name() != newBrsDock->name() ) ){
+
+ if( newBrsDock ) setFormerBrotherDockWidget( newBrsDock );
+ }
+#endif
+ makeDockVisible();
+ }
+ else show();
+ }
+
+ if( !activate ) return;
+
+ if( isMinimized() ) showNormal();
+ topLevelWidget()->raise();
+ raise();
+ setActiveWindow();
+ emit checkToggleAction( TRUE ); /* to KitaMainWindow */
+
+ /* activate child Part */
+ QWidget* wd = getWidget();
+ if( wd && wd->inherits( "KitaTabWidgetBase" )){
+ KitaTabWidgetBase* w = static_cast<KitaTabWidgetBase*> ( wd );
+ if( w ) w->slotCurrentChanged( w->currentPage() );
+ }
+ else if( wd ){
+ wd->setActiveWindow();
+ wd->setFocus();
+ }
+}
+
+
+/* public slot */
+void KitaDockWidgetBase::slotHideDock()
+{
+ if( isVisible() ){
+ slotSaveDocStatus();
+ m_parentDock->makeDockInvisible( this );
+ }
+}
+
+
+/* public slot */
+void KitaDockWidgetBase::slotToggleShowHide()
+{
+ if( !isVisible() ) slotShowDock();
+ else slotHideDock();
+}
+
+
+/* when this widget is deactivated, emit signal
+ to popup vie SignalCollection. */ /* protected */
+void KitaDockWidgetBase::windowActivationChange ( bool )
+{
+ if( !isActiveWindow() ) emit windowDeactivated();
+}
+
+
+/* protected */
+void KitaDockWidgetBase::closeEvent( QCloseEvent* e )
+{
+ slotSaveDocStatus();
+ KDockWidget::closeEvent( e );
+}
+
+
+/* protected */ /* virtual */
+void KitaDockWidgetBase::customEvent( QCustomEvent * e )
+{
+ if ( e->type() == EVENT_ShowDock ){
+ showDock( static_cast< ShowDockEvent* >( e )->getActivate() );
+ }
+}
+
+
+/* see also KitaHTMLPart::slotOnURL */ /* private slot */
+void KitaDockWidgetBase::slotIsKitaActive()
+{
+ if( isActiveWindow() ) emit kitaIsActive();
+}
+
--- /dev/null
+/***************************************************************************
+* Copyright (C) 2003 by Hideki Ikemoto, 2004 by 421 *
+* ikemo@users.sourceforge.jp *
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+***************************************************************************/
+
+#ifndef KITATABWIDGETBASE_H
+#define KITATABWIDGETBASE_H
+
+#include <qtabwidget.h>
+#include <kxmlguiclient.h>
+#include <kparts/partmanager.h>
+
+#include <qtabbar.h>
+
+#include <kdockwidget.h>
+
+#include <qevent.h>
+#include <qdict.h>
+
+class KLibFactory;
+class KURL;
+
+namespace KParts
+{
+ class DockMainWindow;
+}
+
+/* ID of user defined event */
+#define EVENT_CloseTab ( QEvent::User + 100 )
+#define EVENT_ShowDock ( QEvent::User + 101 )
+#define EVENT_FitImageToWinEvent ( QEvent::User + 102 )
+
+
+
+/*-----------------------------------------------*/
+
+
+class KitaTabWidgetBase : public QTabWidget, public KXMLGUIClient
+{
+ Q_OBJECT
+
+protected:
+ KParts::PartManager* m_manager;
+
+
+public:
+ KitaTabWidgetBase( QWidget* parent = 0, const char* name = 0, WFlags f = 0 );
+ virtual ~KitaTabWidgetBase();
+
+
+public slots:
+ void slotCurrentChanged( QWidget* w );
+ void slotShowPart( const KURL&, const QString&, const QString& );
+ void slotCloseTab( int num );
+
+
+protected:
+ virtual void customEvent( QCustomEvent * e );
+ virtual void deleteWidget( QWidget* w );
+ const QString getTabLabel( const QString &label );
+ KParts::Part* findPartFromWidget( QWidget* w );
+
+
+private:
+ void connectSignals();
+
+
+signals:
+ void switchSubjectView();
+
+
+ /*------------------------------------*/
+ /* common tab actions */
+
+private:
+ void setupActions();
+
+public slots:
+ void slotConfigureKeys();
+ void slotPrevTab();
+ void slotNextTab();
+ void slotCloseCurrentTab();
+ void slotCloseOtherTab();
+ void slotCloseRightTab();
+ void slotCloseLeftTab();
+ void slotCloseAllTab();
+
+signals:
+ void switchToBoard();
+ void switchToSubject();
+ void switchToThread();
+ void switchToKitanavi();
+ void switchToImgview();
+ void switchToWritedock();
+};
+
+
+/*-------------------------------------------------*/
+
+
+
+
+class KitaTabBarBase : public QTabBar
+{
+ Q_OBJECT
+
+public:
+ KitaTabBarBase( QWidget* parent = 0, const char* name = 0 );
+ ~KitaTabBarBase();
+
+protected:
+ void plugDefaultActions( KPopupMenu* popup );
+ virtual void contextMenuEvent( QContextMenuEvent* e );
+};
+
+
+
+
+
+/*-------------------------------------------------*/
+
+
+
+class KitaDockWidgetBase : public KDockWidget{
+
+ Q_OBJECT
+
+ bool m_docked;
+ bool m_tabbed;
+ KParts::DockMainWindow* m_parentDock;
+ KDockWidget* m_brotherDock;
+ QDict<KDockWidget>* m_dockDict;
+
+public:
+ KitaDockWidgetBase( KDockManager* dockManager,
+ const char* name,
+ const QPixmap &pixmap,
+ QWidget* parent = 0L,
+ const QString& strCaption = QString::null,
+ const QString& strTabPageLabel = QString::fromLatin1( " " ),
+ WFlags f = 0);
+ ~KitaDockWidgetBase();
+
+ void showDock( bool active );
+
+public slots:
+ void slotShowPart( const KURL&, const QString&, const QString& );
+ void slotSaveDocStatus();
+ void slotShowDock();
+ void slotShowDockNoActive();
+ void slotHideDock();
+ void slotToggleShowHide();
+
+
+protected:
+ void windowActivationChange( bool );
+ virtual void closeEvent( QCloseEvent* e );
+ virtual void customEvent( QCustomEvent * e );
+
+
+private slots:
+ void slotIsKitaActive();
+
+
+signals:
+ void windowDeactivated();
+ void isKitaActive();
+ void kitaIsActive();
+ void checkToggleAction( bool );
+};
+
+
+
+/*------------------------------------------------------------------*/
+
+/* user defined events */
+
+class CloseTabEvent : public QCustomEvent
+{
+ int m_pageindex;
+
+ public:
+
+ CloseTabEvent( int idx )
+ : QCustomEvent( EVENT_CloseTab ), m_pageindex( idx ){}
+
+ const int getIndex() const { return m_pageindex; }
+};
+
+
+class ShowDockEvent : public QCustomEvent
+{
+ bool m_activate;
+ public:
+ ShowDockEvent( bool activate ):QCustomEvent( EVENT_ShowDock ), m_activate( activate ){}
+
+ const bool getActivate() const { return m_activate; }
+};
+
+
+/* FitImageToWinEvent is used in kitaimgviewer.cpp */
+class FitImageToWinEvent : public QCustomEvent
+{
+ public:
+ FitImageToWinEvent():QCustomEvent( EVENT_FitImageToWinEvent ){}
+};
+
+
+#endif