summaryrefslogtreecommitdiffstats
path: root/examples/chart/canvasview.h
blob: 55b5d25c0edc77e677b86d8d0c914a54fa5631f1 (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
#ifndef CANVASVIEW_H
#define CANVASVIEW_H

#include "element.h"
#include "canvastext.h"

#include <qcanvas.h>


class TQPoint;


class CanvasView : public TQCanvasView
{
    Q_OBJECT
public:
    CanvasView( TQCanvas *canvas, ElementVector *elements,
		TQWidget* parent = 0, const char* name = "canvas view",
		WFlags f = 0 )
	: TQCanvasView( canvas, parent, name, f ), m_movingItem(0),
	  m_elements( elements ) {}

protected:
    void viewportResizeEvent( TQResizeEvent *e );
    void contentsMousePressEvent( TQMouseEvent *e );
    void contentsMouseMoveEvent( TQMouseEvent *e );
    void contentsContextMenuEvent( TQContextMenuEvent *e );

private:
    TQCanvasItem *m_movingItem;
    TQPoint m_pos;
    ElementVector *m_elements;
};


#endif