krita

kis_tool_manager.h

00001 /*
00002  *  Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
00003  *
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU General Public License
00015  *  along with this program; if not, write to the Free Software
00016  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  */
00018 #ifndef KIS_TOOL_MANAGER
00019 #define KIS_TOOL_MANAGER
00020 
00021 #include <map>
00022 
00023 #include <qobject.h>
00024 
00025 #include "kis_tool_controller.h"
00026 #include "kis_global.h"
00027 #include "kis_tool_types.h"
00028 #include "kis_input_device.h"
00029 
00030 class KoView;
00031 class KisCanvasSubject;
00032 class KisView;
00033 class KisTool;
00034 class KisToolRegistry;
00035 class KisCanvasController;
00036 class KoPaletteManager;
00037 class KoToolBox;
00038 
00043 class KisToolManager : public QObject, public KisToolControllerInterface {
00044 
00045     Q_OBJECT
00046 
00047 public:
00048 
00049     KisToolManager(KisCanvasSubject * parent, KisCanvasController * controller);
00050     ~KisToolManager();
00051 
00052 public:
00053 
00054     void setUp(KoToolBox * toolbox, KoPaletteManager * paletteManager, KActionCollection * collection);
00055     
00056     // Called when the toolbox is deleted because the view was made inactive in favour of another view
00057     void youAintGotNoToolBox();
00058     
00059     void updateGUI();
00060 
00061     virtual void setCurrentTool(KisTool *tool);
00062     virtual void setCurrentTool(const QString & toolName);
00063     
00064     virtual KisTool *currentTool() const;
00065     
00066     void setToolForInputDevice(KisInputDevice oldDevice, KisInputDevice newDevice);
00067 
00068     KisTool *findTool(const QString &toolName, KisInputDevice inputDevice = KisInputDevice::unknown()) const;
00069 
00070     void activateCurrentTool();
00071 
00072 private:
00073     
00074     void resetToolBox(KoToolBox * toolbox);
00075     
00076 private:
00077 
00078     typedef std::map<KisInputDevice, KisTool *> InputDeviceToolMap;
00079     typedef std::map<KisInputDevice, vKisTool> InputDeviceToolSetMap;
00080 
00081     InputDeviceToolMap m_inputDeviceToolMap;
00082     InputDeviceToolSetMap m_inputDeviceToolSetMap;
00083     
00084     KisCanvasSubject * m_subject;
00085     KisCanvasController * m_controller;
00086 
00087     KoPaletteManager * m_paletteManager;
00088     KActionCollection * m_actionCollection;
00089 
00090     KoToolBox * m_toolBox;
00091 
00092     KisTool * m_oldTool;
00093     KisTool * m_dummyTool;
00094     
00095     vKisTool m_tools;
00096 
00097     bool m_tools_disabled;
00098     bool setup;
00099 };
00100 
00101 
00102 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys