summaryrefslogtreecommitdiff
path: root/plugins/NewStory/src/history_log.cpp
blob: 1bcd86ab24577bd1258936d867fa9f7f653bff05 (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
#include "stdafx.h"

class CNewStoryLogWindow : public CSrmmLogWindow
{
	HWND m_hwnd = nullptr;

public:
	CNewStoryLogWindow(CMsgDialog &pDlg) :
		CSrmmLogWindow(pDlg)
	{
	}

	void Attach() override
	{
		m_hwnd = ::CreateWindow(_T(NEWSTORYLIST_CLASS), L"NewStory", WS_VISIBLE | WS_CHILD | WS_TABSTOP, 0, 0, 300, 150, m_pDlg.GetHwnd(), 0, m_pDlg.GetInst(), 0);
	}

	void Detach() override
	{
		::DestroyWindow(m_hwnd);
	}

	//////////////////////////////////////////////////////////////////////////////////////

	bool AtBottom() override
	{
		return false;
	}

	void Clear() override
	{
	}

	HWND GetHwnd() override
	{
		return m_hwnd;
	}

	wchar_t* GetSelection() override
	{
		return nullptr;
	}

	int GetType() override
	{
		return 1;
	}

	void LogEvents(MEVENT hDbEventFirst, int count, bool bAppend) override
	{
		if (count != -1) {
			ADDEVENTS tmp = { m_pDlg.m_hContact, hDbEventFirst, count };
			SendMessage(m_hwnd, NSM_ADDEVENTS, (LPARAM)&tmp, 0);
		}
		else SendMessage(m_hwnd, NSM_ADDHISTORY, m_pDlg.m_hContact, 0);
	}

	void LogEvents(DBEVENTINFO *dbei_s, bool bAppend)
	{
	}

	void LogEvents(LOGINFO *pLog, bool) override
	{
	}

	void Resize() override
	{
		RECT rc;
		GetClientRect(GetDlgItem(m_pDlg.GetHwnd(), IDC_SRMM_LOG), &rc);

		::SetWindowPos(m_hwnd, 0, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, SWP_NOACTIVATE | SWP_NOZORDER);
	}

	void ScrollToBottom() override
	{
		::SendMessage(m_hwnd, NSM_SEEKEND, 0, 0);
	}
};

CSrmmLogWindow* __cdecl NewStory_Stub(CMsgDialog &pDlg)
{
	return new CNewStoryLogWindow(pDlg);
}