]> git.sesse.net Git - casparcg/blob - dependencies64/cef/windows/include/views/cef_view_delegate.h
523b05282047b6d51d81a8a149542421d00c1e83
[casparcg] / dependencies64 / cef / windows / include / views / cef_view_delegate.h
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_VIEW_DELEGATE_H_
38 #define CEF_INCLUDE_VIEWS_CEF_VIEW_DELEGATE_H_
39 #pragma once
40
41 #include "include/cef_base.h"
42
43 class CefView;
44
45 ///
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.
48 ///
49 /*--cef(source=client)--*/
50 class CefViewDelegate : public virtual CefBaseRefCounted {
51  public:
52   ///
53   // Return the preferred size for |view|. The Layout will use this information
54   // to determine the display size.
55   ///
56   /*--cef()--*/
57   virtual CefSize GetPreferredSize(CefRefPtr<CefView> view) {
58     return CefSize();
59   }
60
61   ///
62   // Return the minimum size for |view|.
63   ///
64   /*--cef()--*/
65   virtual CefSize GetMinimumSize(CefRefPtr<CefView> view) {
66     return CefSize();
67   }
68
69   ///
70   // Return the maximum size for |view|.
71   ///
72   /*--cef()--*/
73   virtual CefSize GetMaximumSize(CefRefPtr<CefView> view) {
74     return CefSize();
75   }
76
77   ///
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).
82   ///
83   /*--cef()--*/
84   virtual int GetHeightForWidth(CefRefPtr<CefView> view, int width) {
85     return 0;
86   }
87
88   ///
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.
94   ///
95   /*--cef()--*/
96   virtual void OnParentViewChanged(CefRefPtr<CefView> view,
97                                    bool added,
98                                    CefRefPtr<CefView> parent) {}
99
100   ///
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.
106   ///
107   /*--cef()--*/
108   virtual void OnChildViewChanged(CefRefPtr<CefView> view,
109                                   bool added,
110                                   CefRefPtr<CefView> child) {}
111
112   ///
113   // Called when |view| gains focus.
114   ///
115   /*--cef()--*/
116   virtual void OnFocus(CefRefPtr<CefView> view) {}
117
118   ///
119   // Called when |view| loses focus.
120   ///
121   /*--cef()--*/
122   virtual void OnBlur(CefRefPtr<CefView> view) {}
123 };
124
125 #endif  // CEF_INCLUDE_VIEWS_CEF_WINDOW_DELEGATE_H_