1 // Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are
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
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.
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.
30 // ---------------------------------------------------------------------------
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.
37 #ifndef CEF_INCLUDE_VIEWS_CEF_VIEW_DELEGATE_H_
38 #define CEF_INCLUDE_VIEWS_CEF_VIEW_DELEGATE_H_
41 #include "include/cef_base.h"
46 // Implement this interface to handle view events. The methods of this class
47 // will be called on the browser process UI thread unless otherwise indicated.
49 /*--cef(source=client)--*/
50 class CefViewDelegate : public virtual CefBaseRefCounted {
53 // Return the preferred size for |view|. The Layout will use this information
54 // to determine the display size.
57 virtual CefSize GetPreferredSize(CefRefPtr<CefView> view) {
62 // Return the minimum size for |view|.
65 virtual CefSize GetMinimumSize(CefRefPtr<CefView> view) {
70 // Return the maximum size for |view|.
73 virtual CefSize GetMaximumSize(CefRefPtr<CefView> view) {
78 // Return the height necessary to display |view| with the provided |width|.
79 // If not specified the result of GetPreferredSize().height will be used by
80 // default. Override if |view|'s preferred height depends upon the width
81 // (for example, with Labels).
84 virtual int GetHeightForWidth(CefRefPtr<CefView> view, int width) {
89 // Called when the parent of |view| has changed. If |view| is being added to
90 // |parent| then |added| will be true. If |view| is being removed from
91 // |parent| then |added| will be false. If |view| is being reparented the
92 // remove notification will be sent before the add notification. Do not modify
93 // the view hierarchy in this callback.
96 virtual void OnParentViewChanged(CefRefPtr<CefView> view,
98 CefRefPtr<CefView> parent) {}
101 // Called when a child of |view| has changed. If |child| is being added to
102 // |view| then |added| will be true. If |child| is being removed from |view|
103 // then |added| will be false. If |child| is being reparented the remove
104 // notification will be sent to the old parent before the add notification is
105 // sent to the new parent. Do not modify the view hierarchy in this callback.
108 virtual void OnChildViewChanged(CefRefPtr<CefView> view,
110 CefRefPtr<CefView> child) {}
113 // Called when |view| gains focus.
116 virtual void OnFocus(CefRefPtr<CefView> view) {}
119 // Called when |view| loses focus.
122 virtual void OnBlur(CefRefPtr<CefView> view) {}
125 #endif // CEF_INCLUDE_VIEWS_CEF_WINDOW_DELEGATE_H_