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
28 class QTimer;
29 class QPixmap;
30 class QPainter;
31 class QImage;
32 class Action;
33 //--------------------
34 
35 #include <qlabel.h>
36 #include <qpixmap.h>
37 #include <qdatetime.h>
38 #include <qmutex.h>
39 
40 //=====================================
41 class ALabel : public QLabel
42 {
43 Q_OBJECT
44 //----------------------
45 public:
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);
66 protected:
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 //----------------------
80 signals:
81  void dropEventOccured( QDropEvent* e);
82 
84  void mousePress();
85  void mouseRelease();
86  void mouseDoubleClick();
87 
88  void pixmapRemoved();
89  //----------------------
90 private slots:
91  void animate();
92 //----------------------
93 private:
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
121  QPixmap* hoverOverImage;
122 
123  //is picture fully shown?
125 
126  //is hand cursor shown?
128 
129  //are we animating?
130  bool animating;
132 
133  //are we preforming a reset action?
135 
136  //queue of actions
139  QMutex queueMutex;
140 //----------------------
141 };
142 //======================
143 
144 
145 //======================
146 class Action
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
void setPixmap(const QPixmap &p)
animates setting an image
Definition: ALabel.cpp:81
QPixmap * hoverOverImage
Definition: ALabel.h:121
bool resettingImage
Definition: ALabel.h:134
int initDelay
Definition: ALabel.h:109
void mouseReleaseEvent(QMouseEvent *)
Definition: ALabel.cpp:505
void cleanStack()
Definition: ALabel.cpp:573
QTime currentTime
Definition: ALabel.h:114
bool drawHoverOverImage
Definition: ALabel.h:117
void paintEvent(QPaintEvent *pe)
Definition: ALabel.cpp:450
void internalSetPixmap(const QPixmap &p)
Definition: ALabel.cpp:104
QImage * resetPixStore
Definition: ALabel.h:100
void pixmapRemoved()
int accel
Definition: ALabel.h:109
void leaveEvent(QEvent *e)
Definition: ALabel.cpp:493
void mousePress()
various mouse-click signals
void removePixmap(bool forceImmediate=false)
animates removing an image
Definition: ALabel.cpp:136
QImage * pixStore
Definition: ALabel.h:100
void internalRemovePixmap(bool forceImmediate=false)
Definition: ALabel.cpp:164
Definition: ALabel.h:146
void dropEventOccured(QDropEvent *e)
QMutex animatingBoolMutex
Definition: ALabel.h:131
Definition: ALabel.h:41
int minDelay
Definition: ALabel.h:109
#define DISAPPEAR_IMMEDIATELY
Definition: ALabel.h:19
QPixmap * image
Definition: ALabel.h:156
void mouseRelease()
QTimer * timer
Definition: ALabel.h:113
int delay
Definition: ALabel.h:109
void animate()
Definition: ALabel.cpp:197
void mouseMoveEvent(QMouseEvent *)
Definition: ALabel.cpp:539
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
QRect hoverOverRect
Definition: ALabel.h:118
void mouseDoubleClick()
void enterEvent(QEvent *e)
Definition: ALabel.cpp:484
int removalBeforeResetMethod
Definition: ALabel.h:105
Action * next
Definition: ALabel.h:157
int step
Definition: ALabel.h:110
bool animating
Definition: ALabel.h:130
Action * delayedActionHead
Definition: ALabel.h:137
void mouseDoubleClickEvent(QMouseEvent *)
Definition: ALabel.cpp:536
Action * delayedActionTail
Definition: ALabel.h:138
int removalMethod
Definition: ALabel.h:104
int animationType
Definition: ALabel.h:109
void mousePressEvent(QMouseEvent *)
Definition: ALabel.cpp:502
int setMethod
Definition: ALabel.h:103
QMutex queueMutex
Definition: ALabel.h:139
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
#define APPEAR_IMMEDIATELY
Definition: ALabel.h:18
QTime lastTime
Definition: ALabel.h:114
bool handCursorShown
Definition: ALabel.h:127
int resetMethod
Definition: ALabel.h:106
bool imageShown
Definition: ALabel.h:124
void animatePixmap()
begin animating the pixmap
Definition: ALabel.cpp:175
void appendJob(QPixmap *pix)
Definition: ALabel.cpp:562