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
|
#include "stdafx.h"
class CNewStoryLogWindow : public CSimpleLogWindow
{
HWND m_hwnd = nullptr;
NewstoryListData *m_histCtrl;
public:
CNewStoryLogWindow(CMsgDialog &pDlg) :
CSimpleLogWindow(pDlg)
{
}
void Attach() override
{
RECT rc;
GetClientRect(GetDlgItem(m_pDlg.GetHwnd(), IDC_SRMM_LOG), &rc);
m_hwnd = ::CreateWindowW(_T(NEWSTORYLIST_CLASS), L"NewStory", WS_VISIBLE | WS_CHILD | WS_TABSTOP,
0, 0, rc.left - rc.right, rc.bottom - rc.top, m_pDlg.GetHwnd(), 0, m_pDlg.GetInst(), 0);
m_histCtrl = (NewstoryListData *)GetWindowLongPtr(m_hwnd, 0);
m_histCtrl->SetDialog(&m_pDlg);
}
void Detach() override
{
::DestroyWindow(m_hwnd);
}
//////////////////////////////////////////////////////////////////////////////////////
bool AtBottom() override
{
return m_histCtrl->AtBottom();
}
void Clear() override
{
m_histCtrl->Clear();
}
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 (!bAppend)
Clear();
m_histCtrl->AddEvent(m_pDlg.m_hContact, hDbEventFirst, count);
}
void LogChatEvent(const LOGINFO &lin) override
{
m_histCtrl->AddChatEvent(m_pDlg.getChat(), &lin);
}
void Resize() override
{
bool bottomScroll = m_pDlg.isChat() ? AtBottom() : true;
RECT rc;
GetWindowRect(GetDlgItem(m_pDlg.GetHwnd(), IDC_SRMM_LOG), &rc);
POINT pt = { rc.left, rc.top };
ScreenToClient(GetParent(m_hwnd), &pt);
::SetWindowPos(m_hwnd, 0, pt.x, pt.y, rc.right - rc.left, rc.bottom - rc.top, SWP_NOACTIVATE | SWP_NOZORDER);
if (bottomScroll)
ScrollToBottom();
}
void ScrollToBottom() override
{
m_histCtrl->ScrollBottom();
}
};
CSrmmLogWindow* __cdecl NewStory_Stub(CMsgDialog &pDlg)
{
return new CNewStoryLogWindow(pDlg);
}
|