diff options
Diffstat (limited to 'src/sidebar/sq_previewwidget.h')
-rw-r--r-- | src/sidebar/sq_previewwidget.h | 132 |
1 files changed, 132 insertions, 0 deletions
diff --git a/src/sidebar/sq_previewwidget.h b/src/sidebar/sq_previewwidget.h new file mode 100644 index 0000000..25e8c37 --- /dev/null +++ b/src/sidebar/sq_previewwidget.h @@ -0,0 +1,132 @@ +/*************************************************************************** + sq_previewwidget.h - description + ------------------- + begin : ??? Mar 13 2007 + copyright : (C) 2007 by Baryshev Dmitry + email : [email protected] + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef SQ_PREVIEWWIDGET_H +#define SQ_PREVIEWWIDGET_H + +#include <tqwidget.h> +#include <tqpixmap.h> +#include <tqcolor.h> +#include <tqwmatrix.h> +#include <tqimage.h> + +#include <kurl.h> + +class TDEPopupMenu; + +class SQ_Downloader; + +/** + *@author Baryshev Dmitry + */ + +class SQ_PreviewWidget : public TQWidget +{ + TQ_OBJECT + + + public: + SQ_PreviewWidget(TQWidget *parent = 0, const char *name = 0); + ~SQ_PreviewWidget(); + + void rereadColor(); + + void load(const KURL &url); + + void ignore(bool ign); + + void loadPending(); + + static SQ_PreviewWidget* instance() { return m_inst; } + + int delay() const; + + bool cancel() const; + + KURL url() const; + + private: + void saveValues(); + + signals: + void next(); + void previous(); + void execute(); + void first(); + void last(); + + private slots: + void slotBackground(); + void slotText(); + void slotDownloadResult(const KURL &); + void slotDownloadPercents(int); + + protected: + virtual void resizeEvent(TQResizeEvent *); + virtual void paintEvent(TQPaintEvent *); + virtual void mousePressEvent(TQMouseEvent *e); + virtual void keyPressEvent(TQKeyEvent *e); + virtual void wheelEvent(TQWheelEvent *e); + virtual void mouseDoubleClickEvent(TQMouseEvent *e); + + private: + bool fit(); + void fitAndConvert(); + + private: + TQImage *all, *small; + TQPixmap pixmap; + bool m_ignore, m_forceignore, m_cancel; + TQColor color, colorText; + TDEPopupMenu *popup; + KURL pending, m_url; + int m_delay; + TQWMatrix matrix; + SQ_Downloader *down; + bool multi; + TQPixmap multi_pix; + TQString dimstring, percentString; + bool dim; + + static SQ_PreviewWidget *m_inst; +}; + +inline +void SQ_PreviewWidget::ignore(bool ign) +{ + m_ignore = ign; +} + +inline +int SQ_PreviewWidget::delay() const +{ + return m_delay; +} + +inline +bool SQ_PreviewWidget::cancel() const +{ + return m_cancel; +} + +inline +KURL SQ_PreviewWidget::url() const +{ + return m_url; +} + +#endif |