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

#include "stdafx.h"
#include "hammer.h"
#include "DynamicDialogWnd.h"

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

/////////////////////////////////////////////////////////////////////////////
// CDynamicDialogWnd

CDynamicDialogWnd::CDynamicDialogWnd(CWnd *pParent)
{
	m_pDialog = NULL;
	Create(NULL, "DynamicDialogWnd", WS_BORDER | WS_CAPTION | WS_CHILD, 
		CRect(0, 0, 50, 50), pParent, 1);
	SetWindowPos(&wndTopMost, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
}

CDynamicDialogWnd::~CDynamicDialogWnd()
{
	SetDialogClass(0, NULL);
}


BEGIN_MESSAGE_MAP(CDynamicDialogWnd, CWnd)
	//{{AFX_MSG_MAP(CDynamicDialogWnd)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()


/////////////////////////////////////////////////////////////////////////////
// CDynamicDialogWnd message handlers

void CDynamicDialogWnd::SetDialogClass(UINT nID, CDialog *pDialog)
{
	delete m_pDialog;

	if(!pDialog)
		return;

	m_pDialog = pDialog;

	CRect rWindow;
	GetWindowRect(&rWindow);

	SetRedraw(FALSE);

/*
	m_pDialog->Create(nID, this);

	// resize this window
	CRect rDialog;
	m_pDialog->GetWindowRect(&rDialog);
	MoveWindow(rWindow.left, rWindow.top, rDialog.Width(), rDialog.Height());
*/
	MoveWindow(0, 0, 50, 50);

	SetRedraw(TRUE);
	Invalidate();
	UpdateWindow();
}