2 * This file is a part of QComicBook.
4 * Copyright (C) 2005-2006 Pawel Stolowski <yogin@linux.bydg.org>
6 * QComicBook is free software; you can redestribute it and/or modify it
7 * under terms of GNU General Public License by Free Software Foundation.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY. See GPL for more details.
16 #include "imlibimage.h"
17 #include <qscrollview.h>
27 enum Size { Original, FitWidth, FitHeight, WholePage, BestFit };
28 //enum Scaling { Smooth, Fast };
29 enum Rotation { None, Left, Right };
33 class ComicImageView: public QScrollView
38 QPopupMenu *context_menu;
39 ImlibImageList orgimage[2];
42 int iangle; //rotation angle, 0..3, multipled by 90
43 int spdx, spdy; //scroll speed
45 int lx, ly; //last mouse position when tracking mouse moves
46 int wheelupcnt, wheeldowncnt;
48 static const int EXTRA_WHEEL_SPIN; //number of extra wheel spins to flip the page
50 // test - na potrzeby imlib
61 void resizeEvent(QResizeEvent *e);
62 void updateImageSize();
63 virtual void contentsContextMenuEvent(QContextMenuEvent *e);
64 virtual void contentsWheelEvent(QWheelEvent *e);
65 virtual void contentsMouseMoveEvent(QMouseEvent *e);
66 virtual void contentsMousePressEvent(QMouseEvent *e);
67 virtual void contentsMouseDoubleClickEvent(QMouseEvent *e);
68 virtual void contentsMouseReleaseEvent(QMouseEvent *e);
69 virtual void drawContents(QPainter *p, int clipx, int clipy, int clipw, int cliph);
72 void setImage(ImlibImage *img, bool preserveangle=false);
73 void setImage(ImlibImageList &imglist, bool preserveangle=false);
74 void setImage(ImlibImage *img1, ImlibImage *img2, bool preserveangle=false);
75 void setImage(ImlibImageList &imglist1, ImlibImageList &imglist2, bool preserveangle=false);
76 //void setScaling(Scaling s);
77 void setRotation(Rotation r);
79 void setSizeOriginal();
80 void setSizeFitWidth();
81 void setSizeFitHeight();
82 void setSizeWholePage();
83 void setSizeBestFit();
85 void scrollToBottom();
88 void scrollRightFast();
89 void scrollLeftFast();
93 void scrollDownFast();
100 void enableScrollbars(bool f);
101 void setBackground(const QColor &color);
102 void setSmallCursor(bool f);
105 ComicImageView(QWidget *parent, Size size=Original, const QColor &color=Qt::black);
109 QPopupMenu *contextMenu() const;
110 Size getSize() const;
111 int imageWidth() const;