summaryrefslogtreecommitdiff
path: root/hammer/ToolBase.cpp
blob: fa04b9cd60518d8881191b1c71cb370c3b7b372c (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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
//=============================================================================//

#include "stdafx.h"
#include "ToolInterface.h"
#include "mapdoc.h"

// memdbgon must be the last include file in a .cpp file!!!
#include <tier0/memdbgon.h>

void CBaseTool::Init( CMapDoc *pDocument )
{
	m_bActiveTool = false;
	m_pDocument = pDocument;
}

//-----------------------------------------------------------------------------
// Purpose: Called whtn this tool is becoming the active tool.
// Input  : eOldTool - The tool that was previously active.
//-----------------------------------------------------------------------------
void CBaseTool::Activate()
{
	OnActivate();

	m_pDocument->UpdateAllViews( MAPVIEW_UPDATE_TOOL );

	m_bActiveTool = true;
}

//-----------------------------------------------------------------------------
// Purpose: Called when this tool is no longer the active tool.
// Input  : eNewTool - The tool that is being activated.
//-----------------------------------------------------------------------------
void CBaseTool::Deactivate()
{
	OnDeactivate();

	if ( m_pDocument )
		m_pDocument->UpdateAllViews( MAPVIEW_UPDATE_TOOL );

	m_bActiveTool = false;
}