group.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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_GROUP_H_
  23. #define _GUI_INSPECTOR_GROUP_H_
  24. #include "gui/core/guiCanvas.h"
  25. #include "gui/controls/guiTextEditCtrl.h"
  26. #include "gui/buttons/guiBitmapButtonCtrl.h"
  27. #include "gui/containers/guiRolloutCtrl.h"
  28. // Forward refs
  29. class GuiInspector;
  30. class GuiInspectorField;
  31. /// The GuiInspectorGroup control is a helper control that the inspector
  32. /// makes use of which houses a collapsible pane type control for separating
  33. /// inspected objects fields into groups. The content of the inspector is
  34. /// made up of zero or more GuiInspectorGroup controls inside of a GuiStackControl
  35. ///
  36. class GuiInspectorGroup : public GuiRolloutCtrl
  37. {
  38. private:
  39. typedef GuiRolloutCtrl Parent;
  40. public:
  41. // Members
  42. SimObjectPtr<GuiInspector> mParent;
  43. Vector<GuiInspectorField*> mChildren;
  44. GuiStackControl* mStack;
  45. Vector<GuiRolloutCtrl*> mArrayCtrls;
  46. // Constructor/Destructor/Conobject Declaration
  47. GuiInspectorGroup();
  48. GuiInspectorGroup( const String& groupName, SimObjectPtr<GuiInspector> parent );
  49. virtual ~GuiInspectorGroup();
  50. DECLARE_CONOBJECT(GuiInspectorGroup);
  51. DECLARE_CATEGORY( "Gui Editor" );
  52. virtual GuiInspectorField* constructField( S32 fieldType );
  53. virtual GuiInspectorField* findField( const char *fieldName );
  54. // Publicly Accessible Information about this group
  55. const String& getGroupName() const { return mCaption; };
  56. SimObjectPtr<GuiInspector> getInspector() { return mParent; };
  57. bool onAdd();
  58. virtual bool inspectGroup();
  59. virtual void animateToContents();
  60. void clearFields();
  61. virtual bool updateFieldValue( StringTableEntry fieldName, const char *arrayIdx );
  62. virtual void updateAllFields();
  63. U32 getNumFields() const { return mChildren.size(); }
  64. protected:
  65. // overridable method that creates our inner controls.
  66. virtual bool createContent();
  67. /// Determine the class that is a common ancestor to all inspected objects.
  68. AbstractClassRep* findCommonAncestorClass();
  69. };
  70. #endif // _GUI_INSPECTOR_GROUP_H_