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 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345
|
// -*- Mode: c++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 4; -*-
/* This file is part of the KDE project
Copyright (C) 2004 Thorsten Zachmann <zachmann@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef EFFECTHANDLER_H
#define EFFECTHANDLER_H
#include <qpixmap.h>
#include <qptrlist.h>
#include <qstring.h>
#include "global.h"
#include "presstep.h"
class QPaintDevice;
class KPrObject;
class KPrView;
class KPrEffectHandler
{
public:
/**
* Creates an EffectsHandler for the effect step step and the effect sub step subStep.
* step the effect step for which the effect should be displayed
* subStep the sub effect step for which the effect should be displayed
* back set to true if the effect step was reached by going backwards
* dst the paint device on which the Effects will be shown
* src this pixmap holds the pixmap before any effects are started
* objects all objects of the page
* view pointer to the active KPrView
*/
KPrEffectHandler( PresStep step, bool back, QPaintDevice *dst, QPixmap *src, const QPtrList<KPrObject> &objects, KPrView *view, int _presSpeed );
/**
* Delete the KPrEffectHandler.
*/
~KPrEffectHandler();
/**
* doEffect handle the next step of the object effect.
* Returns true if all effects in the current step are finished.
* In automatic presentation mode:
* On the first step it stops the automatic presentation timer.
* The automatic presentation timer will be restared when all
* effects are done.
*/
bool doEffect();
/**
* Ends the effect for the current step by displaying all objects
* on their final position.
* In automatic presentation mode:
* Restarts the automatic presentation timer.
*/
void finish();
protected:
/**
* Calls the right appear effect method for the object object.
* Returns true if the effect for the object is finished.
*/
bool doAppearEffectStep( KPrObject *object );
/**
* Calls the right disappear effect method for the object object.
* Returns true if the effect for the object is finished.
*/
bool doDisappearEffectStep( KPrObject *object );
/**
* Effect None
* The object just appears on its position
* Returns allways true as the object is in is final position.
*/
bool appearNone( KPrObject *object );
/**
* Effect Come From Left
* The object comes in from the left to its position
* Returns true if the object is on its final position.
*/
bool appearComeLeft( KPrObject *object );
/**
* Effect Come From Top
* The object comes in from the top to its position
* Returns true if the object is on its final position.
*/
bool appearComeTop( KPrObject *object );
/**
* Effect Come From Right
* The object comes in from the right to its position
* Returns true if the object is on its final position.
*/
bool appearComeRight( KPrObject *object );
/**
* Effect Come From Bottom
* The object comes in from the bottom to its position
* Returns true if the object is on its final position.
*/
bool appearComeBottom( KPrObject *object );
/**
* Effect Come From Left/Top
* The object comes in from the top left corner to its position
* Returns true if the object is on its final position.
*/
bool appearComeLeftTop( KPrObject *object );
/**
* Effect Come From Left/Buttom
* The object comes in from the bottom left corner to its position
* Returns true if the object is on its final position.
*/
bool appearComeLeftBottom( KPrObject *object );
/**
* Effect Come From Right/Top
* The object comes in from the top right corner to its position
* Returns true if the object is on its final position.
*/
bool appearComeRightTop( KPrObject *object );
/**
* Effect Come From Right/Buttom
* The object comes in from the bottom right corner to its position
* Returns true if the object is on its final position.
*/
bool appearComeRightBottom( KPrObject *object );
/**
* Effect Wipe From Left
* Returns true if the object is fully shown.
*/
bool appearWipeLeft( KPrObject *object );
/**
* Effect Wipe From Right
* Returns true if the object is fully shown.
*/
bool appearWipeRight( KPrObject *object );
/**
* Effect Wipe From Top
* Returns true if the object is fully shown.
*/
bool appearWipeTop( KPrObject *object );
/**
* Effect Wipe From Bottom
* Returns true if the object is fully shown.
*/
bool appearWipeBottom( KPrObject *object );
/**
* Effect Disappear To Left
* The object moves from it's position to the left out of the screen
* Returns true if the object is out of the screen.
*/
bool disappearGoLeft( KPrObject *object );
/**
* Effect Disappear To Right
* The object moves from it's position to the right out of the screen
* Returns true if the object is out of the screen.
*/
bool disappearGoRight( KPrObject *object );
/**
* Effect Disappear To Top
* The object moves from it's position to the top out of the screen
* Returns true if the object is out of the screen.
*/
bool disappearGoTop( KPrObject *object );
/**
* Effect Disappear To Bottom
* The object moves from it's position to the bottom out of the screen
* Returns true if the object is out of the screen.
*/
bool disappearGoBottom( KPrObject *object );
/**
* Effect Disappear To Left/Top
* The object moves from it's position to the top left out of the screen
* Returns true if the object is out of the screen.
*/
bool disappearGoLeftTop( KPrObject *object );
/**
* Effect Disappear To Left/Bottom
* The object moves from it's position to the bottom left out of the screen
* Returns true if the object is out of the screen.
*/
bool disappearGoLeftBottom( KPrObject *object );
/**
* Effect Disappear To Right/Top
* The object moves from it's position to the top right out of the screen
* Returns true if the object is out of the screen.
*/
bool disappearGoRightTop( KPrObject *object );
/**
* Effect Disappear To Right/Bottom
* The object moves from it's position to the bottom right out of the screen
* Returns true if the object is out of the screen.
*/
bool disappearGoRightBottom( KPrObject *object );
/**
* Effect Wipe From Left
* Returns true if the object is fully shown.
*/
bool disappearWipeLeft( KPrObject *object );
/**
* Effect Wipe From Right
* Returns true if the object is fully shown.
*/
bool disappearWipeRight( KPrObject *object );
/**
* Effect Wipe From Top
* Returns true if the object is fully shown.
*/
bool disappearWipeTop( KPrObject *object );
/**
* Effect Wipe From Bottom
* Returns true if the object is fully shown.
*/
bool disappearWipeBottom( KPrObject *object );
/**
* Draws the object object to the pixmap screen with the offset defined
* in x and y. If clipRect is set the only the clipRect will be painted.
*/
void drawObject( KPrObject *object, int x, int y, QPixmap *screen, QRect *clipRect = 0 );
/**
* The internal step of the effect. This is used to calculate the position
* of the object.
*/
int m_effectStep;
/**
* The effect step which should be animated.
*/
PresStep m_step;
/**
* True when the effect step was reached by going backwards
*/
bool m_back;
/**
* Paint device on which the effects will be displayed
*/
QPaintDevice *m_dst;
/**
* Pixmap used as source for displaying on.
* m_src contains all objects which are allready on the
* final position.
*/
QPixmap *m_src;
/**
* Is used for printing all objects before bitblt to m_dst
*/
QPixmap m_paint;
/**
* List of all objects of the current page
*/
QPtrList<KPrObject> m_objects;
/**
* List of all objects which appear in the current step.
* If a object has reached its final position it is removed from
* this list
*/
QPtrList<KPrObject> m_appearEffectObjects;
/**
* List of all objects which disappear in the current step.
* If a object has disappeared it is removed from this list
*/
QPtrList<KPrObject> m_disappearEffectObjects;
/// the active KPrView
KPrView *m_view;
/**
* The width of a step.
*/
int m_stepWidth;
/**
* The height of a step.
*/
int m_stepHeight;
/**
* The rects which have to be bitblt
*/
QPtrList<QRect> m_repaintRects;
/**
* The rects which have to be bitblt as the objects
* are no longer there.
*/
QPtrList<QRect> m_lastRepaintRects;
/**
* The filename of the sound file which should be played during the effect.
*/
QString m_soundEffect;
/**
* Used the set the autopresentation timer.
*/
int m_objectTimer;
};
#endif /* EFFECTHANDLER_H */
|