2011-11-10 13:28:06 +00:00
|
|
|
/********************************************************************
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 2011 Martin Gräßlin <mgraesslin@kde.org>
|
|
|
|
|
|
|
|
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 KWIN_THUMBNAILITEM_H
|
|
|
|
#define KWIN_THUMBNAILITEM_H
|
|
|
|
|
2013-02-26 08:00:51 +00:00
|
|
|
#include <QWeakPointer>
|
2011-11-10 13:28:06 +00:00
|
|
|
#include <QtDeclarative/QDeclarativeItem>
|
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
2013-03-26 13:43:36 +00:00
|
|
|
class Client;
|
2011-11-10 13:28:06 +00:00
|
|
|
class EffectWindow;
|
|
|
|
class EffectWindowImpl;
|
|
|
|
|
2012-03-29 13:32:41 +00:00
|
|
|
class AbstractThumbnailItem : public QDeclarativeItem
|
2011-11-10 13:28:06 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
2011-11-29 06:13:26 +00:00
|
|
|
Q_PROPERTY(bool clip READ isClip WRITE setClip NOTIFY clipChanged SCRIPTABLE true)
|
2012-03-24 07:12:29 +00:00
|
|
|
Q_PROPERTY(qulonglong parentWindow READ parentWindow WRITE setParentWindow)
|
2013-03-19 08:08:32 +00:00
|
|
|
Q_PROPERTY(qreal brightness READ brightness WRITE setBrightness NOTIFY brightnessChanged)
|
|
|
|
Q_PROPERTY(qreal saturation READ saturation WRITE setSaturation NOTIFY saturationChanged)
|
2011-11-10 13:28:06 +00:00
|
|
|
public:
|
2012-03-29 13:32:41 +00:00
|
|
|
virtual ~AbstractThumbnailItem();
|
2011-11-29 06:13:26 +00:00
|
|
|
bool isClip() const {
|
|
|
|
return m_clip;
|
|
|
|
}
|
|
|
|
void setClip(bool clip);
|
2012-03-24 07:12:29 +00:00
|
|
|
qulonglong parentWindow() const {
|
|
|
|
return m_parentWindow;
|
|
|
|
}
|
|
|
|
void setParentWindow(qulonglong parentWindow);
|
2013-03-19 08:08:32 +00:00
|
|
|
qreal brightness() const;
|
|
|
|
qreal saturation() const;
|
|
|
|
|
|
|
|
public Q_SLOTS:
|
|
|
|
void setBrightness(qreal brightness);
|
|
|
|
void setSaturation(qreal saturation);
|
|
|
|
|
2011-11-10 13:28:06 +00:00
|
|
|
Q_SIGNALS:
|
2011-11-29 06:13:26 +00:00
|
|
|
void clipChanged(bool clipped);
|
2013-03-19 08:08:32 +00:00
|
|
|
void brightnessChanged();
|
|
|
|
void saturationChanged();
|
2012-03-29 13:32:41 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
explicit AbstractThumbnailItem(QDeclarativeItem *parent = 0);
|
|
|
|
|
2012-03-29 18:17:57 +00:00
|
|
|
protected Q_SLOTS:
|
|
|
|
virtual void repaint(KWin::EffectWindow* w) = 0;
|
|
|
|
|
2011-11-10 13:28:06 +00:00
|
|
|
private Q_SLOTS:
|
|
|
|
void init();
|
|
|
|
void effectWindowAdded();
|
2013-03-06 08:46:25 +00:00
|
|
|
void compositingToggled();
|
2012-03-29 13:32:41 +00:00
|
|
|
|
2011-11-10 13:28:06 +00:00
|
|
|
private:
|
|
|
|
void findParentEffectWindow();
|
2011-11-29 06:13:26 +00:00
|
|
|
bool m_clip;
|
2011-11-10 13:28:06 +00:00
|
|
|
QWeakPointer<EffectWindowImpl> m_parent;
|
2012-03-24 07:12:29 +00:00
|
|
|
qulonglong m_parentWindow;
|
2013-03-19 08:08:32 +00:00
|
|
|
qreal m_brightness;
|
|
|
|
qreal m_saturation;
|
2011-11-10 13:28:06 +00:00
|
|
|
};
|
|
|
|
|
2012-03-29 13:46:53 +00:00
|
|
|
class WindowThumbnailItem : public AbstractThumbnailItem
|
2012-03-29 13:32:41 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
Q_PROPERTY(qulonglong wId READ wId WRITE setWId NOTIFY wIdChanged SCRIPTABLE true)
|
|
|
|
Q_PROPERTY(KWin::Client *client READ client WRITE setClient NOTIFY clientChanged)
|
|
|
|
public:
|
2012-03-29 13:46:53 +00:00
|
|
|
explicit WindowThumbnailItem(QDeclarativeItem *parent = 0);
|
|
|
|
virtual ~WindowThumbnailItem();
|
2012-03-29 13:32:41 +00:00
|
|
|
|
|
|
|
qulonglong wId() const {
|
|
|
|
return m_wId;
|
|
|
|
}
|
|
|
|
void setWId(qulonglong wId);
|
|
|
|
Client *client() const;
|
|
|
|
void setClient(Client *client);
|
|
|
|
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
|
|
|
Q_SIGNALS:
|
|
|
|
void wIdChanged(qulonglong wid);
|
|
|
|
void clientChanged();
|
2012-03-29 18:17:57 +00:00
|
|
|
protected Q_SLOTS:
|
|
|
|
virtual void repaint(KWin::EffectWindow* w);
|
2012-03-29 13:32:41 +00:00
|
|
|
private:
|
|
|
|
qulonglong m_wId;
|
|
|
|
Client *m_client;
|
|
|
|
};
|
|
|
|
|
2012-03-29 18:17:57 +00:00
|
|
|
class DesktopThumbnailItem : public AbstractThumbnailItem
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
Q_PROPERTY(int desktop READ desktop WRITE setDesktop NOTIFY desktopChanged)
|
|
|
|
public:
|
|
|
|
DesktopThumbnailItem(QDeclarativeItem *parent = 0);
|
|
|
|
virtual ~DesktopThumbnailItem();
|
|
|
|
|
|
|
|
int desktop() const {
|
|
|
|
return m_desktop;
|
|
|
|
}
|
|
|
|
void setDesktop(int desktop);
|
|
|
|
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
|
|
|
Q_SIGNALS:
|
|
|
|
void desktopChanged(int desktop);
|
|
|
|
protected Q_SLOTS:
|
|
|
|
virtual void repaint(KWin::EffectWindow* w);
|
|
|
|
private:
|
|
|
|
int m_desktop;
|
|
|
|
};
|
|
|
|
|
2013-03-19 08:08:32 +00:00
|
|
|
inline
|
2012-03-29 13:32:41 +00:00
|
|
|
qreal AbstractThumbnailItem::brightness() const
|
2013-03-19 08:08:32 +00:00
|
|
|
{
|
|
|
|
return m_brightness;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline
|
2012-03-29 13:32:41 +00:00
|
|
|
qreal AbstractThumbnailItem::saturation() const
|
2013-03-19 08:08:32 +00:00
|
|
|
{
|
|
|
|
return m_saturation;
|
|
|
|
}
|
|
|
|
|
2013-03-26 13:43:36 +00:00
|
|
|
inline
|
2012-03-29 13:46:53 +00:00
|
|
|
Client *WindowThumbnailItem::client() const
|
2013-03-26 13:43:36 +00:00
|
|
|
{
|
|
|
|
return m_client;
|
|
|
|
}
|
|
|
|
|
2011-11-10 13:28:06 +00:00
|
|
|
} // KWin
|
|
|
|
|
|
|
|
#endif // KWIN_THUMBNAILITEM_H
|