chalk

kis_tool_non_paint.cpp
1/*
2 * Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
3 * Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19
20#include <kdebug.h>
21
22#include "kis_image.h"
23#include "kis_canvas_subject.h"
24#include "kis_canvas_controller.h"
25#include "kis_tool_controller.h"
26#include "kis_tool_non_paint.h"
27
28KisToolNonPaint::KisToolNonPaint(const TQString & UIName)
29 : super(UIName)
30{
31 m_subject = 0;
32}
33
34KisToolNonPaint::~KisToolNonPaint()
35{
36}
37
38void KisToolNonPaint::update(KisCanvasSubject *subject)
39{
40 m_subject = subject;
41}
42
43void KisToolNonPaint::paint(KisCanvasPainter&)
44{
45}
46
47void KisToolNonPaint::paint(KisCanvasPainter&, const TQRect&)
48{
49}
50
51void KisToolNonPaint::deactivate()
52{
53}
54
55void KisToolNonPaint::buttonPress(KisButtonPressEvent *)
56{
57}
58
59void KisToolNonPaint::move(KisMoveEvent *)
60{
61}
62
63void KisToolNonPaint::buttonRelease(KisButtonReleaseEvent *)
64{
65}
66
67void KisToolNonPaint::doubleClick(KisDoubleClickEvent *)
68{
69}
70
71void KisToolNonPaint::keyPress(TQKeyEvent *)
72{
73}
74
75void KisToolNonPaint::keyRelease(TQKeyEvent *)
76{
77}
78
79TQCursor KisToolNonPaint::cursor()
80{
81 return m_cursor;
82}
83
84void KisToolNonPaint::setCursor(const TQCursor& cursor)
85{
86 m_cursor = cursor;
87
88 if (m_subject) {
89 KisToolControllerInterface *controller = m_subject->toolController();
90
91 if (controller && controller->currentTool() == this) {
92 m_subject->canvasController()->setCanvasCursor(m_cursor);
93 }
94 }
95}
96
97void KisToolNonPaint::activate()
98{
99 if (m_subject) {
100 KisToolControllerInterface *controller = m_subject->toolController();
101
102 if (controller)
103 controller->setCurrentTool(this);
104 }
105}
106
107void KisToolNonPaint::notifyModified() const
108{
109 if (m_subject && m_subject->currentImg()) {
110
111 m_subject->currentImg()->setModified();
112 }
113}
114
115#include "kis_tool_non_paint.moc"
KisCanvasSubject is part of the Observer pattern.