| 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_ENTITY_CLASS_VAR_HPP_INCLUDED |
|---|
| 23 | #define CAFU_ENTITY_CLASS_VAR_HPP_INCLUDED |
|---|
| 24 | |
|---|
| 25 | #include "Templates/Array.hpp" |
|---|
| 26 | #include "wx/wx.h" |
|---|
| 27 | |
|---|
| 28 | |
|---|
| 29 | struct lua_State; |
|---|
| 30 | class EntPropertyT; |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | /// This class represents a variable of an entity class. |
|---|
| 34 | class EntClassVarT |
|---|
| 35 | { |
|---|
| 36 | public: |
|---|
| 37 | |
|---|
| 38 | class InitErrorT { }; |
|---|
| 39 | |
|---|
| 40 | enum TypeT |
|---|
| 41 | { |
|---|
| 42 | // TODO: Add anything we have special pickers for: entity (names), materials, file_sound (specify wildcard in type string??), angles, vectors, ... |
|---|
| 43 | TYPE_INVALID=-1, |
|---|
| 44 | TYPE_CHOICE, |
|---|
| 45 | TYPE_COLOR, |
|---|
| 46 | TYPE_FILE, |
|---|
| 47 | TYPE_FILE_MODEL, |
|---|
| 48 | TYPE_FLAGS, |
|---|
| 49 | TYPE_FLOAT, |
|---|
| 50 | TYPE_INTEGER, |
|---|
| 51 | TYPE_STRING, |
|---|
| 52 | }; |
|---|
| 53 | |
|---|
| 54 | |
|---|
| 55 | /// Creates an EntClassVarT instance from the stack contents of the given LuaState. |
|---|
| 56 | /// @param LuaState The LuaState whose stack contents the EntClassVarT instance is to be created from. |
|---|
| 57 | EntClassVarT(lua_State* LuaState); |
|---|
| 58 | |
|---|
| 59 | wxString GetName() const { return m_Name; } |
|---|
| 60 | wxString GetLongName() const { return m_LongName; } |
|---|
| 61 | wxString GetDescription() const { return m_Description; } |
|---|
| 62 | TypeT GetType() const { return m_Type; } |
|---|
| 63 | wxString GetDefault() const { return m_DefaultValue; } |
|---|
| 64 | bool IsReportable() const { return m_ShowUser; } ///< Returns whether or not this variable should be displayed in the Entity Report dialog. |
|---|
| 65 | bool IsReadOnly() const { return m_ReadOnly; } ///< Returns whether or not this variable is read only. Read only variables cannot be edited in the Entity Properties dialog. |
|---|
| 66 | bool IsUnique() const { return m_Unique; } ///< Returns whether or not the value of this variable must be unique among all entities in the world. |
|---|
| 67 | |
|---|
| 68 | const ArrayT<wxString>& GetAuxInfo() const { return m_AuxInfo; } |
|---|
| 69 | |
|---|
| 70 | EntPropertyT GetInstance() const; ///< Get a property instance of this class key using default value |
|---|
| 71 | |
|---|
| 72 | |
|---|
| 73 | private: |
|---|
| 74 | |
|---|
| 75 | wxString m_Name; |
|---|
| 76 | wxString m_LongName; |
|---|
| 77 | wxString m_Description; |
|---|
| 78 | TypeT m_Type; |
|---|
| 79 | wxString m_DefaultValue; ///< This is the default value for initializing concrete instances of this variable. |
|---|
| 80 | bool m_ShowUser; |
|---|
| 81 | bool m_ReadOnly; |
|---|
| 82 | bool m_Unique; |
|---|
| 83 | ArrayT<wxString> m_AuxInfo; ///< Auxiliary information. E.g. for "flags" and "choice", this is the list of labels. |
|---|
| 84 | }; |
|---|
| 85 | |
|---|
| 86 | #endif |
|---|