]> git.sesse.net Git - casparcg/blob - dependencies64/cef/linux/include/cef_render_handler.h
9c253535e9598d73f80c4605792f9daadf442b3e
[casparcg] / dependencies64 / cef / linux / 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 <vector>
42
43 #include "include/cef_base.h"
44 #include "include/cef_browser.h"
45 #include "include/cef_drag_data.h"
46
47 ///
48 // Implement this interface to handle events when window rendering is disabled.
49 // The methods of this class will be called on the UI thread.
50 ///
51 /*--cef(source=client)--*/
52 class CefRenderHandler : public virtual CefBaseRefCounted {
53  public:
54   typedef cef_cursor_type_t CursorType;
55   typedef cef_drag_operations_mask_t DragOperation;
56   typedef cef_drag_operations_mask_t DragOperationsMask;
57   typedef cef_paint_element_type_t PaintElementType;
58   typedef std::vector<CefRect> RectList;
59
60   ///
61   // Called to retrieve the root window rectangle in screen coordinates. Return
62   // true if the rectangle was provided.
63   ///
64   /*--cef()--*/
65   virtual bool GetRootScreenRect(CefRefPtr<CefBrowser> browser,
66                                  CefRect& rect) { return false; }
67
68   ///
69   // Called to retrieve the view rectangle which is relative to screen
70   // coordinates. Return true if the rectangle was provided.
71   ///
72   /*--cef()--*/
73   virtual bool GetViewRect(CefRefPtr<CefBrowser> browser, CefRect& rect) =0;
74
75   ///
76   // Called to retrieve the translation from view coordinates to actual screen
77   // coordinates. Return true if the screen coordinates were provided.
78   ///
79   /*--cef()--*/
80   virtual bool GetScreenPoint(CefRefPtr<CefBrowser> browser,
81                               int viewX,
82                               int viewY,
83                               int& screenX,
84                               int& screenY) { return false; }
85
86   ///
87   // Called to allow the client to fill in the CefScreenInfo object with
88   // appropriate values. Return true if the |screen_info| structure has been
89   // modified.
90   //
91   // If the screen info rectangle is left empty the rectangle from GetViewRect
92   // will be used. If the rectangle is still empty or invalid popups may not be
93   // drawn correctly.
94   ///
95   /*--cef()--*/
96   virtual bool GetScreenInfo(CefRefPtr<CefBrowser> browser,
97                              CefScreenInfo& screen_info) { return false; }
98
99   ///
100   // Called when the browser wants to show or hide the popup widget. The popup
101   // should be shown if |show| is true and hidden if |show| is false.
102   ///
103   /*--cef()--*/
104   virtual void OnPopupShow(CefRefPtr<CefBrowser> browser,
105                            bool show) {}
106
107   ///
108   // Called when the browser wants to move or resize the popup widget. |rect|
109   // contains the new location and size in view coordinates.
110   ///
111   /*--cef()--*/
112   virtual void OnPopupSize(CefRefPtr<CefBrowser> browser,
113                            const CefRect& rect) {}
114
115   ///
116   // Called when an element should be painted. Pixel values passed to this
117   // method are scaled relative to view coordinates based on the value of
118   // CefScreenInfo.device_scale_factor returned from GetScreenInfo. |type|
119   // indicates whether the element is the view or the popup widget. |buffer|
120   // contains the pixel data for the whole image. |dirtyRects| contains the set
121   // of rectangles in pixel coordinates that need to be repainted. |buffer| will
122   // be |width|*|height|*4 bytes in size and represents a BGRA image with an
123   // upper-left origin.
124   ///
125   /*--cef()--*/
126   virtual void OnPaint(CefRefPtr<CefBrowser> browser,
127                        PaintElementType type,
128                        const RectList& dirtyRects,
129                        const void* buffer,
130                        int width, int height) =0;
131
132   ///
133   // Called when the browser's cursor has changed. If |type| is CT_CUSTOM then
134   // |custom_cursor_info| will be populated with the custom cursor information.
135   ///
136   /*--cef()--*/
137   virtual void OnCursorChange(CefRefPtr<CefBrowser> browser,
138                               CefCursorHandle cursor,
139                               CursorType type,
140                               const CefCursorInfo& custom_cursor_info) {}
141
142   ///
143   // Called when the user starts dragging content in the web view. Contextual
144   // information about the dragged content is supplied by |drag_data|.
145   // (|x|, |y|) is the drag start location in screen coordinates.
146   // OS APIs that run a system message loop may be used within the
147   // StartDragging call.
148   //
149   // Return false to abort the drag operation. Don't call any of
150   // CefBrowserHost::DragSource*Ended* methods after returning false.
151   //
152   // Return true to handle the drag operation. Call
153   // CefBrowserHost::DragSourceEndedAt and DragSourceSystemDragEnded either
154   // synchronously or asynchronously to inform the web view that the drag
155   // operation has ended.
156   ///
157   /*--cef()--*/
158   virtual bool StartDragging(CefRefPtr<CefBrowser> browser,
159                              CefRefPtr<CefDragData> drag_data,
160                              DragOperationsMask allowed_ops,
161                              int x, int y) { return false; }
162
163   ///
164   // Called when the web view wants to update the mouse cursor during a
165   // drag & drop operation. |operation| describes the allowed operation
166   // (none, move, copy, link).
167   ///
168   /*--cef()--*/
169   virtual void UpdateDragCursor(CefRefPtr<CefBrowser> browser,
170                                 DragOperation operation) {}
171
172   ///
173   // Called when the scroll offset has changed.
174   ///
175   /*--cef()--*/
176   virtual void OnScrollOffsetChanged(CefRefPtr<CefBrowser> browser,
177                                      double x,
178                                      double y) {}
179
180   ///
181   // Called when the IME composition range has changed. |selected_range| is the
182   // range of characters that have been selected. |character_bounds| is the
183   // bounds of each character in view coordinates.
184   ///
185   /*--cef()--*/
186   virtual void OnImeCompositionRangeChanged(CefRefPtr<CefBrowser> browser,
187                                             const CefRange& selected_range,
188                                             const RectList& character_bounds) {}
189 };
190
191 #endif  // CEF_INCLUDE_CEF_RENDER_HANDLER_H_