1 // Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved. 2 // 3 // Redistribution and use in source and binary forms, with or without 4 // modification, are permitted provided that the following conditions are 5 // met: 6 // 7 // * Redistributions of source code must retain the above copyright 8 // notice, this list of conditions and the following disclaimer. 9 // * Redistributions in binary form must reproduce the above 10 // copyright notice, this list of conditions and the following disclaimer 11 // in the documentation and/or other materials provided with the 12 // distribution. 13 // * Neither the name of Google Inc. nor the name Chromium Embedded 14 // Framework nor the names of its contributors may be used to endorse 15 // or promote products derived from this software without specific prior 16 // written permission. 17 // 18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 // 30 // --------------------------------------------------------------------------- 31 // 32 // The contents of this file must follow a specific format in order to 33 // support the CEF translator tool. See the translator.README.txt file in the 34 // tools directory for more information. 35 // 36 37 #ifndef CEF_INCLUDE_VIEWS_CEF_DISPLAY_H_ 38 #define CEF_INCLUDE_VIEWS_CEF_DISPLAY_H_ 39 #pragma once 40 41 #include <vector> 42 43 #include "include/cef_base.h" 44 45 /// 46 // This class typically, but not always, corresponds to a physical display 47 // connected to the system. A fake Display may exist on a headless system, or a 48 // Display may correspond to a remote, virtual display. All size and position 49 // values are in density independent pixel (DIP) coordinates unless otherwise 50 // indicated. Methods must be called on the browser process UI thread unless 51 // otherwise indicated. 52 /// 53 /*--cef(source=library)--*/ 54 class CefDisplay : public CefBaseRefCounted { 55 public: 56 /// 57 // Returns the primary Display. 58 /// 59 /*--cef()--*/ 60 static CefRefPtr<CefDisplay> GetPrimaryDisplay(); 61 62 /// 63 // Returns the Display nearest |point|. Set |input_pixel_coords| to true if 64 // |point| is in pixel screen coordinates instead of DIP screen coordinates. 65 /// 66 /*--cef()--*/ 67 static CefRefPtr<CefDisplay> GetDisplayNearestPoint(const CefPoint& point, 68 bool input_pixel_coords); 69 70 /// 71 // Returns the Display that most closely intersects |bounds|. Set 72 // |input_pixel_coords| to true if |bounds| is in pixel screen coordinates 73 // instead of DIP screen coordinates. 74 /// 75 /*--cef()--*/ 76 static CefRefPtr<CefDisplay> GetDisplayMatchingBounds( 77 const CefRect& bounds, 78 bool input_pixel_coords); 79 80 /// 81 // Returns the total number of Displays. Mirrored displays are excluded; this 82 // method is intended to return the number of distinct, usable displays. 83 /// 84 /*--cef()--*/ 85 static size_t GetDisplayCount(); 86 87 /// 88 // Returns all Displays. Mirrored displays are excluded; this method is 89 // intended to return distinct, usable displays. 90 /// 91 /*--cef(count_func=displays:GetDisplayCount)--*/ 92 static void GetAllDisplays(std::vector<CefRefPtr<CefDisplay>>& displays); 93 94 /// 95 // Returns the unique identifier for this Display. 96 /// 97 /*--cef()--*/ 98 virtual int64 GetID() = 0; 99 100 /// 101 // Returns this Display's device pixel scale factor. This specifies how much 102 // the UI should be scaled when the actual output has more pixels than 103 // standard displays (which is around 100~120dpi). The potential return values 104 // differ by platform. 105 /// 106 /*--cef()--*/ 107 virtual float GetDeviceScaleFactor() = 0; 108 109 /// 110 // Convert |point| from DIP coordinates to pixel coordinates using this 111 // Display's device scale factor. 112 /// 113 /*--cef()--*/ 114 virtual void ConvertPointToPixels(CefPoint& point) = 0; 115 116 /// 117 // Convert |point| from pixel coordinates to DIP coordinates using this 118 // Display's device scale factor. 119 /// 120 /*--cef()--*/ 121 virtual void ConvertPointFromPixels(CefPoint& point) = 0; 122 123 /// 124 // Returns this Display's bounds in DIP screen coordinates. This is the full 125 // size of the display. 126 /// 127 /*--cef()--*/ 128 virtual CefRect GetBounds() = 0; 129 130 /// 131 // Returns this Display's work area in DIP screen coordinates. This excludes 132 // areas of the display that are occupied with window manager toolbars, etc. 133 /// 134 /*--cef()--*/ 135 virtual CefRect GetWorkArea() = 0; 136 137 /// 138 // Returns this Display's rotation in degrees. 139 /// 140 /*--cef()--*/ 141 virtual int GetRotation() = 0; 142 }; 143 144 #endif // CEF_INCLUDE_VIEWS_CEF_DISPLAY_H_ 145