summaryrefslogtreecommitdiff
path: root/game/client/econ/tool_items/tool_items.h
blob: 14bfb368b5c90027920a0b353870fc54ce92e0cc (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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
// $NoKeywords: $
//=============================================================================//

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

#include "item_model_panel.h"

//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
class CBaseToolUsageDialog : public vgui::EditablePanel
{
	DECLARE_CLASS_SIMPLE( CBaseToolUsageDialog, vgui::EditablePanel );

public:
	CBaseToolUsageDialog( vgui::Panel *pParent, const char *panelName, CEconItemView *pTool, CEconItemView *pToolSubject );

	virtual void	ApplySchemeSettings( vgui::IScheme *scheme );
	virtual void	PerformLayout();
	virtual void	OnCommand( const char *command );
	virtual void	OnKeyCodeTyped( vgui::KeyCode code ) OVERRIDE;
	virtual void	OnKeyCodePressed( vgui::KeyCode code ) OVERRIDE;

	virtual void	Apply( void ) { return; }

	inline CEconItemView *GetToolItem() { return m_pToolModelPanel->GetItem(); };
	inline CEconItemView *GetSubjectItem() { return m_pSubjectModelPanel->GetItem(); };

protected:
	CItemModelPanel			*m_pToolModelPanel;
	CItemModelPanel			*m_pSubjectModelPanel;
	CItemModelPanel			*m_pMouseOverItemPanel;
	CItemModelPanelToolTip	*m_pMouseOverTooltip;
	vgui::Label				*m_pTitleLabel;

	const char				*m_pszInternalPanelName;
};


// Utility function for tool dialogs.
void MakeModalAndBringToFront( vgui::EditablePanel *dialog );

bool ToolCanApplyTo( CEconItemView *pTool, CEconItemView *pToolSubject );

// Given a tool and an item to apply the tool's effects upon,
// gather required information from the user and
// send a change request to the GC.
bool ApplyTool( vgui::Panel *pParent, CEconItemView *pTool, CEconItemView *pToolSubject );

#endif // TOOL_ITEMS_H