group.h

Engine/source/gui/editor/inspector/group.h

More...

Classes:

class

The GuiInspectorGroup control is a helper control that the inspector makes use of which houses a collapsible pane type control for separating inspected objects fields into groups.

Detailed Description

 1
 2//-----------------------------------------------------------------------------
 3// Copyright (c) 2012 GarageGames, LLC
 4//
 5// Permission is hereby granted, free of charge, to any person obtaining a copy
 6// of this software and associated documentation files (the "Software"), to
 7// deal in the Software without restriction, including without limitation the
 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 9// sell copies of the Software, and to permit persons to whom the Software is
10// furnished to do so, subject to the following conditions:
11//
12// The above copyright notice and this permission notice shall be included in
13// all copies or substantial portions of the Software.
14//
15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21// IN THE SOFTWARE.
22//-----------------------------------------------------------------------------
23
24#ifndef _GUI_INSPECTOR_GROUP_H_
25#define _GUI_INSPECTOR_GROUP_H_
26
27#include "gui/core/guiCanvas.h"
28#include "gui/controls/guiTextEditCtrl.h"
29#include "gui/buttons/guiBitmapButtonCtrl.h"
30#include "gui/containers/guiRolloutCtrl.h"
31
32// Forward refs
33class GuiInspector;
34class GuiInspectorField;
35
36
37/// The GuiInspectorGroup control is a helper control that the inspector
38/// makes use of which houses a collapsible pane type control for separating
39/// inspected objects fields into groups.  The content of the inspector is 
40/// made up of zero or more GuiInspectorGroup controls inside of a GuiStackControl
41///
42class GuiInspectorGroup : public GuiRolloutCtrl
43{
44private:
45   typedef GuiRolloutCtrl Parent;
46public:
47   // Members
48   SimObjectPtr<GuiInspector>          mParent;
49   Vector<GuiInspectorField*>          mChildren;
50   GuiStackControl*                    mStack;
51   Vector<GuiRolloutCtrl*>             mArrayCtrls;
52
53   // Constructor/Destructor/Conobject Declaration
54   GuiInspectorGroup();
55   GuiInspectorGroup( const String& groupName, SimObjectPtr<GuiInspector> parent );
56   virtual ~GuiInspectorGroup();
57   
58   DECLARE_CONOBJECT(GuiInspectorGroup);
59   DECLARE_CATEGORY( "Gui Editor" );
60
61   virtual GuiInspectorField* constructField( S32 fieldType );
62   virtual GuiInspectorField* findField( const char *fieldName );
63
64   // Publicly Accessible Information about this group
65   const String& getGroupName() const { return mCaption; };
66   SimObjectPtr<GuiInspector> getInspector() { return mParent; };
67
68   bool onAdd();
69   virtual bool inspectGroup();
70
71   virtual void animateToContents();
72
73   void clearFields();
74
75   virtual bool updateFieldValue( StringTableEntry fieldName, const char *arrayIdx );
76   virtual void updateAllFields();
77   
78   U32 getNumFields() const { return mChildren.size(); }
79
80protected:
81   // overridable method that creates our inner controls.
82   virtual bool createContent();
83   
84   /// Determine the class that is a common ancestor to all inspected objects.
85   AbstractClassRep* findCommonAncestorClass();
86};
87
88#endif // _GUI_INSPECTOR_GROUP_H_
89