AlbumShaper 1.0a3
ALabel.h
Go to the documentation of this file.
1//Added by qt3to4:
2#include <QEvent>
3#include <QDropEvent>
4#include <QMouseEvent>
5//==============================================
6// copyright : (C) 2003-2005 by Will Stokes
7//==============================================
8// This program is free software; you can redistribute it
9// and/or modify it under the terms of the GNU General
10// Public License as published by the Free Software
11// Foundation; either version 2 of the License, or
12// (at your option) any later version.
13//==============================================
14
15#ifndef GUI_ALABEL_H
16#define GUI_ALABEL_H
17
18#define APPEAR_IMMEDIATELY 1
19#define DISAPPEAR_IMMEDIATELY 2
20#define SLIDE_IN_LEFT 3
21#define SLIDE_OUT_LEFT 4
22#define SLIDE_IN_RIGHT 5
23#define SLIDE_OUT_RIGHT 6
24#define FADE_TRANSITION 7
25
26//--------------------
27//forward declarations
28class QTimer;
29class QPixmap;
30class QPainter;
31class QImage;
32class Action;
33//--------------------
34
35#include <qlabel.h>
36#include <qpixmap.h>
37#include <qdatetime.h>
38#include <qmutex.h>
39
40//=====================================
41class ALabel : public QLabel
42{
43Q_OBJECT
44//----------------------
45public:
47 ALabel( QWidget *parent=0, const char* name=0,
48 QPixmap* hoverOverImage = NULL,
53 int initDelay = 130, int accel = 50);
54
60
62 void setPixmap ( const QPixmap &p );
63
65 void removePixmap( bool forceImmediate = false);
66protected:
68 void animatePixmap( );
69
70 void paintEvent( QPaintEvent* pe);
71
72 void enterEvent( QEvent* e);
73 void leaveEvent( QEvent* e);
74
75 void mousePressEvent( QMouseEvent* );
76 void mouseReleaseEvent( QMouseEvent* );
77 void mouseDoubleClickEvent( QMouseEvent* );
78 void mouseMoveEvent( QMouseEvent* );
79//----------------------
80signals:
81 void dropEventOccured( QDropEvent* e);
82
84 void mousePress();
87
89 //----------------------
90private slots:
91 void animate();
92//----------------------
93private:
94 void internalRemovePixmap( bool forceImmediate = false );
95 void internalSetPixmap ( const QPixmap &p );
96 void appendJob(QPixmap* pix);
97 void cleanStack();
98
99 //actual and reset images
101
102 //method for removing old images when doing a set
107
108 //specs for ongoing animation
110 int step;
111
112 //timer and time variables for ongoing animation
113 QTimer* timer;
115
116 //should hover-over image be drawn on repaint?
119
120 //hover-overimage
122
123 //is picture fully shown?
125
126 //is hand cursor shown?
128
129 //are we animating?
132
133 //are we preforming a reset action?
135
136 //queue of actions
140//----------------------
141};
142//======================
143
144
145//======================
147{
148 public:
149 Action(QPixmap* image);
150 ~Action();
151 Action* getNext();
152 void setNext( Action* next);
153 QPixmap* getImage();
154
155 private:
156 QPixmap* image;
158};
159//======================
160
161
162#endif //GUI_ALABEL_H
#define APPEAR_IMMEDIATELY
Definition ALabel.h:18
#define DISAPPEAR_IMMEDIATELY
Definition ALabel.h:19
void mouseRelease()
Action * delayedActionHead
Definition ALabel.h:137
void cleanStack()
Definition ALabel.cpp:573
void mouseDoubleClickEvent(QMouseEvent *)
Definition ALabel.cpp:536
bool handCursorShown
Definition ALabel.h:127
int initDelay
Definition ALabel.h:109
QRect hoverOverRect
Definition ALabel.h:118
QPixmap * hoverOverImage
Definition ALabel.h:121
void paintEvent(QPaintEvent *pe)
Definition ALabel.cpp:450
void mouseDoubleClick()
ALabel(QWidget *parent=0, const char *name=0, QPixmap *hoverOverImage=NULL, int setMethod=APPEAR_IMMEDIATELY, int removalMethod=DISAPPEAR_IMMEDIATELY, int resetMethod=APPEAR_IMMEDIATELY, int removalBeforeResetMethod=DISAPPEAR_IMMEDIATELY, int initDelay=130, int accel=50)
create the label, optionally set a hover-over image (only displayed when pixmap for label is set and ...
Definition ALabel.cpp:29
bool imageShown
Definition ALabel.h:124
void mouseReleaseEvent(QMouseEvent *)
Definition ALabel.cpp:505
bool animating
Definition ALabel.h:130
int removalBeforeResetMethod
Definition ALabel.h:105
QTime lastTime
Definition ALabel.h:114
void animatePixmap()
begin animating the pixmap
Definition ALabel.cpp:175
int removalMethod
Definition ALabel.h:104
void mousePress()
various mouse-click signals
void mouseMoveEvent(QMouseEvent *)
Definition ALabel.cpp:539
void animate()
Definition ALabel.cpp:197
Action * delayedActionTail
Definition ALabel.h:138
void internalRemovePixmap(bool forceImmediate=false)
Definition ALabel.cpp:164
bool resettingImage
Definition ALabel.h:134
int animationType
Definition ALabel.h:109
void enterEvent(QEvent *e)
Definition ALabel.cpp:484
QMutex animatingBoolMutex
Definition ALabel.h:131
int delay
Definition ALabel.h:109
QImage * pixStore
Definition ALabel.h:100
int minDelay
Definition ALabel.h:109
void leaveEvent(QEvent *e)
Definition ALabel.cpp:493
QTime currentTime
Definition ALabel.h:114
QMutex queueMutex
Definition ALabel.h:139
void appendJob(QPixmap *pix)
Definition ALabel.cpp:562
void internalSetPixmap(const QPixmap &p)
Definition ALabel.cpp:104
QImage * resetPixStore
Definition ALabel.h:100
void pixmapRemoved()
void setPixmap(const QPixmap &p)
animates setting an image
Definition ALabel.cpp:81
int accel
Definition ALabel.h:109
void dropEventOccured(QDropEvent *e)
int setMethod
Definition ALabel.h:103
int step
Definition ALabel.h:110
void removePixmap(bool forceImmediate=false)
animates removing an image
Definition ALabel.cpp:136
void setAnimationMethods(int setMethod=APPEAR_IMMEDIATELY, int removalMethod=DISAPPEAR_IMMEDIATELY, int resetMethod=APPEAR_IMMEDIATELY, int removalBeforeResetMethod=DISAPPEAR_IMMEDIATELY)
alter animation methods
Definition ALabel.cpp:71
void mousePressEvent(QMouseEvent *)
Definition ALabel.cpp:502
bool drawHoverOverImage
Definition ALabel.h:117
int resetMethod
Definition ALabel.h:106
QTimer * timer
Definition ALabel.h:113
Action(QPixmap *image)
Definition ALabel.cpp:642
Action * getNext()
Definition ALabel.cpp:654
QPixmap * image
Definition ALabel.h:156
Action * next
Definition ALabel.h:157
~Action()
Definition ALabel.cpp:648
void setNext(Action *next)
Definition ALabel.cpp:657
QPixmap * getImage()
Definition ALabel.cpp:660