plasma-framework/declarativeimports/plasmacomponents/fullscreendialog.h

99 lines
3.4 KiB
C
Raw Normal View History

2012-01-09 13:20:57 +01:00
/***************************************************************************
* Copyright 2012 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 FULLSCREENDIALOG_P
#define FULLSCREENDIALOG_P
#include <QObject>
#include <QPoint>
#include <QRect>
#include <QWeakPointer>
#include <QDeclarativeListProperty>
#include <QDeclarativeItem>
#include "enums.h"
class QGraphicsObject;
class QGraphicsView;
class QGraphicsScene;
class DeclarativeItemContainer;
class Background;
2012-01-09 13:20:57 +01:00
2012-01-09 15:46:55 +01:00
class FullScreenDialog : public QDeclarativeItem
2012-01-09 13:20:57 +01:00
{
Q_OBJECT
2012-01-09 15:46:55 +01:00
Q_PROPERTY(QDeclarativeListProperty<QGraphicsObject> title READ title DESIGNABLE false)
Q_PROPERTY(QDeclarativeListProperty<QGraphicsObject> content READ content DESIGNABLE false)
Q_PROPERTY(QDeclarativeListProperty<QGraphicsObject> buttons READ buttons DESIGNABLE false)
2012-01-09 13:20:57 +01:00
Q_PROPERTY(DialogStatus::Status status READ status NOTIFY statusChanged)
public:
2012-01-09 15:46:55 +01:00
FullScreenDialog(QDeclarativeItem *parent = 0);
2012-01-09 13:20:57 +01:00
~FullScreenDialog();
QGraphicsObject *mainItem() const;
void setMainItem(QGraphicsObject *mainItem);
bool isVisible() const;
void setVisible(const bool visible);
2012-01-09 15:46:55 +01:00
2012-01-09 13:20:57 +01:00
//QML properties
2012-01-09 15:46:55 +01:00
QDeclarativeListProperty<QGraphicsObject> title();
2012-01-09 17:42:59 +01:00
QDeclarativeListProperty<QGraphicsObject> content();
QDeclarativeListProperty<QGraphicsObject> buttons();
2012-01-09 13:20:57 +01:00
DialogStatus::Status status() const;
2012-01-09 15:46:55 +01:00
Q_INVOKABLE void open();
Q_INVOKABLE void accept();
Q_INVOKABLE void reject();
Q_INVOKABLE void close();
2012-01-09 13:20:57 +01:00
Q_SIGNALS:
void accepted();
void rejected();
void clickedOutside();
void statusChanged();
2012-01-09 15:46:55 +01:00
private Q_SLOTS:
2012-01-09 13:20:57 +01:00
void syncMainItem();
2012-01-09 15:46:55 +01:00
void statusHasChanged();
2012-01-09 13:20:57 +01:00
protected:
bool eventFilter(QObject *watched, QEvent *event);
private:
QGraphicsView *m_view;
QWeakPointer<QGraphicsObject> m_mainItem;
DeclarativeItemContainer *m_declarativeItemContainer;
QGraphicsScene *m_scene;
QWeakPointer<QObject> m_rootObject;
static uint s_numItems;
Background *m_background;
2012-01-09 17:42:59 +01:00
//those only used in case of error, to not make plasma crash
QList<QGraphicsObject *> m_dummyTitleElements;
QList<QGraphicsObject *> m_dummyContentElements;
QList<QGraphicsObject *> m_dummyButtonsElements;
2012-01-09 13:20:57 +01:00
};
#endif