forked from cefsharp/CefSharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRenderClientAdapter.cpp
More file actions
58 lines (48 loc) · 1.72 KB
/
Copy pathRenderClientAdapter.cpp
File metadata and controls
58 lines (48 loc) · 1.72 KB
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
#include "Stdafx.h"
#include "IRenderWebBrowser.h"
#include "RenderClientAdapter.h"
namespace CefSharp
{
void RenderClientAdapter::OnPopupShow(CefRefPtr<CefBrowser> browser, bool show)
{
_renderBrowserControl->SetPopupIsOpen(show);
}
void RenderClientAdapter::OnPopupSize(CefRefPtr<CefBrowser> browser, const CefRect& rect)
{
_renderBrowserControl->SetPopupSizeAndPosition((void*) &rect);
}
void RenderClientAdapter::OnPaint(CefRefPtr<CefBrowser> browser, PaintElementType type, const RectList& dirtyRects, const void* buffer)
{
if (type == PET_VIEW)
{
int width, height;
browser->GetSize(type, width, height);
_renderBrowserControl->SetBuffer(width, height, buffer);
}
else if (type == PET_POPUP)
{
int width, height;
browser->GetSize(type, width, height);
_renderBrowserControl->SetPopupBuffer(width, height, buffer);
}
}
void RenderClientAdapter::OnCursorChange(CefRefPtr<CefBrowser> browser, CefCursorHandle cursor)
{
_renderBrowserControl->SetCursor((IntPtr)cursor);
}
bool RenderClientAdapter::GetViewRect(CefRefPtr<CefBrowser> browser, CefRect& rect)
{
// The simulated screen and view rectangle are the same. This is necessary for popup menus to be located and sized inside
// the view.
int width, height;
browser->GetSize(PET_VIEW, width, height);
rect.x = rect.y = 0;
rect.width = width;
rect.height = height;
return true;
}
bool RenderClientAdapter::GetScreenRect(CefRefPtr<CefBrowser> browser, CefRect& rect)
{
return GetViewRect(browser, rect);
}
}