You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ksquirrel/ksquirrel/sidebar/sq_previewwidget.h

133 lines
3.1 KiB

/***************************************************************************
sq_previewwidget.h - description
-------------------
begin : ??? Mar 13 2007
copyright : (C) 2007 by Baryshev Dmitry
email : ksquirrel.iv@gmail.com
***************************************************************************/
/***************************************************************************
* *
* 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 KPopupMenu;
class SQ_Downloader;
/**
*@author Baryshev Dmitry
*/
class SQ_PreviewWidget : public TQWidget
{
Q_OBJECT
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;
KPopupMenu *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