karbon
vtoolcontroller.h
00001 /* This file is part of the KDE project 00002 Copyright (C) 2001, 2002, 2003 The Karbon Developers 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library 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 GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 * Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #ifndef __VTOOLCONTROLLER_H__ 00021 #define __VTOOLCONTROLLER_H__ 00022 00023 #include <qdict.h> 00024 #include <KoPoint.h> 00025 00026 class QEvent; 00027 00028 class VTool; 00029 class KarbonView; 00030 class VToolBox; 00031 00032 class VToolController 00033 { 00034 public: 00035 VToolController( KarbonView *view ); 00036 virtual ~VToolController(); 00037 00038 void init(); 00039 00040 void registerTool( VTool *tool ); 00041 void unregisterTool( VTool *tool ); 00042 00043 void setCurrentTool( VTool * ); 00044 VTool *currentTool() const { return m_currentTool; } 00045 00046 bool mouseEvent( QMouseEvent* event, const KoPoint& ); 00047 bool keyEvent( QEvent* event ); 00048 00049 const QDict<VTool> &tools() { return m_tools; } 00050 00051 void setUp( KActionCollection *ac, VToolBox * toolbox ); 00052 void resetToolBox( VToolBox * toolbox ); 00053 VTool *findTool( const QString &toolName ) const; 00054 00055 // Called when the toolbox is deleted because the view was made inactive in favour of another view 00056 void youAintGotNoToolBox(); 00057 00058 private: 00059 KarbonView *m_view; 00060 VTool *m_currentTool; 00061 QDict<VTool> m_tools; 00062 VToolBox *m_toolBox; 00063 bool m_setup; 00064 }; 00065 00066 #endif 00067