blob: a403afd5216b6111b9b6776dd7cae373c6c4b9c2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
/***************************************************************************
imagemap.h - description
-------------------
begin : Wed Apr 4 2001
copyright : (C) 2001 by Jan Sch�fer
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 IMAGEMAP_H
#define IMAGEMAP_H
#include <tqscrollview.h>
#include <tqimage.h>
#include <tqpoint.h>
#include <tqrect.h>
#include "tdeversion.h"
/**
*@author Jan Sch�fer
*/
class KImageMapEditor;
class Area;
class ImageMap : public TQScrollView {
public:
enum DrawAction { None, DrawCircle, DrawRectangle, DrawPolygon, MoveSelectionPoint, MoveArea };
private:
TQRect imageRect;
TQPoint drawStart;
TQPoint drawCurrent;
TQPoint drawEnd;
bool eraseOldArea;
Area *oldArea;
// Holds the original image
TQImage image;
// Holds the zoomed image for efficiency reasons
TQPixmap zoomedImage;
Area *currentArea;
DrawAction currentAction;
TQRect *currentSelectionPoint;
KImageMapEditor *imageMapEditor;
double _zoom;
public:
ImageMap(TQWidget *parent,KImageMapEditor* _imageMapEditor);
~ImageMap();
void setZoom(double z);
void setPicture(const TQImage &_image);
void repaintArea(const Area & a);
TQImage picture() const;
TQPoint translateFromZoom(const TQPoint & p) const;
TQPoint translateToZoom(const TQPoint & p) const;
TQRect translateToZoom(const TQRect & p) const;
protected:
virtual void contentsMousePressEvent(TQMouseEvent* e);
virtual void contentsMouseDoubleClickEvent(TQMouseEvent* e);
virtual void contentsMouseReleaseEvent(TQMouseEvent *e);
virtual void contentsMouseMoveEvent(TQMouseEvent *e);
virtual void resizeEvent(TQResizeEvent* e);
virtual void drawContents(TQPainter* p,int clipx,int clipy,int clipw,int cliph);
};
inline TQImage ImageMap::picture() const {
return image;
}
#endif
|