diff options
Diffstat (limited to 'hammer/messagewnd.h')
| -rw-r--r-- | hammer/messagewnd.h | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/hammer/messagewnd.h b/hammer/messagewnd.h new file mode 100644 index 0000000..107cb41 --- /dev/null +++ b/hammer/messagewnd.h @@ -0,0 +1,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 |