plasma-framework/declarativeimports/core/dialog.h

92 lines
3.0 KiB
C
Raw Normal View History

/***************************************************************************
* Copyright 2011 Marco Martin <mart@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, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
#ifndef DIALOG_PROXY_P
#define DIALOG_PROXY_P
#include <QObject>
#include <QWeakPointer>
#include <QPoint>
class QGraphicsObject;
namespace Plasma
{
class Dialog;
}
class DeclarativeItemContainer;
class DialogProxy : public QObject
{
Q_OBJECT
Q_PROPERTY(QGraphicsObject *mainItem READ mainItem WRITE setMainItem NOTIFY mainItemChanged)
Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged)
2011-02-25 20:37:56 +01:00
Q_PROPERTY(int x READ x WRITE setX NOTIFY positionChanged)
Q_PROPERTY(int y READ y WRITE setY NOTIFY positionChanged)
2011-03-21 21:38:48 +01:00
Q_PROPERTY(int windowFlags READ windowFlags WRITE setWindowFlags)
public:
2011-02-25 19:00:01 +01:00
enum WidgetAttribute {
WA_X11NetWmWindowTypeDock = Qt::WA_X11NetWmWindowTypeDock
};
DialogProxy(QObject *parent = 0);
~DialogProxy();
QGraphicsObject *mainItem() const;
void setMainItem(QGraphicsObject *mainItem);
bool isVisible() const;
void setVisible(const bool visible);
2011-02-25 20:37:56 +01:00
int x() const;
void setX(int x);
int y() const;
void setY(int y);
2011-03-21 21:38:48 +01:00
//FIXME: passing an int is ugly
int windowFlags() const;
void setWindowFlags(const int);
Q_INVOKABLE QPoint popupPosition(QGraphicsObject *item) const;
2011-02-25 19:00:01 +01:00
//FIXME:: Qt::WidgetAttribute should be already
Q_INVOKABLE void setAttribute(int attribute, bool on);
Q_SIGNALS:
void mainItemChanged();
void visibleChanged();
2011-02-25 20:37:56 +01:00
void positionChanged();
protected Q_SLOTS:
void syncMainItem();
2011-02-25 20:37:56 +01:00
protected:
bool eventFilter(QObject *watched, QEvent *event);
private:
Plasma::Dialog *m_dialog;
2011-03-21 21:38:48 +01:00
Qt::WindowFlags m_flags;
DeclarativeItemContainer *m_declarativeItemContainer;
QWeakPointer<QGraphicsObject> m_mainItem;
};
#endif