ScummVM API documentation
tree_item.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef TITANIC_TREE_ITEM_H
23 #define TITANIC_TREE_ITEM_H
24 
25 #include "titanic/core/message_target.h"
26 #include "titanic/support/simple_file.h"
27 
28 namespace Titanic {
29 
30 class CGameManager;
31 class CMovieClipList;
32 class CNamedItem;
33 class CProjectItem;
34 class CScreenManager;
35 class CViewItem;
36 
37 class CTreeItem: public CMessageTarget {
38  friend class CMessage;
39  DECLARE_MESSAGE_MAP;
40 private:
41  CTreeItem *_parent;
42  CTreeItem *_nextSibling;
43  CTreeItem *_priorSibling;
44  CTreeItem *_firstChild;
45  int _field14;
46 public:
47  CLASSDEF;
48  CTreeItem();
49 
50 
54  void dump(int indent);
55 
59  virtual CString dumpItem(int indent) const;
60 
64  void save(SimpleFile *file, int indent) override;
65 
69  void load(SimpleFile *file) override;
70 
74  virtual CGameManager *getGameManager() const;
75 
79  virtual bool isFileItem() const;
80 
84  virtual bool isRoomItem() const;
85 
89  virtual bool isNodeItem() const;
90 
94  virtual bool isViewItem() const;
95 
99  virtual bool isLinkItem() const;
100 
104  virtual bool isPlaceHolderItem() const;
105 
109  virtual bool isNamedItem() const;
110 
114  virtual bool isGameObject() const;
115 
119  virtual bool isGameObjectDescItem() const;
120 
124  virtual const CString getName() const { return CString(); }
125 
129  virtual bool isEquals(const CString &name, bool startsWith = false) const{ return false; }
130 
134  virtual int compareTo(const CString &name, int maxLen = 0) const { return false; }
135 
139  virtual const CMovieClipList *getMovieClips() const { return nullptr; }
140 
144  virtual bool connectsTo(CViewItem *destView) const { return false; }
145 
149  virtual void draw(CScreenManager *screenManager) {}
150 
154  virtual Rect getBounds() const { return Rect(); }
155 
159  virtual void freeSurface() {}
160 
164  CTreeItem *getParent() const { return _parent; }
165 
169  CProjectItem *getRoot() const;
170 
174  CTreeItem *getNextSibling() const { return _nextSibling; }
175 
179  CTreeItem *getPriorSibling() const { return _priorSibling; }
180 
185 
189  CTreeItem *getFirstChild() const { return _firstChild; }
190 
194  CTreeItem *getLastChild() const;
195 
200  CTreeItem *scan(CTreeItem *item) const;
201 
205  CTreeItem *findChildInstanceOf(ClassDef *classDef) const;
206 
210  CTreeItem *findNextInstanceOf(ClassDef *classDef, CTreeItem *startItem) const;
211 
215  void addUnder(CTreeItem *newParent);
216 
220  void setParent(CTreeItem *newParent);
221 
225  void addSibling(CTreeItem *item);
226 
230  void moveUnder(CTreeItem *newParent);
231 
235  void destroyAll();
236 
241  int destroyChildren();
242 
246  void detach();
247 
251  void attach(CTreeItem *item);
252 
259  CNamedItem *findByName(const CString &name, bool subMatch = false);
260 };
261 
262 } // End of namespace Titanic
263 
264 #endif /* TITANIC_TREE_ITEM_H */
virtual bool isGameObject() const
CTreeItem * getNextSibling() const
Definition: tree_item.h:174
CTreeItem * getParent() const
Definition: tree_item.h:164
virtual bool isEquals(const CString &name, bool startsWith=false) const
Definition: tree_item.h:129
virtual void draw(CScreenManager *screenManager)
Definition: tree_item.h:149
CTreeItem * getLastSibling()
virtual CGameManager * getGameManager() const
CTreeItem * findChildInstanceOf(ClassDef *classDef) const
virtual bool isNodeItem() const
CTreeItem * getLastChild() const
void setParent(CTreeItem *newParent)
virtual bool isPlaceHolderItem() const
Definition: simple_file.h:49
Definition: saveable_object.h:35
CNamedItem * findByName(const CString &name, bool subMatch=false)
void moveUnder(CTreeItem *newParent)
Definition: named_item.h:33
void dump(int indent)
virtual bool connectsTo(CViewItem *destView) const
Definition: tree_item.h:144
Definition: screen_manager.h:49
virtual bool isNamedItem() const
CTreeItem * getPriorSibling() const
Definition: tree_item.h:179
virtual int compareTo(const CString &name, int maxLen=0) const
Definition: tree_item.h:134
virtual Rect getBounds() const
Definition: tree_item.h:154
Definition: tree_item.h:37
Definition: game_manager.h:48
Definition: rect.h:35
CProjectItem * getRoot() const
virtual void freeSurface()
Definition: tree_item.h:159
Definition: arm.h:30
Definition: string.h:40
virtual CString dumpItem(int indent) const
void addUnder(CTreeItem *newParent)
Definition: project_item.h:84
virtual const CMovieClipList * getMovieClips() const
Definition: tree_item.h:139
Definition: movie_clip.h:69
CTreeItem * scan(CTreeItem *item) const
virtual bool isViewItem() const
void attach(CTreeItem *item)
virtual bool isLinkItem() const
Definition: message_target.h:85
void load(SimpleFile *file) override
CTreeItem * getFirstChild() const
Definition: tree_item.h:189
virtual bool isRoomItem() const
Definition: messages.h:91
void save(SimpleFile *file, int indent) override
virtual bool isGameObjectDescItem() const
void addSibling(CTreeItem *item)
virtual bool isFileItem() const
Definition: view_item.h:32
CTreeItem * findNextInstanceOf(ClassDef *classDef, CTreeItem *startItem) const
virtual const CString getName() const
Definition: tree_item.h:124