summaryrefslogtreecommitdiff
path: root/hammer/messagewnd.h
blob: 107cb4120c9f8d943e75c9a73c4b83febb2286aa (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
85
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
//=============================================================================

#ifndef MESSAGEWND_H
#define MESSAGEWND_H
#pragma once

#include <afxtempl.h>
#include "GlobalFunctions.h"

const int MAX_MESSAGE_WND_LINES = 5000;

enum
{
	MESSAGE_WND_MESSAGE_LENGTH = 150
};


class CMessageWnd : private CMDIChildWnd
{
public:

	static CMessageWnd *CreateMessageWndObject();
	void CreateMessageWindow( CMDIFrameWnd *pwndParent, CRect &rect );

	void ShowMessageWindow();
	void ToggleMessageWindow();
	bool IsVisible();

	void Activate();

	void Resize( CRect &rect );

	DECLARE_DYNCREATE(CMessageWnd)

protected:
	CMessageWnd();           // protected constructor used by dynamic creation

	struct MWMSGSTRUCT
	{
		MWMSGTYPE type;
		TCHAR szMsg[MESSAGE_WND_MESSAGE_LENGTH];
		int MsgLen;	// length of message w/o 0x0
	} ;

// Attributes
public:
	void AddMsg(MWMSGTYPE type, TCHAR* msg);

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CMessageWnd)
	//}}AFX_VIRTUAL

// Implementation
protected:
	virtual ~CMessageWnd();

	void CalculateScrollSize();
	CArray<MWMSGSTRUCT, MWMSGSTRUCT&> MsgArray;

	CFont Font;
	int iCharWidth;	// calculated in first paint
	int iNumMsgs;

	// Generated message map functions
	//{{AFX_MSG(CMessageWnd)
	afx_msg void OnPaint();
	afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
	afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg void OnClose();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};


#endif // MESSAGEWND_H