summaryrefslogtreecommitdiff
path: root/hammer/strdlg.cpp
blob: 69b4a4b8a1d4f2192679476c5cd4eadd7b11a511 (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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
// $NoKeywords: $
//
//=============================================================================//
// StrDlg.cpp : implementation file
//

#include "stdafx.h"
#include "hammer.h"
#include "StrDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CStrDlg dialog

CStrDlg::CStrDlg(DWORD dwFlags, LPCTSTR pszString, LPCTSTR pszPrompt, 
				 LPCTSTR pszTitle)
	: CDialog(CStrDlg::IDD, NULL)
{
	//{{AFX_DATA_INIT(CStrDlg)
	m_string = _T("");
	//}}AFX_DATA_INIT

	iRangeLow = 0;
	iRangeHigh = 10;
	iIncrement = 1;
	this->dwFlags = dwFlags;

	m_string = pszString;
	m_strPrompt = pszPrompt;
	m_strTitle = pszTitle;
}

void CStrDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	DDX_Text(pDX, IDC_PROMPT, m_strPrompt);
	DDX_Text(pDX, IDC_EDIT, m_string);
	DDX_Control(pDX, IDC_EDIT, m_cEdit);
	DDX_Control(pDX, IDC_SPIN, m_cSpin);
	//{{AFX_DATA_MAP(CStrDlg)
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CStrDlg, CDialog)
	//{{AFX_MSG_MAP(CStrDlg)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CStrDlg message handlers

void CStrDlg::SetRange(int iLow, int iHigh, int iIncrement_)
{
	iRangeLow = iLow;
	iRangeHigh = iHigh;
	this->iIncrement = 1;
}

BOOL CStrDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();

	if(dwFlags & Spin)	// enable spin
	{
		m_cSpin.EnableWindow(TRUE);
		m_cSpin.SetRange(iRangeLow, iRangeHigh);
		m_cSpin.SetBuddy(&m_cEdit);
	}
	else
	{
		m_cSpin.ShowWindow(SW_HIDE);
	}

	SetWindowText(m_strTitle);

	return TRUE;
}