summaryrefslogtreecommitdiff
path: root/Shutdown/LogDlg.h
blob: ac174b44605e8e4f4a5cd1a9287c113ab1362ded (plain)
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
// LogDlg.h: Definition of the CLogDlg class
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_LOGDLG_H__F3AF1F46_93A1_11D3_BFC3_0020182B97FC__INCLUDED_)
#define AFX_LOGDLG_H__F3AF1F46_93A1_11D3_BFC3_0020182B97FC__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "resource.h"       // main symbols
#include <atlwin.h>
#include <atlctrls.h>
#include <contexthelp.h>

#include "SizingDialog.h"
#include "PersistPosWindow.h"

/////////////////////////////////////////////////////////////////////////////
// CLogDlg

class CLogDlg 
 	: public CDialogImplEx,
// 	: public CDialogImpl<CLogDlg>,
	  public CSizingDialog<CLogDlg>,
	  public CPersistPosWindow<CLogDlg>,
	  public CContextHelp<CLogDlg>
{
public:
	CLogDlg() : CDialogImplEx(IDD), CPersistPosWindow<CLogDlg>(_T("Log"))
	{ 
		m_hWndParent = NULL;
		m_hEvent = NULL;
		m_hIcon = NULL;
	}
	
	~CLogDlg()
	{ 
		if(IsWindow()) 
			DestroyWindow(); 

		if(m_hEvent)
			CloseHandle(m_hEvent);
	} 

// Dialog Data
protected:
	enum { IDD = IDD_LOG };
	CListViewCtrl	m_ctlErrors;
	CImageList m_ImageListSmall;
	HWND m_hWndParent;
	HICON m_hIcon;
	HANDLE m_hEvent;

public:
BEGIN_MSG_MAP(CLogDlg)
	MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
	MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
	MESSAGE_HANDLER(WM_CLOSE, OnClose)
//	MESSAGE_HANDLER(WM_TIMER, OnTimer)
	NOTIFY_HANDLER(IDC_ERROR_LOG, NM_RCLICK, OnListRClick)
	COMMAND_HANDLER(ID_HIDE, BN_CLICKED, OnHide)
	COMMAND_HANDLER(ID_SAVE, BN_CLICKED, OnSave)
	COMMAND_ID_HANDLER(ID_ERROR_FIX, OnErrorFix)
	COMMAND_ID_HANDLER(ID_ERROR_RETRY, OnErrorRetry)
	COMMAND_ID_HANDLER(ID_ERROR_DELETE, OnErrorDelete)
	CHAIN_MSG_MAP(CSizingDialog<CLogDlg>)
	CHAIN_MSG_MAP(CContextHelp<CLogDlg>)
END_MSG_MAP()

BEGIN_HELP_MAP("nightsec.hlp")
	HELP_ID(IDC_ERROR_LOG, 5003)
	HELP_ID(ID_HIDE, 5002)
	HELP_ID(ID_SAVE, 5001)
END_HELP_MAP

	// Generated message map functions
	LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
//	LRESULT OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnClose(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnListRClick(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
	LRESULT OnHide(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
	LRESULT OnSave(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
	LRESULT OnErrorFix(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
	LRESULT OnErrorRetry(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
	LRESULT OnErrorDelete(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);

public:
	void Init(HWND hWndParent);
	bool RemoveItem(int nIndex);
	HRESULT FixItem(int nIndex);
	HRESULT RetryItem(int nIndex);
	bool AddItem(INightSecError* pError);
	bool HasErrors();
	void ShowLog();
	HRESULT SaveLog(/*const string& sFile*/);
	void WaitLog();
};

#endif // !defined(AFX_LOGDLG_H__F3AF1F46_93A1_11D3_BFC3_0020182B97FC__INCLUDED_)