| 1 | /* |
|---|
| 2 | ================================================================================= |
|---|
| 3 | This file is part of Cafu, the open-source game engine and graphics engine |
|---|
| 4 | for multiplayer, cross-platform, real-time 3D action. |
|---|
| 5 | Copyright (C) 2002-2012 Carsten Fuchs Software. |
|---|
| 6 | |
|---|
| 7 | Cafu is free software: you can redistribute it and/or modify it under the terms |
|---|
| 8 | of the GNU General Public License as published by the Free Software Foundation, |
|---|
| 9 | either version 3 of the License, or (at your option) any later version. |
|---|
| 10 | |
|---|
| 11 | Cafu is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
|---|
| 12 | without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
|---|
| 13 | PURPOSE. See the GNU General Public License for more details. |
|---|
| 14 | |
|---|
| 15 | You should have received a copy of the GNU General Public License |
|---|
| 16 | along with Cafu. If not, see <http://www.gnu.org/licenses/>. |
|---|
| 17 | |
|---|
| 18 | For support and more information about Cafu, visit us at <http://www.cafu.de>. |
|---|
| 19 | ================================================================================= |
|---|
| 20 | */ |
|---|
| 21 | |
|---|
| 22 | #ifndef CAFU_TOOL_MANAGER_HPP_INCLUDED |
|---|
| 23 | #define CAFU_TOOL_MANAGER_HPP_INCLUDED |
|---|
| 24 | |
|---|
| 25 | #include "ObserverPatternTools.hpp" |
|---|
| 26 | #include "Templates/Array.hpp" |
|---|
| 27 | |
|---|
| 28 | |
|---|
| 29 | class MapDocumentT; |
|---|
| 30 | class ToolT; |
|---|
| 31 | class wxWindow; |
|---|
| 32 | namespace cf { namespace TypeSys { class TypeInfoT; } } |
|---|
| 33 | |
|---|
| 34 | |
|---|
| 35 | class ToolManagerT : public ToolsSubjectT |
|---|
| 36 | { |
|---|
| 37 | public: |
|---|
| 38 | |
|---|
| 39 | /// The constructor. |
|---|
| 40 | ToolManagerT(MapDocumentT& MapDoc, wxWindow* ParentToolOptions); |
|---|
| 41 | |
|---|
| 42 | /// The destructor. |
|---|
| 43 | ~ToolManagerT(); |
|---|
| 44 | |
|---|
| 45 | |
|---|
| 46 | /// Returns the array of all tools registered with and known to the tool manager. |
|---|
| 47 | const ArrayT<ToolT*>& GetTools() const { return m_Tools; } |
|---|
| 48 | |
|---|
| 49 | /// Returns the tool instance matching the given type. |
|---|
| 50 | /// NULL is returned when Type is not a type of a valid tool. |
|---|
| 51 | ToolT* GetTool(const cf::TypeSys::TypeInfoT& Type); |
|---|
| 52 | |
|---|
| 53 | /// Returns the currently active tool. |
|---|
| 54 | ToolT* GetActiveTool() const { return m_ActiveTool; } |
|---|
| 55 | |
|---|
| 56 | /// Returns the type of the currently active tool. |
|---|
| 57 | /// This method is just a convenience method that saves the caller the explicit check for NULL when calling GetActiveTool(). |
|---|
| 58 | const cf::TypeSys::TypeInfoT* GetActiveToolType() const; |
|---|
| 59 | |
|---|
| 60 | /// Sets the tool of the given type as the currently active tool. |
|---|
| 61 | void SetActiveTool(const cf::TypeSys::TypeInfoT* Type); |
|---|
| 62 | |
|---|
| 63 | |
|---|
| 64 | private: |
|---|
| 65 | |
|---|
| 66 | ToolManagerT(const ToolManagerT&); ///< Use of the Copy Constructor is not allowed. |
|---|
| 67 | void operator = (const ToolManagerT&); ///< Use of the Assignment Operator is not allowed. |
|---|
| 68 | |
|---|
| 69 | |
|---|
| 70 | MapDocumentT& m_MapDoc; ///< The MapDocumentT whose tool manager we are. |
|---|
| 71 | ArrayT<ToolT*> m_Tools; ///< The list of all tools available for editing the map document. |
|---|
| 72 | ToolT* m_ActiveTool; ///< One of the tools in m_Tools, this is the currently active one. NULL when no tool is currently active. |
|---|
| 73 | }; |
|---|
| 74 | |
|---|
| 75 | #endif |
|---|