AlbumShaper
1.0a3
|
00001 //============================================== 00002 // copyright : (C) 2003-2005 by Will Stokes 00003 //============================================== 00004 // This program is free software; you can redistribute it 00005 // and/or modify it under the terms of the GNU General 00006 // Public License as published by the Free Software 00007 // Foundation; either version 2 of the License, or 00008 // (at your option) any later version. 00009 //============================================== 00010 00011 #ifndef GUI_PHOTODESCEDIT_H 00012 #define GUI_PHOTODESCEDIT_H 00013 00014 //-------------------- 00015 //forward declarations 00016 class QGridLayout; 00017 class QLabel; 00018 class QTimer; 00019 class QImage; 00020 class QPixmap; 00021 class QTextEdit; 00022 class PhotoPreviewWidget; 00023 class TextEdit; 00024 //-------------------- 00025 00026 #define STATIC 0 00027 #define APPEARING 1 00028 #define DISAPPEARING 2 00029 #define DISAPPEARED 3 00030 00031 #include <qwidget.h> 00032 #include <qdatetime.h> 00033 #include <qtextedit.h> 00034 //===================================== 00035 class PhotoDescEdit : public QWidget 00036 { 00037 Q_OBJECT 00038 //---------------------- 00039 public: 00040 PhotoDescEdit( PhotoPreviewWidget* ppw, bool useAnimation, QWidget *parent=0, const char* name=0); 00041 ~PhotoDescEdit(); 00042 //---------------------- 00043 public slots: 00044 void hide(); 00045 //---------------------- 00046 private slots: 00048 void animate(); 00049 00052 void disappear(); 00053 //---------------------- 00054 private: 00056 bool useAnimation; 00057 00059 PhotoPreviewWidget* ppw; 00060 00062 QImage *imageLarge; 00063 00065 QImage* textRectangle; 00066 00067 //beginning and end positions of the photo 00068 QPoint initPos, finalPos; 00069 00071 int left, right, top, bottom; 00072 00074 int idealTextSize; 00075 00078 QPixmap* backgroundImage; 00079 00081 int smallWidth, smallHeight; 00083 //Main grid 00084 QGridLayout* mainGrid; 00087 00089 QLabel* animationLabel; 00090 00092 QPixmap* buffer; 00095 00097 QGridLayout* staticGrid; 00098 00100 QWidget* staticFrame; 00101 00103 QLabel* staticPhoto; 00104 00106 TextEdit* photoDesc; 00109 00110 //timer stuff 00111 int initDelay, accel, minDelay, step, delay; 00112 00113 //appearing or disappearing 00114 int mode; 00115 00117 bool dropShadowsEnabled; 00118 00119 //timer and time variables for ongoing animation 00120 QTimer* timer; 00121 QTime lastTime, currentTime; 00123 }; 00124 00125 //====================== 00126 class TextEdit : public QTextEdit 00127 { 00128 Q_OBJECT 00129 //---------------------- 00130 public: 00131 TextEdit(QWidget *parent=0, const char* name=0); 00132 void paintNow(); 00133 //---------------------- 00134 private: 00135 QPopupMenu* contextMenu; 00136 //---------------------- 00137 protected: 00138 void keyPressEvent ( QKeyEvent* e ); 00139 void focusOutEvent ( QFocusEvent* ); 00140 QPopupMenu* createPopupMenu ( const QPoint& pos ); 00141 //---------------------- 00142 signals: 00143 void finished(); 00144 //---------------------- 00145 private slots: 00146 void contextMenuHiding(); 00147 }; 00148 //====================== 00149 00150 00151 00152 #endif //GUI_PHOTODESCEDIT_H