1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
|
/*
Actionaz
Copyright (C) 2008-2014 Jonathan Mercier-Ganady
Actionaz 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 3 of the License, or
(at your option) any later version.
Actionaz 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/>.
Contact : jmgr@jmgr.info
*/
#ifndef RECT_H
#define RECT_H
#include "actiontools_global.h"
#include "code/codeclass.h"
#include <QObject>
#include <QScriptValue>
#include <QScriptEngine>
#include <QRect>
#include <QPoint>
#include <QSize>
namespace Code
{
class ACTIONTOOLSSHARED_EXPORT Rect : public CodeClass
{
Q_OBJECT
Q_PROPERTY(int top READ top WRITE setTop)
Q_PROPERTY(int bottom READ bottom WRITE setBottom)
Q_PROPERTY(int left READ left WRITE setLeft)
Q_PROPERTY(int right READ right WRITE setRight)
Q_PROPERTY(int x READ x WRITE setX)
Q_PROPERTY(int y READ y WRITE setY)
Q_PROPERTY(int width READ width WRITE setWidth)
Q_PROPERTY(int height READ height WRITE setHeight)
public:
static QScriptValue constructor(QScriptContext *context, QScriptEngine *engine);
static QScriptValue constructor(const QRect &rect, QScriptEngine *engine);
static QRect parameter(QScriptContext *context, QScriptEngine *engine);
static void registerClass(QScriptEngine *scriptEngine);
Rect();
Rect(const Rect &other);
Rect(const QRect &rect);
Rect &operator=(Rect other);
Rect &operator=(QRect rect);
void swap(Rect &other);
void swap(QRect &rect);
const QRect &rect() const;
int width() const;
int height() const;
int x() const;
int y() const;
int left() const;
int right() const;
int top() const;
int bottom() const;
public slots:
QScriptValue clone() const;
bool equals(const QScriptValue &other) const;
QString toString() const;
QScriptValue normalize();
QScriptValue setTop(int top);
QScriptValue setBottom(int bottom);
QScriptValue setLeft(int left);
QScriptValue setRight(int right);
QScriptValue setX(int x);
QScriptValue setY(int y);
QScriptValue setWidth(int width);
QScriptValue setHeight(int height);
QScriptValue setSize();
QScriptValue setCoords(int x1, int y1, int x2, int y2);
QScriptValue setRect();
QScriptValue translate();
bool contains(const QScriptValue &point) const;
QScriptValue united() const;
QScriptValue intersected() const;
bool intersects() const;
bool isEmpty() const;
QScriptValue center() const;
QScriptValue size() const;
private:
QRect mRect;
};
}
#endif // RECT_H
|