kwin/tabbox/tabboxview.h
Martin Gräßlin 76f17e6de1 Here comes the new TabBox. It is a complete rewrite using a MVC approach. Here some highlights:
* Models and Delegates for Clients and Desktops
 * Horizontal, vertical and tabular layout
 * Layout of one item can be configured by an XML definition
 * A desktop item can include a client list
 * An optional second list view showing only the selected item
 * A new KCM "kwintabbox"
 * An alternative TabBox with independent settings and keybindings
 * Optional Highlight Windows effect integration
 * List scrolls instead of removing items
 * Scroll wheel support
 * Cursor key support
 * Middle click on item closes window
BUG: 195745
BUG: 197187
BUG: 201103
FEATURE: 118184
FEATURE: 156723
FEATURE: 177441
FEATURE: 182897
FEATURE: 193882
GUI:

svn path=/trunk/KDE/kdebase/workspace/; revision=1022861
2009-09-13 11:36:45 +00:00

177 lines
5 KiB
C++

/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2009 Martin Gräßlin <kde@martin-graesslin.com>
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, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#ifndef TABBOXVIEW_H
#define TABBOXVIEW_H
#include <QTableView>
/**
* @file
* This file desfines the classes which build up the view of the TabBox.
*
* @author Martin Gräßlin <kde@martin-graesslin.com>
* @since 4.4
*/
class QModelIndex;
namespace Plasma
{
class FrameSvg;
}
namespace KWin
{
namespace TabBox
{
class DesktopItemDelegate;
class DesktopModel;
class ClientModel;
class ClientItemDelegate;
class TabBoxMainView;
class TabBoxAdditionalView;
/**
* This class is the main view of the TabBox. It is made up of two widgets:
* TabBoxMainView which is the "switching area" for TabBox items and
* TabBoxInfoView which is an optional second list view only displaying the
* current selected item.
*
* @author Martin Gräßlin <kde@martin-graesslin.com>
* @since 4.4
*/
class TabBoxView : public QWidget
{
Q_OBJECT
public:
TabBoxView( QWidget* parent = 0 );
~TabBoxView();
virtual void paintEvent( QPaintEvent* e );
virtual QSize sizeHint() const;
void updateGeometry();
/**
* Sets the current index in the two views.
* @param index The new index
*/
void setCurrentIndex( QModelIndex index );
/**
* Returns the index at the given position of the main view widget.
* @param pos The widget position
* @return The model index at given position. If there is no item
* at the position or the position is not in the main widget an
* invalid item will be returned.
*/
QModelIndex indexAt( QPoint pos );
/**
* @return The ClientModel used by TabBox.
*/
ClientModel* clientModel() const { return m_clientModel; }
/**
* @return The DesktopModel used by TabBox.
*/
DesktopModel* desktopModel() { return m_desktopModel; }
ClientItemDelegate* clientDelegate() const { return m_delegate; }
ClientItemDelegate* additionalClientDelegate() const { return m_additionalClientDelegate; }
DesktopItemDelegate* desktopDelegate() const { return m_desktopItemDelegate; }
DesktopItemDelegate* additionalDesktopDelegate() const { return m_additionalDesktopDelegate; }
void setPreview( bool preview );
bool preview() const { return m_preview; }
private slots:
/**
* This slot reacts on a changed TabBoxConfig. It changes the used
* item model and delegate if the TabBoxMode changed.
*/
void configChanged();
private:
/**
* The main widget used to show all items
*/
TabBoxMainView* m_tableView;
TabBoxAdditionalView* m_additionalView;
/**
* Model for client items
*/
ClientModel* m_clientModel;
/**
* Model for desktop items
*/
DesktopModel* m_desktopModel;
/**
* Item delegate for client items
*/
ClientItemDelegate* m_delegate;
ClientItemDelegate* m_additionalClientDelegate;
/**
* Item delegate for desktop items
*/
DesktopItemDelegate* m_desktopItemDelegate;
DesktopItemDelegate* m_additionalDesktopDelegate;
/**
* Background Frame
*/
Plasma::FrameSvg* m_frame;
/**
* TabBoxView is a preview
*/
bool m_preview;
};
/**
* This class is the main widget of the TabBoxView.
* It is the "switching area" for TabBox items.
*
* @author Martin Gräßlin <kde@martin-graesslin.com>
* @since 4.4
*/
class TabBoxMainView : public QTableView
{
public:
TabBoxMainView( QWidget* parent = 0 );
~TabBoxMainView();
virtual QSize sizeHint() const;
};
/**
* This class is the additional widget of the TabBoxView.
* It just displays the current item and can be turned off.
*
* @author Martin Gräßlin <kde@martin-graesslin.com>
* @since 4.4
*/
class TabBoxAdditionalView : public QTableView
{
public:
TabBoxAdditionalView( QWidget* parent = 0 );
~TabBoxAdditionalView();
virtual QSize sizeHint() const;
};
} // namespace Tabbox
} // namespace KWin
#endif // TABBOXVIEW_H