summaryrefslogtreecommitdiff
path: root/utils/scenemanager/itreeitem.h
blob: b10fe3fd0b719f3db2d96ed0970c67c25ca2a1c7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
//=============================================================================//

#ifndef ITREEITEM_H
#define ITREEITEM_H
#ifdef _WIN32
#pragma once
#endif

class CWorkspace;
class CProject;
class CScene;
class CVCDFile;
class CSoundEntry;
class CWaveFile;
class mxTreeView;

class ITreeItem
{
public:
	ITreeItem()
	{
		m_bExpanded = false;
		m_nOrdinal = -1;
	}

	virtual char const *GetName() const = 0;

	ITreeItem *GetParentItem();

	virtual CWorkspace	*GetWorkspace() = 0;
	virtual CProject	*GetProject() = 0;
	virtual CScene		*GetScene() = 0;
	virtual CVCDFile	*GetVCDFile() = 0;
	virtual CSoundEntry	*GetSoundEntry() = 0;
	virtual CWaveFile	*GetWaveFile() = 0;

	virtual int			GetIconIndex() const = 0;

	bool IsExpanded() const
	{
		return m_bExpanded;
	}

	void SetExpanded( bool exp )
	{
		m_bExpanded = exp;
	}

	mxTreeViewItem *FindItem( mxTreeView *tree, mxTreeViewItem *parent, bool recurse = false );

	virtual void Checkout( bool updatestateicons = true ) = 0;
	virtual void Checkin( bool updatestateicons = true ) = 0;

	virtual void MoveChildUp( ITreeItem *child ) = 0;
	virtual void MoveChildDown( ITreeItem *child ) = 0;

	virtual bool	IsFirstChild()
	{
		if ( !GetParentItem() )
			return false;

		return GetParentItem()->IsChildFirst( this );
	}

	virtual bool	IsLastChild()
	{
		if ( !GetParentItem() )
			return false;

		return GetParentItem()->IsChildLast( this );
	}

	virtual bool		IsChildFirst( ITreeItem *child ) = 0;
	virtual bool		IsChildLast( ITreeItem *child ) = 0;

	void				SetOrdinal( int ordinal ) { m_nOrdinal = ordinal; }
	int					GetOrdinal( void ) const { return m_nOrdinal; }

	virtual void		SetDirty( bool dirty ) = 0;
private:
	bool				m_bExpanded;
	int					m_nOrdinal;
};

#endif // ITREEITEM_H