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 <qscrollview.h>
26 enum Size { Original, FitWidth, FitHeight, WholePage, BestFit };
27 //enum Scaling { Smooth, Fast };
28 enum Rotation { None, Left, Right };
32 class ComicImageView: public QScrollView
37 QPopupMenu *context_menu;
38 ImlibImage *orgimage[2];
41 int iangle; //rotation angle, 0..3, multipled by 90
42 int spdx, spdy; //scroll speed
44 int lx, ly; //last mouse position when tracking mouse moves
45 int wheelupcnt, wheeldowncnt;
47 static const int EXTRA_WHEEL_SPIN; //number of extra wheel spins to flip the page
49 // test - na potrzeby imlib
60 void resizeEvent(QResizeEvent *e);
61 void updateImageSize();
62 virtual void contentsContextMenuEvent(QContextMenuEvent *e);
63 virtual void contentsWheelEvent(QWheelEvent *e);
64 virtual void contentsMouseMoveEvent(QMouseEvent *e);
65 virtual void contentsMousePressEvent(QMouseEvent *e);
66 virtual void contentsMouseDoubleClickEvent(QMouseEvent *e);
67 virtual void contentsMouseReleaseEvent(QMouseEvent *e);
68 virtual void drawContents(QPainter *p, int clipx, int clipy, int clipw, int cliph);
71 void setImage(ImlibImage *img, bool preserveangle=false);
72 void setImage(ImlibImage *img1, ImlibImage *img2, bool preserveangle=false);
73 //void setScaling(Scaling s);
74 void setRotation(Rotation r);
76 void setSizeOriginal();
77 void setSizeFitWidth();
78 void setSizeFitHeight();
79 void setSizeWholePage();
80 void setSizeBestFit();
82 void scrollToBottom();
85 void scrollRightFast();
86 void scrollLeftFast();
90 void scrollDownFast();
97 void enableScrollbars(bool f);
98 void setBackground(const QColor &color);
99 void setSmallCursor(bool f);
102 ComicImageView(QWidget *parent, Size size=Original, const QColor &color=Qt::black);
106 QPopupMenu *contextMenu() const;
107 Size getSize() const;
108 int imageWidth() const;