chalk

kis_strategy_move.h
1/*
2 * Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18
19#ifndef KIS_STRATEGY_MOVE_H_
20#define KIS_STRATEGY_MOVE_H_
21
22#include <tqpoint.h>
23#include <tqrect.h>
24
25#include <koffice_export.h>
26
29
30class KRITAUI_EXPORT KisStrategyMove {
31public:
32 KisStrategyMove();
33 explicit KisStrategyMove(KisCanvasSubject *subject);
34 virtual ~KisStrategyMove();
35
36public:
37 void reset(KisCanvasSubject *subject);
38 void startDrag(const TQPoint& pos);
39 void drag(const TQPoint& pos);
40 void endDrag(const TQPoint& pos, bool undo = true);
41 void simpleMove(const TQPoint& pt1, const TQPoint& pt2);
42 void simpleMove(TQ_INT32 x1, TQ_INT32 y1, TQ_INT32 x2, TQ_INT32 y2);
43
44private:
45 KisStrategyMove(const KisStrategyMove&);
46 KisStrategyMove& operator=(const KisStrategyMove&);
47
48private:
49 KisCanvasController *m_controller;
50 KisCanvasSubject *m_subject;
51 TQRect m_deviceBounds;
52 TQPoint m_dragStart;
53 TQPoint m_layerStart;
54 TQPoint m_layerPosition;
55 bool m_dragging;
56};
57
58#endif // KIS_STRATEGY_MOVE_H_
59
Interface for classes that implement a canvas; i.e., a widget where KisImages are painted onto.
KisCanvasSubject is part of the Observer pattern.