cef/libcef_dll/cpptoc/render_handler_cpptoc.cc

149 lines
4.3 KiB
C++
Raw Normal View History

// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// A portion of this file was generated by the CEF translator tool. When
// making changes by hand only do so within the body of existing function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/cpptoc/render_handler_cpptoc.h"
#include "libcef_dll/ctocpp/browser_ctocpp.h"
// MEMBER FUNCTIONS - Body may be edited by hand.
int CEF_CALLBACK render_handler_get_view_rect(
struct _cef_render_handler_t* self, cef_browser_t* browser,
cef_rect_t* rect)
{
DCHECK(self);
DCHECK(browser);
DCHECK(rect);
if (!self || !browser || !rect)
return 0;
CefRect changeRect(*rect);
int rv = CefRenderHandlerCppToC::Get(self)->GetViewRect(
CefBrowserCToCpp::Wrap(browser), changeRect);
*rect = changeRect;
return rv;
}
int CEF_CALLBACK render_handler_get_screen_rect(
struct _cef_render_handler_t* self, cef_browser_t* browser,
cef_rect_t* rect)
{
DCHECK(self);
DCHECK(browser);
DCHECK(rect);
if (!self || !browser || !rect)
return 0;
CefRect changeRect(*rect);
int rv = CefRenderHandlerCppToC::Get(self)->GetScreenRect(
CefBrowserCToCpp::Wrap(browser), changeRect);
*rect = changeRect;
return rv;
}
int CEF_CALLBACK render_handler_get_screen_point(
struct _cef_render_handler_t* self, cef_browser_t* browser, int viewX,
int viewY, int* screenX, int* screenY)
{
DCHECK(self);
DCHECK(browser);
DCHECK(screenX);
DCHECK(screenY);
if (!self || !browser || !screenX || !screenY)
return 0;
return CefRenderHandlerCppToC::Get(self)->GetScreenPoint(
CefBrowserCToCpp::Wrap(browser), viewX, viewY, *screenX, *screenY);
}
void CEF_CALLBACK render_handler_on_popup_show(
struct _cef_render_handler_t* self, cef_browser_t* browser, int show)
{
DCHECK(self);
DCHECK(browser);
if (!self || !browser)
return;
CefRenderHandlerCppToC::Get(self)->OnPopupShow(
CefBrowserCToCpp::Wrap(browser), show?true:false);
}
void CEF_CALLBACK render_handler_on_popup_size(
struct _cef_render_handler_t* self, cef_browser_t* browser,
const cef_rect_t* rect)
{
DCHECK(self);
DCHECK(browser);
DCHECK(rect);
if (!self || !browser || !rect)
return;
CefRect sizeRect(*rect);
return CefRenderHandlerCppToC::Get(self)->OnPopupSize(
CefBrowserCToCpp::Wrap(browser), sizeRect);
}
void CEF_CALLBACK render_handler_on_paint(struct _cef_render_handler_t* self,
cef_browser_t* browser, enum cef_paint_element_type_t type,
size_t dirtyRectCount, cef_rect_t const* dirtyRects, const void* buffer)
{
DCHECK(self);
DCHECK(browser);
DCHECK(dirtyRectCount > 0);
DCHECK(dirtyRects);
DCHECK(buffer);
if (!self || !browser || dirtyRectCount == 0 || !dirtyRects || !buffer)
return;
CefRenderHandler::RectList rectList;
for (size_t i = 0; i < dirtyRectCount; ++i)
rectList.push_back(dirtyRects[i]);
return CefRenderHandlerCppToC::Get(self)->OnPaint(
CefBrowserCToCpp::Wrap(browser), type, rectList, buffer);
}
void CEF_CALLBACK render_handler_on_cursor_change(
struct _cef_render_handler_t* self, cef_browser_t* browser,
cef_cursor_handle_t cursor)
{
DCHECK(self);
DCHECK(browser);
if (!self || !browser)
return;
return CefRenderHandlerCppToC::Get(self)->OnCursorChange(
CefBrowserCToCpp::Wrap(browser), cursor);
}
// CONSTRUCTOR - Do not edit by hand.
CefRenderHandlerCppToC::CefRenderHandlerCppToC(CefRenderHandler* cls)
: CefCppToC<CefRenderHandlerCppToC, CefRenderHandler, cef_render_handler_t>(
cls)
{
struct_.struct_.get_view_rect = render_handler_get_view_rect;
struct_.struct_.get_screen_rect = render_handler_get_screen_rect;
struct_.struct_.get_screen_point = render_handler_get_screen_point;
struct_.struct_.on_popup_show = render_handler_on_popup_show;
struct_.struct_.on_popup_size = render_handler_on_popup_size;
struct_.struct_.on_paint = render_handler_on_paint;
struct_.struct_.on_cursor_change = render_handler_on_cursor_change;
}
#ifndef NDEBUG
template<> long CefCppToC<CefRenderHandlerCppToC, CefRenderHandler,
cef_render_handler_t>::DebugObjCt = 0;
#endif