datablockField.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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 _GUI_INSPECTOR_DATABLOCKFIELD_H_
  23. #define _GUI_INSPECTOR_DATABLOCKFIELD_H_
  24. #include "gui/controls/guiPopUpCtrlEx.h"
  25. #include "gui/editor/guiInspectorTypes.h"
  26. //-----------------------------------------------------------------------------
  27. // GuiInspectorDatablockField - custom field type for datablock enumeration
  28. //-----------------------------------------------------------------------------
  29. class GuiInspectorDatablockField : public GuiInspectorTypeMenuBase
  30. {
  31. public:
  32. typedef GuiInspectorTypeMenuBase Parent;
  33. protected:
  34. AbstractClassRep *mDesiredClass;
  35. SimObjectPtr<GuiBitmapButtonCtrl> mAddButton;
  36. SimObjectPtr<GuiButtonCtrl> mEditButton;
  37. RectI mBrowseRect;
  38. virtual SimSet* _getDatablockSet() const { return Sim::getDataBlockSet(); }
  39. void _populateMenu( GuiPopUpMenuCtrlEx* menu ) override;
  40. GuiControl* constructEditControl() override;
  41. bool updateRects() override;
  42. public:
  43. DECLARE_CONOBJECT(GuiInspectorDatablockField);
  44. GuiInspectorDatablockField( StringTableEntry className );
  45. GuiInspectorDatablockField() { mDesiredClass = NULL; };
  46. void setClassName( StringTableEntry className );
  47. };
  48. //-----------------------------------------------------------------------------
  49. // TypeSFXDescriptionName GuiInspectorField Class
  50. //-----------------------------------------------------------------------------
  51. class GuiInspectorTypeSFXDescriptionName : public GuiInspectorDatablockField
  52. {
  53. public:
  54. typedef GuiInspectorDatablockField Parent;
  55. protected:
  56. SimSet* _getDatablockSet() const override { return Sim::getSFXDescriptionSet(); }
  57. public:
  58. DECLARE_CONOBJECT(GuiInspectorTypeSFXDescriptionName);
  59. static void consoleInit();
  60. };
  61. //-----------------------------------------------------------------------------
  62. // TypeSFXTrackName GuiInspectorField Class
  63. //-----------------------------------------------------------------------------
  64. class GuiInspectorTypeSFXTrackName : public GuiInspectorDatablockField
  65. {
  66. public:
  67. typedef GuiInspectorDatablockField Parent;
  68. protected:
  69. SimSet* _getDatablockSet() const override { return Sim::getSFXTrackSet(); }
  70. public:
  71. DECLARE_CONOBJECT(GuiInspectorTypeSFXTrackName);
  72. static void consoleInit();
  73. };
  74. //-----------------------------------------------------------------------------
  75. // TypeSFXEnvironmentName GuiInspectorField Class
  76. //-----------------------------------------------------------------------------
  77. class GuiInspectorTypeSFXEnvironmentName : public GuiInspectorDatablockField
  78. {
  79. public:
  80. typedef GuiInspectorDatablockField Parent;
  81. protected:
  82. SimSet* _getDatablockSet() const override { return Sim::getSFXEnvironmentSet(); }
  83. public:
  84. DECLARE_CONOBJECT(GuiInspectorTypeSFXEnvironmentName);
  85. static void consoleInit();
  86. };
  87. //-----------------------------------------------------------------------------
  88. // TypeSFXAmbienceName GuiInspectorField Class
  89. //-----------------------------------------------------------------------------
  90. class GuiInspectorTypeSFXAmbienceName : public GuiInspectorDatablockField
  91. {
  92. public:
  93. typedef GuiInspectorDatablockField Parent;
  94. protected:
  95. SimSet* _getDatablockSet() const override { return Sim::getSFXAmbienceSet(); }
  96. public:
  97. DECLARE_CONOBJECT(GuiInspectorTypeSFXAmbienceName);
  98. static void consoleInit();
  99. };
  100. #endif