diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | ce599e4f9f94b4eb00c1b5edb85bce5431ab3df2 (patch) | |
tree | d3bb9f5d25a2dc09ca81adecf39621d871534297 /kgeography/src/mapwidget.h | |
download | tdeedu-ce599e4f9f94b4eb00c1b5edb85bce5431ab3df2.tar.gz tdeedu-ce599e4f9f94b4eb00c1b5edb85bce5431ab3df2.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeedu@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kgeography/src/mapwidget.h')
-rw-r--r-- | kgeography/src/mapwidget.h | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/kgeography/src/mapwidget.h b/kgeography/src/mapwidget.h new file mode 100644 index 00000000..282fa1b4 --- /dev/null +++ b/kgeography/src/mapwidget.h @@ -0,0 +1,69 @@ +/*************************************************************************** + * Copyright (C) 2004-2005 by Albert Astals Cid * + * tsdgeos@terra.es * + * * + * 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 MAPWIDGET_H +#define MAPWIDGET_H + +#include <qimage.h> +#include <qpoint.h> +#include <qwidget.h> + +class mapWidget : public QWidget +{ +Q_OBJECT + public: + mapWidget(QWidget *parent); + + void init(const QString &path, int scrollBarWidth, int scrollBarHeight); + + void setMapMove(bool b); + void setMapZoom(bool b); + + QSize sizeHint() const; + QSize mapSize() const; + + public slots: + void updateHPosition(int value); + void updateVPosition(int value); + void setOriginalImage(); + + signals: + void setMoveActionChecked(bool b); + void setZoomActionChecked(bool b); + void setMoveActionEnabled(bool b); + void clicked(QRgb, const QPoint&); + void updatePosition(int X, int Y); + void updateVisibleSize(int w, int h); + void updateMaximumSize(int w, int h); + + protected: + void mousePressEvent(QMouseEvent *e); + void mouseMoveEvent(QMouseEvent *e); + void mouseReleaseEvent(QMouseEvent *e); + void resizeEvent(QResizeEvent *e); + + private: + void emitMoveActionEnabled(); + QImage *getCurrentImage(); + void updateShownImage(); + + QImage p_originalImage, p_zoomedImageShown; + bool p_zooming, p_wantZoom, p_moving, p_wantMove; + QPoint p_initial, p_prev; // rubberbanding and moving + int p_zoomX, p_zoomY, p_zoomW, p_zoomH; + double p_lastFactorX, p_lastFactorY; + // useful to not do that many updateShownImage + QSize p_oldSize; + int p_oldZoomX, p_oldZoomY, p_oldZoomW, p_oldZoomH; + int p_scrollBarWidth, p_scrollBarHeight; + bool p_scrollBarsVisible; +}; + +#endif |