CAST II Game Engine |
|||||||||||||||
![]() |
DESCRIPTION | ![]() |
FEATURES | ![]() |
SCREENSHOTS | ![]() |
FORUMS | ![]() |
DOCUMENTATION | ![]() |
DOWNLOADS | ![]() |
CONTACTS | ![]() |
|
type TItem = class(TBaseItem)
Provides hierarchical structure, saving/loading, properties interface and some service functions.
TBaseItem| Name | Description | |
|---|---|---|
![]() | FChilds | Childs collection |
![]() | FManager | Manager reference. See TItemsManager |
![]() | FParent | Parent reference |
![]() | FState | Set of state flags |
![]() | FTotalChilds | Number of childs |
![]() | IndexInParent | Index in parent collection for internal use |
![]() | Name | Item name. Used to reference items by name in a filesystem-like way: RootItemName\Parent\Name |
![]() | constructor Construct(AManager: TItemsManager); virtual; |
![]() | constructor Create(AManager: TItemsManager); virtual; |
![]() | destructor Destroy; override; |
![]() | function AddChild(AItem: TItem): TItem; |
![]() | procedure AddItemLink(Properties: TProperties; const PropName: string; PropOptions: TPOptions; const BaseClass: string); |
![]() | procedure AddProperties(const Result: TProperties); virtual; |
![]() | procedure BroadcastMessage(const Msg: TMessage); |
![]() | procedure BuildItemLinks; |
![]() | procedure ClearParent; |
![]() | function Clone: TItem; virtual; |
![]() | function FindNextChildInclDummy(var Current: TItem): Boolean; |
![]() | procedure FreeChilds; virtual; |
![]() | function GetChildByName(const AName: string; SearchChilds: Boolean): TItem; |
![]() | function GetChildByPath(const AName: string): TItem; |
![]() | function GetChilds: TItems; |
![]() | class function GetClass: CItem; |
![]() | function GetFullName: string; |
![]() | function GetItemSize(CountChilds: Boolean): Integer; virtual; |
![]() | function GetNextChild(CurrentChild: TItem): TItem; |
![]() | function GetNonDummyParent: TItem; |
![]() | procedure GetProperties(const Result: TProperties); |
![]() | function GetRelativeItemName(const AFullName: string): string; |
![]() | procedure HandleMessage(const Msg: TMessage); override; |
![]() | procedure InsertChild(AItem: TItem; Index: Integer); |
![]() | class function IsAbstract: Boolean; virtual; |
![]() | function IsChildOf(AParent: TItem): Boolean; |
![]() | function Load(Stream: TStream): Boolean; virtual; |
![]() | procedure MarkAsRemoved(DoNotRelease: Boolean); |
![]() | procedure MoveChild(Child, Target: TItem; Mode: TItemMoveMode); |
![]() | procedure NotifyChilds(const Msg: TMessage); |
![]() | procedure ObtainLinkedItemName(const PropName: string; out Result: string); |
![]() | procedure OnInit; virtual; |
![]() | procedure OnSceneAdd; virtual; |
![]() | procedure OnSceneLoaded; virtual; |
![]() | procedure OnSceneRemove; virtual; |
![]() | procedure RemoveChild(AItem: TItem); virtual; |
![]() | procedure RemoveChildByIndex(Index: Integer); virtual; |
![]() | function ResolveLink(const PropName: string; out Linked: TItem): Boolean; |
![]() | procedure ResolveLinks; virtual; |
![]() | function Save(Stream: TStream): Boolean; virtual; |
![]() | procedure SendMessage(const Msg: TMessage; Recipient: TItem; Destination: TMessageFlags); |
![]() | function SetChild(Index: Integer; AItem: TItem): TItem; virtual; |
![]() | function SetLinkedObject(const PropName: string; Linked: TItem): Boolean; |
![]() | function SetLinkProperty(const AName, Value: string): Boolean; |
![]() | procedure SetParent(NewParent: TItem); virtual; |
![]() | procedure SetProperties(Properties: TProperties); virtual; |
![]() | procedure SetProperty(const AName, AValue: string); |
![]() | procedure SetState(const Value: TItemFlags); virtual; |
![]() | constructor Construct(AManager: TItemsManager); virtual; |
Constructor used to construct complex objects such as windows with a header area and a client area
![]() | constructor Create(AManager: TItemsManager); virtual; |
Regular constructor
![]() | destructor Destroy; override; |
Regular destructor
![]() | function AddChild(AItem: TItem): TItem; |
Adds and returns a child. Sends a TAddToSceneMsg message to all items in scene and to manager (see TItemsManager )
![]() | procedure AddItemLink(Properties: TProperties; const PropName: string; PropOptions: TPOptions; const BaseClass: string); |
Adds an item link property with the given name and base class to Properties. Use this method in order to add a property which points to another item
![]() | procedure AddProperties(const Result: TProperties); virtual; |
This procedure is called (by editor for example) to retrieve a list of item's properties and their values. Any TItem descendant class should override this method in order to add its own properties.
![]() | procedure BroadcastMessage(const Msg: TMessage); |
Calls HandleMessage with the message for all items in the hierarchy starting from Self
![]() | procedure BuildItemLinks; |
Performs initialization of internal data structures. Do not call manually
![]() | procedure ClearParent; |
Sets Parent to nil without removing from hierarchy, etc
![]() | function Clone: TItem; virtual; |
Creates and returns a clone of the item with all properties having the same value as they be in original. Descendants should override this method in order to handle specific fields if any.
![]() | function FindNextChildInclDummy(var Current: TItem): Boolean; |
Finds child next to current assuming childs of dummy childs as own. Pass nil as current to find the first child. If next child found, the function returns True and with Current set to that child. Otherwise returns False with Current set to nil.
![]() | procedure FreeChilds; virtual; |
Frees all childs
![]() | function GetChildByName(const AName: string; SearchChilds: Boolean): TItem; |
Finds a child item by its name. Name is case-sensitive. If SearchChilds is False only first-level childs can be found.
![]() | function GetChildByPath(const AName: string): TItem; |
Finds a child item by its full name relative to the item. Name is case-sensitive.
![]() | function GetChilds: TItems; |
Returns all childs of the item
![]() | class function GetClass: CItem; |
Returns class reference
![]() | function GetFullName: string; |
Returns item's full name in a filesystem-like format:
![]() | function GetItemSize(CountChilds: Boolean): Integer; virtual; |
Returns full size in memory of an item in bytes. Descendants should override this method if they have dynamic fields which sizes are not included in TObject.InstanceSize.
![]() | function GetNextChild(CurrentChild: TItem): TItem; |
Finds a child next to CurrentChild
![]() | function GetNonDummyParent: TItem; |
Returns item's parent, skipping the dummy ones
![]() | procedure GetProperties(const Result: TProperties); |
Do not use this procedure directly. Call AddProperties instead
![]() | function GetRelativeItemName(const AFullName: string): string; |
Returns full path of an item specified by its full name relative to the item
![]() | procedure HandleMessage(const Msg: TMessage); override; |
Main message handler
![]() | procedure InsertChild(AItem: TItem; Index: Integer); |
Inserts a child to the given position in childs collection
![]() | class function IsAbstract: Boolean; virtual; |
Items of abstract classes can not be created in editor
![]() | function IsChildOf(AParent: TItem): Boolean; |
Returns True if item is a child of any level of AParent
![]() | function Load(Stream: TStream): Boolean; virtual; |
Loads an item from a stream and returns True if success
![]() | procedure MarkAsRemoved(DoNotRelease: Boolean); |
Marks item as removed from hierarchy and (if DoNotRelease is False) as released. These marks will be handled by CollectGarbage.
![]() | procedure MoveChild(Child, Target: TItem; Mode: TItemMoveMode); |
Moves a child in hierarchy as specified by Mode (see TItemMoveMode)
![]() | procedure NotifyChilds(const Msg: TMessage); |
Sets mfNotification flag of the message and calls HandleMessage with the message for all first-level childs
![]() | procedure ObtainLinkedItemName(const PropName: string; out Result: string); |
Returns name of an item which linked by a property with the given name
![]() | procedure OnInit; virtual; |
Occurs after object creation and initialization of Root variable
![]() | procedure OnSceneAdd; virtual; |
Occurs when the item added to a scene (usally after loading)
![]() | procedure OnSceneLoaded; virtual; |
Occurs when a scene is completely loaded
![]() | procedure OnSceneRemove; virtual; |
Occurs when the item being remove from scene
![]() | procedure RemoveChild(AItem: TItem); virtual; |
Removes the given child item. Sends a TRemoveFromSceneMsg message to all items in scene and to manager (see TItemsManager )
![]() | procedure RemoveChildByIndex(Index: Integer); virtual; |
Removes a child with the specified index
![]() | function ResolveLink(const PropName: string; out Linked: TItem): Boolean; |
Resolves (with class checking) an object link and returns True if a NEW linked item was resolved.
![]() | procedure ResolveLinks; virtual; |
Called from default OnSceneLoaded event handler. Override to resolve all link which needed to be resolved right after scene load
![]() | function Save(Stream: TStream): Boolean; virtual; |
Saves an item to a stream and returns True if success
![]() | procedure SendMessage(const Msg: TMessage; Recipient: TItem; Destination: TMessageFlags); |
Sends the specified message according to the specified destination.
![]() | function SetChild(Index: Integer; AItem: TItem): TItem; virtual; |
Sets child and returns AItem if success or nil if index is invalid or impossible to set a child
![]() | function SetLinkedObject(const PropName: string; Linked: TItem): Boolean; |
Sets Linked as resolved linked object for a link property with the given name. Returns True if Linked passes type checking
![]() | function SetLinkProperty(const AName, Value: string): Boolean; |
Should be called from SetProperties to handle item link property setting
![]() | procedure SetParent(NewParent: TItem); virtual; |
Sets a new parent value
![]() | procedure SetProperties(Properties: TProperties); virtual; |
This procedure is called (by editor for example) to set values of item's properties. Any TItem descendant class should override this method to allow its own properties to be set.
![]() | procedure SetProperty(const AName, AValue: string); |
Calls SetProperty to set a single property identified by AName
![]() | procedure SetState(const Value: TItemFlags); virtual; |
Sets a new state flags
![]() | property Childs[Index: Integer]: TItem; |
![]() | property Parent: TItem; |
![]() | property State: TItemFlags; |
![]() | property TotalChilds: Integer; |
![]() | property Childs[Index: Integer]: TItem; |
Item's childs collection
![]() | property Parent: TItem; |
Item's parent. You can set this property to move the item within items hierarchy. Setting Parent to nil will remove the item from the hierarchy.
![]() | property State: TItemFlags; |
A set of state flags. See isRemoved, isReleased, isNeedInit, isPicked, isVisible, isProcessing, isDrawVolumes.
![]() | property TotalChilds: Integer; |
Specifies number of childs of an item
|
Last modified: 4 Jul, 2008 |