1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
|
/****************************************************************************
Copyright (C) 2005 - 2011 Filipe AZEVEDO & The Monkey Studio Team
http://monkeystudio.org licensing under the GNU GPL.
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.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
****************************************************************************/
/*!
\file pTabbedWorkspace.h
\date 2008-01-14T00:27:52
\author Filipe AZEVEDO aka Nox P\@sNox <pasnox@gmail.com>
\brief An extended workspace
\brief This class and its associated classes are obsolete
*/
#ifndef PTABBEDWORKSPACE_H
#define PTABBEDWORKSPACE_H
#include "../objects/MonkeyExport.h"
#include <QWidget>
#include "pTabBar.h"
#include <QList>
class QBoxLayout;
class QStackedLayout;
class QStackedWidget;
class QWorkspace;
class pTabbedWorkspaceCorner;
class pAction;
class pTabBar;
/*!
\brief An extended workspace
\details that can at run time be switched to SDI/MDI/TopLevel Window.
\details See pExtendedWorkspace
*/
class Q_MONKEY_EXPORT pTabbedWorkspace : public QWidget
{
Q_OBJECT
Q_ENUMS( TabMode DocumentMode )
public:
enum TabMode { tmSDI = 0, tmMDI, tmTopLevel };
enum DocumentMode { dmMaximized = 0, dmCascade, dmTile, dmIcons, dmMinimizeAll, dmRestoreAll };
pTabbedWorkspace( QWidget* = 0, pTabbedWorkspace::TabMode = pTabbedWorkspace::tmMDI );
~pTabbedWorkspace();
virtual bool eventFilter( QObject*, QEvent* );
pTabBar* tabBar() const;
QTabBar::Shape tabShape() const;
pTabbedWorkspace::TabMode tabMode() const;
pTabbedWorkspace::DocumentMode documentMode() const;
int currentIndex() const;
QWidget* currentDocument() const;
int indexOf( QWidget* ) const;
QWidget* document( int ) const;
int count() const;
QList<QWidget*> documents() const;
pTabbedWorkspaceCorner* cornerWidget( Qt::Corner = Qt::TopRightCorner ) const;
int addTab( QWidget*, const QString& );
int addTab( QWidget*, const QIcon&, const QString& );
int insertTab( int, QWidget*, const QString& );
int insertTab( int, QWidget*, const QIcon&, const QString& );
public slots:
void setBackground( const QPixmap& );
void setBackground( const QString& );
void setTabShape( QTabBar::Shape );
void setTabMode( pTabbedWorkspace::TabMode );
void setDocumentMode( pTabbedWorkspace::DocumentMode );
void setCurrentIndex( int );
void setCurrentDocument( QWidget* );
void setCornerWidget( pTabbedWorkspaceCorner*, Qt::Corner = Qt::TopRightCorner );
void removeTab( int );
void removeDocument( QWidget* );
void closeCurrentTab();
void closeAllTabs( bool = false, bool = false );
void activateNextDocument();
void activatePreviousDocument();
protected:
void updateCorners();
void updateView( QWidget* = 0 );
void addDocument( QWidget* d, int = -1 );
// workspace properties
pTabbedWorkspace::TabMode mTabMode;
pTabbedWorkspace::DocumentMode mDocumentMode;
// main layout
QBoxLayout* mLayout;
QList<QWidget*> mDocuments;
// tab widget
pTabBar* mTabBar;
QBoxLayout* mTabLayout;
// document widget
QStackedLayout* mStackedLayout;
QStackedWidget* mStackedWidget;
QWorkspace* mWorkspaceWidget;
protected slots:
void internal_midButtonPressed( int, const QPoint& );
void internal_closeButtonClicked( int );
void internal_rightButtonPressed( int, const QPoint& );
void internal_tabDropped( int, int );
void internal_currentChanged( int );
void workspaceWidget_windowActivated( QWidget* );
void removeDocument( QObject* );
signals:
void tabInserted( int );
void aboutToCloseTab( int, QCloseEvent* );
void aboutToCloseDocument( QWidget*, QCloseEvent* );
void tabRemoved( int );
void currentChanged( int );
void tabShapeChanged( QTabBar::Shape );
void tabModeChanged( pTabbedWorkspace::TabMode );
void documentModeChanged( pTabbedWorkspace::DocumentMode );
void closeAllRequested();
};
#endif // PTABBEDWORKSPACE_H
|