]> git.sesse.net Git - casparcg/blob - dependencies64/cef/include/cef_render_handler.h
c0997247fc241b9b191d82ea8b179cca9d7840a3
[casparcg] / dependencies64 / cef / include / cef_render_handler.h
1 // Copyright (c) 2012 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_CEF_RENDER_HANDLER_H_
38 #define CEF_INCLUDE_CEF_RENDER_HANDLER_H_
39 #pragma once
40
41 #include "include/cef_base.h"
42 #include "include/cef_browser.h"
43 #include <vector>
44
45 ///
46 // Implement this interface to handle events when window rendering is disabled.
47 // The methods of this class will be called on the UI thread.
48 ///
49 /*--cef(source=client)--*/
50 class CefRenderHandler : public virtual CefBase {
51  public:
52   typedef cef_paint_element_type_t PaintElementType;
53   typedef std::vector<CefRect> RectList;
54
55   ///
56   // Called to retrieve the root window rectangle in screen coordinates. Return
57   // true if the rectangle was provided.
58   ///
59   /*--cef()--*/
60   virtual bool GetRootScreenRect(CefRefPtr<CefBrowser> browser,
61                                  CefRect& rect) { return false; }
62
63   ///
64   // Called to retrieve the view rectangle which is relative to screen
65   // coordinates. Return true if the rectangle was provided.
66   ///
67   /*--cef()--*/
68   virtual bool GetViewRect(CefRefPtr<CefBrowser> browser, CefRect& rect) =0;
69
70   ///
71   // Called to retrieve the translation from view coordinates to actual screen
72   // coordinates. Return true if the screen coordinates were provided.
73   ///
74   /*--cef()--*/
75   virtual bool GetScreenPoint(CefRefPtr<CefBrowser> browser,
76                               int viewX,
77                               int viewY,
78                               int& screenX,
79                               int& screenY) { return false; }
80
81   ///
82   // Called to allow the client to fill in the CefScreenInfo object with
83   // appropriate values. Return true if the |screen_info| structure has been
84   // modified.
85   //
86   // If the screen info rectangle is left empty the rectangle from GetViewRect
87   // will be used. If the rectangle is still empty or invalid popups may not be
88   // drawn correctly.
89   ///
90   /*--cef()--*/
91   virtual bool GetScreenInfo(CefRefPtr<CefBrowser> browser,
92                              CefScreenInfo& screen_info) { return false; }
93
94   ///
95   // Called when the browser wants to show or hide the popup widget. The popup
96   // should be shown if |show| is true and hidden if |show| is false.
97   ///
98   /*--cef()--*/
99   virtual void OnPopupShow(CefRefPtr<CefBrowser> browser,
100                            bool show) {}
101
102   ///
103   // Called when the browser wants to move or resize the popup widget. |rect|
104   // contains the new location and size.
105   ///
106   /*--cef()--*/
107   virtual void OnPopupSize(CefRefPtr<CefBrowser> browser,
108                            const CefRect& rect) {}
109
110   ///
111   // Called when an element should be painted. |type| indicates whether the
112   // element is the view or the popup widget. |buffer| contains the pixel data
113   // for the whole image. |dirtyRects| contains the set of rectangles that need
114   // to be repainted. On Windows |buffer| will be |width|*|height|*4 bytes
115   // in size and represents a BGRA image with an upper-left origin.
116   ///
117   /*--cef()--*/
118   virtual void OnPaint(CefRefPtr<CefBrowser> browser,
119                        PaintElementType type,
120                        const RectList& dirtyRects,
121                        const void* buffer,
122                        int width, int height) =0;
123
124   ///
125   // Called when the browser window's cursor has changed.
126   ///
127   /*--cef()--*/
128   virtual void OnCursorChange(CefRefPtr<CefBrowser> browser,
129                               CefCursorHandle cursor) {}
130
131   ///
132   // Called when the scroll offset has changed.
133   ///
134   /*--cef()--*/
135   virtual void OnScrollOffsetChanged(CefRefPtr<CefBrowser> browser) {}
136 };
137
138 #endif  // CEF_INCLUDE_CEF_RENDER_HANDLER_H_