reman3/Rayman_X/cpa/public/SND_OLD/SNDLstPr.hpp

186 lines
5.0 KiB
C++

// (c) Ubi Studios 1996
// See Vincent Greco for any comment or question
#ifndef __SNDLSTPR_HPP__
#define __SNDLSTPR_HPP__
#include "SNDLstEd.Hpp"
#define SNDLST2_ChildClass \
SNDLST2_EdChild<EditorClass, tdxHandleToStruct, tdxPointerToAnchorStruct>
#define SNDLST2_ParentClass \
SNDLST2_EdParent<EditorClass,tdxHandleToStruct,tdxPointerToAnchorStruct>
TemplateParam class SNDLST2_EdParent;
TemplateParam
class SNDLST2_EdChild : public SNDLST2_ElementClass
{
private:
// SNDLST2_ParentClass * pParent;
public:
SNDLST2_EdChild(void)
{
// pParent=NULL;
}
virtual ~SNDLST2_EdChild(void){}
public:
SNDLST2_ParentClass * GetParent() {return (SNDLST2_ParentClass *)GetList();}
// void SetParent(SNDLST2_ParentClass * _pParent, BOOL ModifyEngine=TRUE);
// void Isolate(BOOL ModifyEngine=TRUE);
};
TemplateParam
class SNDLST2_EdParent : virtual public SNDLST2_EdMot<tdxPointerToAnchorStruct>, public SNDLST2_ListClass
{
private:
// SNDLST2_EdList<EditorClass, tdxHandleToStruct, tdxPointerToAnchorStruct> m_List;
public:
void SetStruct(tdxPointerToAnchorStruct pNewStruct)
{
SNDLST2_EdMot<tdxPointerToAnchorStruct>::SetStruct(pNewStruct);
SetEngineAnchor(pNewStruct);
}
public:
SNDLST2_EdParent(void) {SetEngineAnchor(GetStruct());}//m_List.SetOwner(this);/*LST_M_InitParent(GetStruct());*/}
virtual ~SNDLST2_EdParent(void){}
// SNDLST2_EdList<EditorClass, tdxHandleToStruct, tdxPointerToAnchorStruct> *GetList(){return &m_List;}
/*
POSITION InsertAfter( POSITION position, SNDLST2_ChildClass* newElement, BOOL ModifyEngine=TRUE);
POSITION InsertBefore( POSITION position, SNDLST2_ChildClass* newElement, BOOL ModifyEngine=TRUE);
POSITION AddHead(SNDLST2_ChildClass* newElement, BOOL ModifyEngine=TRUE);
POSITION AddTail(SNDLST2_ChildClass* newElement, BOOL ModifyEngine=TRUE);
void RemoveAt(POSITION position, BOOL ModifyEngine=TRUE);
EditorClass* RemoveHead(BOOL ModifyEngine=TRUE);
EditorClass* RemoveTail(BOOL ModifyEngine=TRUE);
void RemoveAll(BOOL ModifyEngine=TRUE);
*/
};
//both Parent and Child (homogenous tree)
TemplateParam
class SNDLST2_EdNode : public SNDLST2_ElementClass, public SNDLST2_ListClass
{
private:
// SNDLST2_EdList<EditorClass, tdxHandleToStruct, tdxPointerToAnchorStruct> m_List;
public:
void SetStruct(tdxPointerToAnchorStruct pNewStruct)
{
SNDLST2_EdMot<tdxPointerToAnchorStruct>::SetStruct(pNewStruct);
SetEngineAnchor(pNewStruct);
}
EditorClass * GetParent() {return (EditorClass *)GetList();}
public:
SNDLST2_EdNode(void) {SetEngineAnchor(GetStruct());}
virtual ~SNDLST2_EdNode(void){}
};
//------------------------------------------------------------------
/*
//redondance avec SetList de SNDLST2_ElementClass ?
TemplateParam void SNDLST2_ChildClass::SetParent(SNDLST2_ParentClass * _pParent, BOOL ModifyEngine)
{
pParent=_pParent;
}
*/
/*
TemplateParam void SNDLST2_ChildClass::Isolate(BOOL ModifyEngine)//can be called as many times as you want.
{
if(pParent)
{
POSITION P=pParent->GetList()->Find(this);
pParent->GetList()->RemoveAt(P, ModifyEngine);
// pParent=NULL;//???
}
}
TemplateParam void SNDLST2_ChildClass::InsertBetween(tdxHandleToStruct pPrev, tdxHandleToStruct pNext)
{
if(pParent)
{
POSITION P=pParent->GetList()->Find(this);
pParent->GetList()->RemoveAt(P);
// pParent=NULL; InsertBetween is always followed by a SetParent
}
LST_M_StaticInsertBetween(GetStruct(),pPrev,pNext);
}
//-----------------------------------------
TemplateParam POSITION SNDLST2_ParentClass::InsertAfter(POSITION position, SNDLST2_ChildClass* newElement, BOOL ModifyEngine)
{
// newElement->SetParent(this, ModifyEngine);
return SNDLST2_ListClass::InsertAfter(position, newElement);
}
TemplateParam POSITION SNDLST2_ParentClass::InsertBefore(POSITION position, SNDLST2_ChildClass* newElement, BOOL ModifyEngine)
{
// newElement->SetParent(this, ModifyEngine);
return SNDLST2_ListClass::InsertBefore(position, newElement);
}
TemplateParam POSITION SNDLST2_ParentClass:: AddHead(SNDLST2_ChildClass* newElement, BOOL ModifyEngine )
{
// newElement->SetParent(this, ModifyEngine);
return SNDLST2_ListClass::AddHead(newElement);
}
TemplateParam POSITION SNDLST2_ParentClass::AddTail(SNDLST2_ChildClass* newElement, BOOL ModifyEngine )
{
// newElement->SetParent(this, ModifyEngine);
return SNDLST2_ListClass::AddTail(newElement);
}
TemplateParam void SNDLST2_ParentClass::RemoveAt(POSITION position, BOOL ModifyEngine)
{
// GetAt(position)->SetParent(NULL, ModifyEngine);
SNDLST2_ListClass::RemoveAt(position);
}
TemplateParam EditorClass* SNDLST2_ParentClass::RemoveHead(BOOL ModifyEngine)
{
SNDLST2_ChildClass *pOldObj = SNDLST2_ListClass::RemoveHead();
// pOldObj->SetParent(NULL, ModifyEngine);
return (EditorClass*)pOldObj;
}
TemplateParam EditorClass* SNDLST2_ParentClass::RemoveTail(BOOL ModifyEngine)
{
SNDLST2_ChildClass *pOldObj = SNDLST2_ListClass::RemoveTail();
// pOldObj->SetParent(NULL, ModifyEngine);
return (EditorClass*)pOldObj;
}
TemplateParam void SNDLST2_ParentClass::RemoveAll(BOOL ModifyEngine)//not tested !!!
{
SNDLST2_ListClass::RemoveAll();
}
*/
#endif //__LSTEDPAR_HPP__