2009-06-19 09:18:07 +00:00
|
|
|
/********************************************************************
|
2012-01-07 16:05:22 +00:00
|
|
|
Copyright (C) 2009, 2010, 2012 Martin Gräßlin <mgraesslin@kde.org>
|
2009-06-19 09:18:07 +00:00
|
|
|
|
|
|
|
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 AURORAE_H
|
|
|
|
#define AURORAE_H
|
|
|
|
|
|
|
|
#include "themeconfig.h"
|
|
|
|
|
2010-04-12 19:28:58 +00:00
|
|
|
#include <kdecoration.h>
|
2009-06-19 09:18:07 +00:00
|
|
|
#include <kdecorationfactory.h>
|
|
|
|
|
2012-01-11 20:14:29 +00:00
|
|
|
class QDeclarativeComponent;
|
|
|
|
class QDeclarativeEngine;
|
|
|
|
class QDeclarativeItem;
|
2010-05-09 09:08:09 +00:00
|
|
|
class QGraphicsSceneMouseEvent;
|
2010-04-12 19:28:58 +00:00
|
|
|
class QGraphicsScene;
|
2012-01-11 20:14:29 +00:00
|
|
|
class QGraphicsView;
|
2009-06-19 09:18:07 +00:00
|
|
|
|
|
|
|
namespace Aurorae
|
|
|
|
{
|
2010-04-12 19:28:58 +00:00
|
|
|
class AuroraeTheme;
|
2012-01-11 20:14:29 +00:00
|
|
|
class AuroraeClient;
|
2009-06-19 09:18:07 +00:00
|
|
|
|
|
|
|
class AuroraeFactory : public QObject, public KDecorationFactoryUnstable
|
|
|
|
{
|
2012-01-13 10:48:04 +00:00
|
|
|
Q_OBJECT
|
|
|
|
Q_PROPERTY(QString leftButtons READ leftButtons NOTIFY buttonsChanged)
|
|
|
|
Q_PROPERTY(QString rightButtons READ rightButtons NOTIFY buttonsChanged)
|
|
|
|
Q_PROPERTY(bool customButtonPositions READ customButtonPositions NOTIFY buttonsChanged)
|
2009-06-19 09:18:07 +00:00
|
|
|
public:
|
|
|
|
~AuroraeFactory();
|
|
|
|
|
|
|
|
static AuroraeFactory* instance();
|
|
|
|
bool reset(unsigned long changed);
|
|
|
|
KDecoration *createDecoration(KDecorationBridge*);
|
|
|
|
bool supports(Ability ability) const;
|
2009-11-08 20:35:34 +00:00
|
|
|
virtual QList< BorderSize > borderSizes() const;
|
2009-06-19 09:18:07 +00:00
|
|
|
|
2010-04-12 19:28:58 +00:00
|
|
|
AuroraeTheme *theme() const {
|
|
|
|
return m_theme;
|
2010-01-01 12:47:48 +00:00
|
|
|
}
|
2012-01-11 20:14:29 +00:00
|
|
|
QDeclarativeItem *createQmlDecoration(AuroraeClient *client);
|
2012-01-13 10:48:04 +00:00
|
|
|
QString leftButtons();
|
|
|
|
QString rightButtons();
|
|
|
|
bool customButtonPositions();
|
2009-06-19 09:18:07 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
AuroraeFactory();
|
|
|
|
void init();
|
|
|
|
|
2012-01-13 10:48:04 +00:00
|
|
|
Q_SIGNALS:
|
|
|
|
void buttonsChanged();
|
|
|
|
|
2009-06-19 09:18:07 +00:00
|
|
|
private:
|
|
|
|
static AuroraeFactory *s_instance;
|
|
|
|
|
2010-04-12 19:28:58 +00:00
|
|
|
AuroraeTheme *m_theme;
|
2012-01-11 20:14:29 +00:00
|
|
|
QDeclarativeEngine *m_engine;
|
|
|
|
QDeclarativeComponent *m_component;
|
2009-06-19 09:18:07 +00:00
|
|
|
};
|
|
|
|
|
2010-04-12 19:28:58 +00:00
|
|
|
class AuroraeClient : public KDecorationUnstable
|
2009-06-19 09:18:07 +00:00
|
|
|
{
|
2009-07-27 21:30:26 +00:00
|
|
|
Q_OBJECT
|
2012-01-04 18:51:51 +00:00
|
|
|
Q_PROPERTY(bool active READ isActive NOTIFY activeChanged)
|
|
|
|
Q_PROPERTY(QString caption READ caption NOTIFY captionChanged)
|
|
|
|
Q_PROPERTY(int desktop READ desktop WRITE setDesktop NOTIFY desktopChanged)
|
|
|
|
Q_PROPERTY(QRect geometry READ geometry)
|
|
|
|
Q_PROPERTY(int height READ height)
|
|
|
|
Q_PROPERTY(QIcon icon READ icon NOTIFY iconChanged)
|
2012-01-07 16:05:22 +00:00
|
|
|
Q_PROPERTY(bool closeable READ isCloseable CONSTANT)
|
|
|
|
Q_PROPERTY(bool maximizeable READ isMaximizable CONSTANT)
|
|
|
|
Q_PROPERTY(bool minimizeable READ isMinimizable CONSTANT)
|
2012-01-04 18:51:51 +00:00
|
|
|
Q_PROPERTY(bool modal READ isModal)
|
2012-01-07 16:05:22 +00:00
|
|
|
Q_PROPERTY(bool moveable READ isMovable CONSTANT)
|
2012-01-04 18:51:51 +00:00
|
|
|
Q_PROPERTY(bool onAllDesktops READ isOnAllDesktops NOTIFY desktopChanged)
|
|
|
|
Q_PROPERTY(bool preview READ isPreview CONSTANT)
|
2012-01-07 16:05:22 +00:00
|
|
|
Q_PROPERTY(bool resizeable READ isResizable CONSTANT)
|
2012-01-04 18:51:51 +00:00
|
|
|
Q_PROPERTY(bool setShade READ isSetShade NOTIFY shadeChanged)
|
|
|
|
Q_PROPERTY(bool shade READ isShade WRITE setShade NOTIFY shadeChanged)
|
|
|
|
Q_PROPERTY(bool shadeable READ isShadeable)
|
2012-01-07 16:25:21 +00:00
|
|
|
Q_PROPERTY(bool keepAbove READ keepAbove WRITE setKeepAbove NOTIFY keepAboveChangedWrapper)
|
|
|
|
Q_PROPERTY(bool keepBelow READ keepBelow WRITE setKeepBelow NOTIFY keepBelowChangedWrapper)
|
2012-01-08 10:36:04 +00:00
|
|
|
Q_PROPERTY(bool maximized READ isMaximized NOTIFY maximizeChanged)
|
2012-01-04 18:51:51 +00:00
|
|
|
Q_PROPERTY(bool providesContextHelp READ providesContextHelp)
|
|
|
|
Q_PROPERTY(QRect transparentRect READ transparentRect)
|
|
|
|
Q_PROPERTY(int width READ width)
|
|
|
|
Q_PROPERTY(qulonglong windowId READ windowId CONSTANT)
|
2012-02-16 10:30:28 +00:00
|
|
|
Q_PROPERTY(int doubleClickInterval READ doubleClickInterval)
|
2012-01-04 18:51:51 +00:00
|
|
|
// TODO: window tabs - they suck for dynamic features
|
2009-06-19 09:18:07 +00:00
|
|
|
public:
|
2010-04-12 19:28:58 +00:00
|
|
|
AuroraeClient(KDecorationBridge* bridge, KDecorationFactory* factory);
|
2010-06-19 15:23:48 +00:00
|
|
|
virtual ~AuroraeClient();
|
2009-11-01 12:12:30 +00:00
|
|
|
virtual void activeChange();
|
2010-04-12 19:28:58 +00:00
|
|
|
virtual void borders(int& left, int& right, int& top, int& bottom) const;
|
2009-11-01 12:12:30 +00:00
|
|
|
virtual void captionChange();
|
2010-04-12 19:28:58 +00:00
|
|
|
virtual void desktopChange();
|
|
|
|
virtual void iconChange();
|
|
|
|
virtual void init();
|
|
|
|
virtual void maximizeChange();
|
|
|
|
virtual QSize minimumSize() const;
|
|
|
|
virtual Position mousePosition(const QPoint& p) const;
|
2009-11-01 12:12:30 +00:00
|
|
|
virtual void resize(const QSize& s);
|
2010-04-12 19:28:58 +00:00
|
|
|
virtual void shadeChange();
|
|
|
|
// optional overrides
|
|
|
|
virtual void padding(int &left, int &right, int &top, int &bottom) const;
|
|
|
|
virtual void reset(long unsigned int changed);
|
2012-01-08 10:36:04 +00:00
|
|
|
bool isMaximized() const;
|
2012-02-16 10:30:28 +00:00
|
|
|
int doubleClickInterval() const;
|
2010-04-12 19:28:58 +00:00
|
|
|
|
2012-01-04 18:51:51 +00:00
|
|
|
Q_SIGNALS:
|
|
|
|
void activeChanged();
|
|
|
|
void captionChanged();
|
|
|
|
void desktopChanged();
|
|
|
|
void iconChanged();
|
|
|
|
void maximizeChanged();
|
|
|
|
void shadeChanged();
|
2012-01-07 16:25:21 +00:00
|
|
|
void keepAboveChangedWrapper();
|
|
|
|
void keepBelowChangedWrapper();
|
2012-01-04 18:51:51 +00:00
|
|
|
|
2012-01-07 16:05:22 +00:00
|
|
|
public slots:
|
2010-04-12 19:28:58 +00:00
|
|
|
void menuClicked();
|
|
|
|
void toggleShade();
|
|
|
|
void toggleKeepAbove();
|
|
|
|
void toggleKeepBelow();
|
2012-01-07 16:05:22 +00:00
|
|
|
void titlePressed(int button, int buttons);
|
|
|
|
void titleReleased(int button, int buttons);
|
|
|
|
void titleMouseMoved(int button, int buttons);
|
2010-04-12 19:28:58 +00:00
|
|
|
void titlePressed(Qt::MouseButton button, Qt::MouseButtons buttons);
|
|
|
|
void titleReleased(Qt::MouseButton button, Qt::MouseButtons buttons);
|
|
|
|
void titleMouseMoved(Qt::MouseButton button, Qt::MouseButtons buttons);
|
2009-07-27 21:30:26 +00:00
|
|
|
|
2012-01-11 20:14:29 +00:00
|
|
|
private slots:
|
|
|
|
void themeChanged();
|
|
|
|
|
2009-11-01 12:12:30 +00:00
|
|
|
private:
|
2012-01-11 20:14:29 +00:00
|
|
|
QGraphicsView *m_view;
|
|
|
|
QGraphicsScene *m_scene;
|
|
|
|
QDeclarativeItem *m_item;
|
2009-06-19 09:18:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|