-
Notifications
You must be signed in to change notification settings - Fork 2
/
CefRealWndHandler.cpp
56 lines (48 loc) · 1.42 KB
/
CefRealWndHandler.cpp
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
#include "StdAfx.h"
#include "CefRealWndHandler.h"
#include "SCefBrowser.h"
CCefRealWndHandler::CCefRealWndHandler(void)
{
}
CCefRealWndHandler::~CCefRealWndHandler(void)
{
}
HWND CCefRealWndHandler::OnRealWndCreate(SRealWnd *pRealWnd)
{
const SRealWndParam& param = pRealWnd->GetRealWndParam();
if(param.m_strClassName == _T("cef_cls"))
{
HWND HostWnd = pRealWnd->GetContainer()->GetHostHwnd();
SCefBrowser* pSCefBrowser = new SCefBrowser;
HWND hCefWnd = pSCefBrowser->Create(L"cef", WS_CHILD |WS_VISIBLE,NULL,0,0,0,0,HostWnd,NULL);
return pSCefBrowser->m_hWnd;
}
return 0;
}
void CCefRealWndHandler::OnRealWndDestroy(SRealWnd *pRealWnd)
{
const SRealWndParam ¶m=pRealWnd->GetRealWndParam();
if(param.m_strClassName==_T("cef_cls"))
{
SCefBrowser *pSCefBrowser=(SCefBrowser*) pRealWnd->GetData();
if(pSCefBrowser)
{
pSCefBrowser->DestroyWindow();
delete pSCefBrowser;
}
}
}
BOOL CCefRealWndHandler::OnRealWndInit(SRealWnd *pRealWnd)
{
return FALSE;
}
BOOL CCefRealWndHandler::OnRealWndSize(SRealWnd *pRealWnd)
{
if(!pRealWnd)
return FALSE;
// return TRUE ÓÉ×Ô¼ºÀ´Òƶ¯´°¿ÚλÖÃ
SWindow* pParent = pRealWnd->GetParent();
CRect rcParent = pParent->GetClientRect();
::SetWindowPos(pRealWnd->GetRealHwnd(FALSE),0,rcParent.left,rcParent.top,rcParent.Width(),rcParent.Height(),SWP_NOZORDER);
return TRUE;
}