summaryrefslogtreecommitdiff
path: root/public/dme_controls/particlesystempropertiespanel.h
blob: 1f02a9af20ef7db30648370824c20e29b6e731eb (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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Dialog used to edit properties of a particle system definition
//
//===========================================================================//

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

#include "vgui_controls/EditablePanel.h"
#include "tier1/utlstring.h"
#include "datamodel/dmehandle.h"
#include "particles/particles.h"

//-----------------------------------------------------------------------------
// Forward declarations
//-----------------------------------------------------------------------------
class CDmeParticleSystemDefinition;
class CParticleFunctionBrowser;
class CDmeElementPanel;

namespace vgui
{
	class Splitter;
	class ComboBox;
}


//-----------------------------------------------------------------------------
// Used by the panel to discover the list of known particle system definitions
//-----------------------------------------------------------------------------
class IParticleSystemPropertiesPanelQuery
{
public:
	virtual void GetKnownParticleDefinitions( CUtlVector< CDmeParticleSystemDefinition* > &definitions ) = 0;
};


//-----------------------------------------------------------------------------
// Panel used to edit a particle system	definition
//-----------------------------------------------------------------------------
class CParticleSystemPropertiesPanel : public vgui::EditablePanel
{
	DECLARE_CLASS_SIMPLE( CParticleSystemPropertiesPanel, vgui::EditablePanel );

	// Sends the message 'ParticleSystemModified' when the particle system was modified in any way
	// Sends the message 'ParticleFunctionSelChanged' when the selected particle function changed
	//	-- stores the selected CDmeParticleFunction in a subkey called 'function' 

public:
	CParticleSystemPropertiesPanel( IParticleSystemPropertiesPanelQuery *pQuery, vgui::Panel* pParent );   // standard constructor

	// Sets the particle system to look at
	void SetParticleSystem( CDmeParticleSystemDefinition *pParticleSystem );

	// Refreshes display
	void Refresh( bool bValuesOnly = true );

private:
	// For inheriting classes to get notified without having to listen to messages
	virtual void OnParticleSystemModified() {}

	MESSAGE_FUNC( OnTextChanged, "TextChanged" );	
	MESSAGE_FUNC_PARAMS( OnDmeElementChanged, "DmeElementChanged", params );
	MESSAGE_FUNC( OnParticleSystemModifiedInternal, "ParticleSystemModified" );
	MESSAGE_FUNC_PARAMS( OnParticleFunctionSelChanged, "ParticleFunctionSelChanged", params );

	IParticleSystemPropertiesPanelQuery *m_pQuery;

	vgui::Splitter *m_pSplitter;
	vgui::ComboBox *m_pFunctionTypeCombo;
	vgui::EditablePanel *m_pFunctionBrowserArea;
	CParticleFunctionBrowser *m_pParticleFunctionBrowser[PARTICLE_FUNCTION_COUNT];

	CDmeElementPanel *m_pParticleFunctionProperties;

	CDmeHandle< CDmeParticleSystemDefinition > m_hParticleSystem;
};


#endif // PARTICLESYSTEMPROPERTIESPANEL_H