chalk

kis_tool_manager.h
1/*
2 * Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.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#ifndef KIS_TOOL_MANAGER
19#define KIS_TOOL_MANAGER
20
21#include <map>
22
23#include <tqobject.h>
24
25#include "kis_tool_controller.h"
26#include "kis_global.h"
27#include "kis_tool_types.h"
28#include "kis_input_device.h"
29
30class KoView;
32class KisView;
33class KisTool;
34class KisToolRegistry;
36class KoPaletteManager;
37class KoToolBox;
38
43class KisToolManager : public TQObject, public KisToolControllerInterface {
44
45 TQ_OBJECT
46
47
48public:
49
50 KisToolManager(KisCanvasSubject * parent, KisCanvasController * controller);
51 ~KisToolManager();
52
53public:
54
55 void setUp(KoToolBox * toolbox, KoPaletteManager * paletteManager, TDEActionCollection * collection);
56
57 // Called when the toolbox is deleted because the view was made inactive in favour of another view
58 void youAintGotNoToolBox();
59
60 void updateGUI();
61
62 virtual void setCurrentTool(KisTool *tool);
63 virtual void setCurrentTool(const TQString & toolName);
64
65 virtual KisTool *currentTool() const;
66
67 void setToolForInputDevice(KisInputDevice oldDevice, KisInputDevice newDevice);
68
69 KisTool *findTool(const TQString &toolName, KisInputDevice inputDevice = KisInputDevice::unknown()) const;
70
71 void activateCurrentTool();
72
73private:
74
75 void resetToolBox(KoToolBox * toolbox);
76
77private:
78
79 typedef std::map<KisInputDevice, KisTool *> InputDeviceToolMap;
80 typedef std::map<KisInputDevice, vKisTool> InputDeviceToolSetMap;
81
82 InputDeviceToolMap m_inputDeviceToolMap;
83 InputDeviceToolSetMap m_inputDeviceToolSetMap;
84
85 KisCanvasSubject * m_subject;
86 KisCanvasController * m_controller;
87
88 KoPaletteManager * m_paletteManager;
89 TDEActionCollection * m_actionCollection;
90
91 KoToolBox * m_toolBox;
92
93 KisTool * m_oldTool;
94 KisTool * m_dummyTool;
95
96 vKisTool m_tools;
97
98 bool m_tools_disabled;
99 bool setup;
100};
101
102
103#endif
Interface for classes that implement a canvas; i.e., a widget where KisImages are painted onto.
KisCanvasSubject is part of the Observer pattern.
A registry, similar to the tool and colormodel registry where new tool plugins can register themselve...