fieldBrushObject.h 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2012 GarageGames, LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to
  6. // deal in the Software without restriction, including without limitation the
  7. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. // sell copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //-----------------------------------------------------------------------------
  22. #ifndef _FIELDBRUSHOBJECT_H_
  23. #define _FIELDBRUSHOBJECT_H_
  24. #ifndef _SIM_H_
  25. #include "console/simObject.h"
  26. #endif
  27. #ifndef _SIMFIELDDICTIONARY_H_
  28. #include "console/simFieldDictionary.h"
  29. #endif
  30. #ifndef _CONSOLEINTERNAL_H_
  31. #include "console/consoleInternal.h"
  32. #endif
  33. #ifndef _TDICTIONARY_H_
  34. #include "core/util/tDictionary.h"
  35. #endif
  36. //-----------------------------------------------------------------------------
  37. // Field Brush Object.
  38. //-----------------------------------------------------------------------------
  39. /// FieldBrushObject for static-field copying/pasting.
  40. ///
  41. class FieldBrushObject : public SimObject
  42. {
  43. private:
  44. typedef SimObject Parent;
  45. // Destroy Fields.
  46. void destroyFields( void );
  47. StringTableEntry mDescription; ///< Description.
  48. StringTableEntry mSortName; ///< Sort Name.
  49. public:
  50. FieldBrushObject();
  51. void copyFields( SimObject* pSimObject, const char* fieldList );
  52. void pasteFields( SimObject* pSimObject );
  53. static bool setDescription( void *object, const char *index, const char *data )
  54. { static_cast<FieldBrushObject*>(object)->setDescription(data); return false; };
  55. void setDescription( const char* description ) { mDescription = StringTable->insert(description); }
  56. StringTableEntry getDescription(void) const { return mDescription; }
  57. static bool setSortName( void *object, const char *index, const char *data )
  58. { static_cast<FieldBrushObject*>(object)->setSortName(data); return false; };
  59. void setSortName( const char* sortName ) { mSortName = StringTable->insert(sortName); }
  60. StringTableEntry getSortName(void) const { return mSortName; }
  61. static void initPersistFields(); ///< Persist Fields.
  62. virtual void onRemove(); ///< Called when the object is removed from the sim.
  63. DECLARE_CONOBJECT(FieldBrushObject);
  64. };
  65. #endif