creator.h

Engine/source/gui/worldEditor/creator.h

More...

Classes:

class

Creator tree from old editor. Not used in current editor.

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 _CREATOR_H_
 25#define _CREATOR_H_
 26
 27#ifndef _GUIARRAYCTRL_H_
 28#include "gui/core/guiArrayCtrl.h"
 29#endif
 30
 31
 32/// Creator tree from old editor.  Not used in current editor.
 33class CreatorTree : public GuiArrayCtrl
 34{
 35   typedef GuiArrayCtrl Parent;
 36   public:
 37
 38      class Node
 39      {
 40         public:
 41            Node();
 42            ~Node();
 43
 44            enum {
 45               Group       = BIT(0),
 46               Expanded    = BIT(1),
 47               Selected    = BIT(2),
 48               Root        = BIT(3)
 49            };
 50
 51            BitSet32             mFlags;
 52            S32                  mId;
 53            U32                  mTab;
 54            Node *               mParent;
 55            Vector<Node*>        mChildren;
 56            StringTableEntry     mName;
 57            StringTableEntry     mValue;
 58
 59            void expand(bool exp);
 60            void select(bool sel){mFlags.set(Selected, sel);}
 61
 62            Node * find(S32 id);
 63
 64            //
 65            bool isGroup(){return(mFlags.test(Group));}
 66            bool isExpanded(){return(mFlags.test(Expanded));}
 67            bool isSelected(){return(mFlags.test(Selected));}
 68            bool isRoot(){return(mFlags.test(Root));}
 69            S32 getId(){return(mId);}
 70            bool hasChildItem();
 71            S32 getSelected();
 72
 73            //
 74            bool isFirst();
 75            bool isLast();
 76      };
 77
 78      CreatorTree();
 79      ~CreatorTree();
 80
 81      //
 82      S32                        mCurId;
 83      Node *                     mRoot;
 84      Vector<Node*>              mNodeList;
 85
 86      //
 87      void buildNode(Node * node, U32 tab);
 88      void build();
 89
 90      //
 91      bool addNode(Node * parent, Node * node);
 92      Node * createNode(const char * name, const char * value, bool group = false, Node * parent = 0);
 93      Node * findNode(S32 id);
 94      S32 getSelected(){return(mRoot->getSelected());}
 95
 96      //
 97      void expandNode(Node * node, bool expand);
 98      void selectNode(Node * node, bool select);
 99
100      //
101      void sort();
102      void clear();
103
104      S32                           mTabSize;
105      S32                           mMaxWidth;
106      S32                           mTxtOffset;
107
108      // GuiControl
109      void onMouseDown(const GuiEvent & event);
110      void onMouseDragged(const GuiEvent & event);
111      void onMouseUp(const GuiEvent & event);
112      bool onWake();
113
114      // GuiArrayCtrl
115      void onRenderCell(Point2I offset, Point2I cell, bool, bool);
116
117      DECLARE_CONOBJECT(CreatorTree);
118      DECLARE_CATEGORY( "Gui Editor" );
119};
120
121#endif
122