/usr/include/qzionabstractcanvas.h is in libqzion-dev 0.4.0+lgpl-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | /*
* Copyright (C) 2008 Instituto Nokia de Tecnologia. All rights reserved.
*
* This file is part of QZion.
*
* QZion is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* QZion 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with QZion. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __QZIONABSTRACTCANVAS_H__
#define __QZIONABSTRACTCANVAS_H__
#include <QtCore>
#include <QtCore/QList>
#include <QtCore/QPoint>
#include <QtGui/QPainter>
#include <QMouseEvent>
#include <QWheelEvent>
#include <QGraphicsItem>
class QZionObject;
class QZionObjectPrivate;
class QZionAbstractCanvasPrivate;
/*!
\class QZionAbstractCanvas
\brief Container class.
A QZionAbstractCanvas is a set of canvas items.
*/
class QZionAbstractCanvas
{
public:
QZionAbstractCanvas();
virtual ~QZionAbstractCanvas();
/*!
Returns a const pointer to the list holding all the items in the canvas.
*/
const QList<QZionObject*> *items() const;
/*!
Returns the topmost object at a given position.
\sa itemsAt()
*/
QZionObject *itemAt(const QPoint &pos) const;
/*!
\overload
It's equivalent to calling itemAt(QPoint(x, y)).
\sa itemsAt()
*/
QZionObject *itemAt(const int x, const int y) const;
/*!
Returns all the items at the given position, starting from the
topmost one.
*/
QList<QZionObject*> itemsAt(const QPoint &pos) const;
/*!
\overload
It's equivalent to calling itemsAt(QPoint(x, y)).
*/
QList<QZionObject*> itemsAt(const int x, const int y) const;
/*!
Virtual function to ensure an update is pending, called from children.
*/
virtual void ensurePendingUpdate() = 0;
/*!
Virtual function to mark a rect as dirty in canvas.
This dirty rect will be repainted in the next paint event.
*/
virtual void invalidate(const QRect &r, bool translate = true) = 0;
/*!
Virtual function to mark a region as dirty in canvas.
This dirty region will be repainted in the next paint event.
*/
virtual void invalidate(const QRegion &r, bool translate = true) = 0;
virtual int canvasWidth() const;
virtual int canvasHeight() const;
int zValue(QZionObject *obj) const;
void setZValue(QZionObject *obj, int zValue);
/*!
Put the object \a obj in front of the reference object passed by \a ref.
Both objects must be in the Canvas.
*/
void stackAbove(QZionObject *obj, QZionObject *ref);
/*!
Put the object \a obj behind the reference object passed by \a ref.
Both objects must be in the Canvas.
*/
void stackBelow(QZionObject *obj, QZionObject *ref);
/*!
Bring an object to the front of the canvas.
\sa setZValue(), lower(), stackAbove(), stackBelow()
*/
void raise(QZionObject *obj);
/*!
Bring the object to the back of the canvas.
\sa setZValue(), raise(), stackBelow(), stackAbove()
*/
void lower(QZionObject *obj);
/*!
Add a QZionObject to this AbstractCanvas, removing it from a
previous AbstractCanvas if needed.
\sa removeObject()
*/
void addObject(QZionObject *obj);
/*!
Remove a QZionObject from this AbstractCanvas.
\sa addObject()
*/
void removeObject(QZionObject *obj);
virtual void updateChanges() = 0;
virtual QSize size() const = 0;
virtual void setSize(const QSize &size) = 0;
/*!
Translate a given point to local coordinates.
Defaults to the identity functions. QZionGroup should override it to
translate the point according to its position.
*/
virtual QPoint mapToLocal(const QPoint &pt) const;
typedef void(QZionObject::*memberMouseAction)(QMouseEvent *);
typedef void(QZionAbstractCanvas::*mouseAction)(QZionObject *,
QMouseEvent *);
/*!
\brief Handle Mouse Events: common code to all mouse events
Function that contains common code to all mouseEvents. It receives the
QMouseEvent to handle and what member functions must be called.
\sa mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent()
*/
virtual void mouseEventHandler(QMouseEvent *e, memberMouseAction m_ma,
mouseAction ma);
/*!
This function is called when an mouse Move event happens.
You shouldn't need to call it manually, but you can to simulate events
if needed.
*/
virtual void mouseMoveEvent(QMouseEvent *e);
/*!
This function is called when an mouse Press event happens.
You shouldn't need to call it manually, but you can to simulate events
if needed.
*/
virtual void mousePressEvent(QMouseEvent *e);
/*!
This function is called when an mouse Release event happens.
You shouldn't need to call it manually, but you can to simulate events
if needed.
*/
virtual void mouseReleaseEvent(QMouseEvent *e);
/*!
This function is called when a wheel event happens.
You shouldn't need to call it manually, but you can to simulate events
if needed.
*/
virtual void wheelEvent(QWheelEvent *e);
/*!
\internal
Shortcut function for tracking children Move event.
*/
virtual void mouseObjectMoveEvent(QZionObject *, QMouseEvent *) {}
/*!
\internal
Shortcut function for tracking children Press event.
*/
virtual void mouseObjectPressEvent(QZionObject *, QMouseEvent *) {}
/*!
\internal
Shortcut function for tracking children Release event.
*/
virtual void mouseObjectReleaseEvent(QZionObject *, QMouseEvent *) {}
/*!
\internal
Shortcut function for tracking children Wheel event.
*/
virtual void wheelObjectEvent(QZionObject *, QWheelEvent *) {}
protected:
QZionAbstractCanvasPrivate *_QZionAbstractCanvas_data;
private:
friend class QZionObjectPrivate;
friend class QZionAbstractCanvasPrivate;
};
#endif
|