00001 /*************************************************************************** 00002 * * 00003 * DrawPad - a drawing program for Opie Environment * 00004 * * 00005 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> * 00006 * * 00007 * This program is free software; you can redistribute it and/or modify * 00008 * it under the terms of the GNU General Public License as published by * 00009 * the Free Software Foundation; either version 2 of the License, or * 00010 * (at your option) any later version. * 00011 * * 00012 ***************************************************************************/ 00013 00014 #ifndef THUMBNAILVIEW_H 00015 #define THUMBNAILVIEW_H 00016 00017 #include <qlistbox.h> 00018 #include <qwidget.h> 00019 00020 class DrawPad; 00021 class DrawPadCanvas; 00022 class Page; 00023 00024 #include <qdatetime.h> 00025 00026 class QToolButton; 00027 00028 class PageListBoxItem : public QListBoxItem 00029 { 00030 public: 00031 PageListBoxItem(Page* page, QListBox* parent); 00032 ~PageListBoxItem(); 00033 00034 int height(const QListBox* lb) const; 00035 int width(const QListBox* lb) const; 00036 void paint(QPainter *painter); 00037 00038 Page* page() const; 00039 00040 private: 00041 QString dateTimeString(QDateTime dateTime); 00042 00043 Page* m_pPage; 00044 00045 QPixmap m_thumbnail; 00046 00047 QString m_titleText; 00048 QString m_dimensionText; 00049 QString m_dateText; 00050 00051 QColor m_alternateColor; 00052 }; 00053 00054 class PageListBox : public QListBox 00055 { 00056 public: 00057 PageListBox(DrawPadCanvas* drawPadCanvas, QWidget* parent = 0, const char* name = 0); 00058 ~PageListBox(); 00059 00060 void updateView(); 00061 00062 void select(Page* page); 00063 Page* selected() const; 00064 00065 private: 00066 DrawPadCanvas* m_pDrawPadCanvas; 00067 }; 00068 00069 class ThumbnailView : public QWidget 00070 { 00071 Q_OBJECT 00072 00073 public: 00074 ThumbnailView(DrawPad* drawPad, DrawPadCanvas* drawPadCanvas, QWidget* parent = 0, const char* name = 0); 00075 ~ThumbnailView(); 00076 00077 void updateView(); 00078 00079 void hide(); 00080 void exec(); 00081 00082 public slots: 00083 void newPage(); 00084 void clearPage(); 00085 void deletePage(); 00086 void movePageUp(); 00087 void movePageDown(); 00088 void changePage(); 00089 00090 private: 00091 bool inLoop; 00092 00093 DrawPad* m_pDrawPad; 00094 DrawPadCanvas* m_pDrawPadCanvas; 00095 00096 QToolButton* m_pMovePageUpButton; 00097 QToolButton* m_pMovePageDownButton; 00098 00099 PageListBox* m_pPageListBox; 00100 }; 00101 00102 #endif // THUMBNAILVIEW_H
1.4.2