cef/libcef_dll/ctocpp/views/display_ctocpp.cc
Marshall Greenblatt 06e73fff15 Implement Views framework on Windows and Linux (issue #1749).
- Add Views header files in a new include/views directory.
- Add initial top-level window (CefWindow), control (CefBrowserView,
  CefLabelButton, CefMenuButton, CefPanel, CefScrollView,
  CefTextfield) and layout (CefBoxLayout, CefFlowLayout) support.
  See libcef/browser/views/view_impl.h comments for implementation
  details.
- Add Views example usage in cefclient and cefsimple and Views unit
  tests in cef_unittests. Pass the `--use-views` command-line flag to
  cefclient, cefsimple and cef_unittests to run using the Views
  framework instead of platform APIs. For cefclient and cefsimple
  this will create the browser window and all related functionality
  using the Views framework. For cef_unittests this will run all
  tests (except OSR tests) in a Views-based browser window. Views-
  specific unit tests (`--gtest_filter=Views*`) will be run even if
  the the `--use-views` flag is not specified.
- Pass the `--hide-frame` command-line flag to cefclient to demo a
  frameless Views-based browser window.
- Pass the `--hide-controls` command-line flag to cefclient to demo a
  browser window without top controls. This also works in non-Views
  mode.
- Pass the `--enable-high-dpi-support` command-line flag to
  cef_unittests on Windows to test high-DPI support on a display
  that supports it.
- Add CefImage for reading/writing image file formats.
- Add CefBrowser::DownloadImage() for downloading image URLs as a
  CefImage representation. This is primarily for loading favicons.
- Add CefMenuModel::CreateMenuModel() and CefMenuModelDelegate for
  creating custom menus. This is primarily for use with
  CefMenuButton.
- Add CefBrowser::TryCloseBrowser() helper for closing a browser.
  Also improve related documentation in cef_life_span_handler.h.
- Rename cef_page_range_t to cef_range_t. It is now also used by
  CefTextfield.
- Remove CefLifeSpanHandler::RunModal() which is never called.
- Add draggable regions example to cefclient.
2016-04-26 11:58:13 -04:00

216 lines
5.7 KiB
C++

// Copyright (c) 2016 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.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include <algorithm>
#include "libcef_dll/ctocpp/views/display_ctocpp.h"
// STATIC METHODS - Body may be edited by hand.
CefRefPtr<CefDisplay> CefDisplay::GetPrimaryDisplay() {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_display_t* _retval = cef_display_get_primary();
// Return type: refptr_same
return CefDisplayCToCpp::Wrap(_retval);
}
CefRefPtr<CefDisplay> CefDisplay::GetDisplayNearestPoint(const CefPoint& point,
bool input_pixel_coords) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_display_t* _retval = cef_display_get_nearest_point(
&point,
input_pixel_coords);
// Return type: refptr_same
return CefDisplayCToCpp::Wrap(_retval);
}
CefRefPtr<CefDisplay> CefDisplay::GetDisplayMatchingBounds(
const CefRect& bounds, bool input_pixel_coords) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_display_t* _retval = cef_display_get_matching_bounds(
&bounds,
input_pixel_coords);
// Return type: refptr_same
return CefDisplayCToCpp::Wrap(_retval);
}
size_t CefDisplay::GetDisplayCount() {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
size_t _retval = cef_display_get_count();
// Return type: simple
return _retval;
}
void CefDisplay::GetAllDisplays(std::vector<CefRefPtr<CefDisplay>>& displays) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Translate param: displays; type: refptr_vec_same_byref
size_t displaysSize = displays.size();
size_t displaysCount = std::max(GetDisplayCount(), displaysSize);
cef_display_t** displaysList = NULL;
if (displaysCount > 0) {
displaysList = new cef_display_t*[displaysCount];
DCHECK(displaysList);
if (displaysList) {
memset(displaysList, 0, sizeof(cef_display_t*)*displaysCount);
}
if (displaysList && displaysSize > 0) {
for (size_t i = 0; i < displaysSize; ++i) {
displaysList[i] = CefDisplayCToCpp::Unwrap(displays[i]);
}
}
}
// Execute
cef_display_get_alls(
&displaysCount,
displaysList);
// Restore param:displays; type: refptr_vec_same_byref
displays.clear();
if (displaysCount > 0 && displaysList) {
for (size_t i = 0; i < displaysCount; ++i) {
displays.push_back(CefDisplayCToCpp::Wrap(displaysList[i]));
}
delete [] displaysList;
}
}
// VIRTUAL METHODS - Body may be edited by hand.
int64 CefDisplayCToCpp::GetID() {
cef_display_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_id))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int64 _retval = _struct->get_id(_struct);
// Return type: simple
return _retval;
}
float CefDisplayCToCpp::GetDeviceScaleFactor() {
cef_display_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_device_scale_factor))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
float _retval = _struct->get_device_scale_factor(_struct);
// Return type: simple
return _retval;
}
void CefDisplayCToCpp::ConvertPointToPixels(CefPoint& point) {
cef_display_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, convert_point_to_pixels))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->convert_point_to_pixels(_struct,
&point);
}
void CefDisplayCToCpp::ConvertPointFromPixels(CefPoint& point) {
cef_display_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, convert_point_from_pixels))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->convert_point_from_pixels(_struct,
&point);
}
CefRect CefDisplayCToCpp::GetBounds() {
cef_display_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_bounds))
return CefRect();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_rect_t _retval = _struct->get_bounds(_struct);
// Return type: simple
return _retval;
}
CefRect CefDisplayCToCpp::GetWorkArea() {
cef_display_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_work_area))
return CefRect();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_rect_t _retval = _struct->get_work_area(_struct);
// Return type: simple
return _retval;
}
int CefDisplayCToCpp::GetRotation() {
cef_display_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_rotation))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->get_rotation(_struct);
// Return type: simple
return _retval;
}
// CONSTRUCTOR - Do not edit by hand.
CefDisplayCToCpp::CefDisplayCToCpp() {
}
template<> cef_display_t* CefCToCpp<CefDisplayCToCpp, CefDisplay,
cef_display_t>::UnwrapDerived(CefWrapperType type, CefDisplay* c) {
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#ifndef NDEBUG
template<> base::AtomicRefCount CefCToCpp<CefDisplayCToCpp, CefDisplay,
cef_display_t>::DebugObjCt = 0;
#endif
template<> CefWrapperType CefCToCpp<CefDisplayCToCpp, CefDisplay,
cef_display_t>::kWrapperType = WT_DISPLAY;