1 // Copyright (c) 2022 The Chromium Embedded Framework Authors. All rights
2 // reserved. Use of this source code is governed by a BSD-style license that
3 // can be found in the LICENSE file.
4 //
5 // ---------------------------------------------------------------------------
6 //
7 // This file was generated by the CEF translator tool. If making changes by
8 // hand only do so within the body of existing method and function
9 // implementations. See the translator.README.txt file in the tools directory
10 // for more information.
11 //
12 // $hash=03a39472314a6cb7cf93fb0196be57e9ae308c53$
13 //
14
15 #include "libcef_dll/cpptoc/views/panel_delegate_cpptoc.h"
16 #include "libcef_dll/cpptoc/views/window_delegate_cpptoc.h"
17 #include "libcef_dll/ctocpp/views/view_ctocpp.h"
18 #include "libcef_dll/shutdown_checker.h"
19
20 namespace {
21
22 // MEMBER FUNCTIONS - Body may be edited by hand.
23
24 cef_size_t CEF_CALLBACK
panel_delegate_get_preferred_size(struct _cef_view_delegate_t * self,cef_view_t * view)25 panel_delegate_get_preferred_size(struct _cef_view_delegate_t* self,
26 cef_view_t* view) {
27 shutdown_checker::AssertNotShutdown();
28
29 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
30
31 DCHECK(self);
32 if (!self)
33 return CefSize();
34 // Verify param: view; type: refptr_diff
35 DCHECK(view);
36 if (!view)
37 return CefSize();
38
39 // Execute
40 cef_size_t _retval =
41 CefPanelDelegateCppToC::Get(reinterpret_cast<cef_panel_delegate_t*>(self))
42 ->GetPreferredSize(CefViewCToCpp::Wrap(view));
43
44 // Return type: simple
45 return _retval;
46 }
47
48 cef_size_t CEF_CALLBACK
panel_delegate_get_minimum_size(struct _cef_view_delegate_t * self,cef_view_t * view)49 panel_delegate_get_minimum_size(struct _cef_view_delegate_t* self,
50 cef_view_t* view) {
51 shutdown_checker::AssertNotShutdown();
52
53 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
54
55 DCHECK(self);
56 if (!self)
57 return CefSize();
58 // Verify param: view; type: refptr_diff
59 DCHECK(view);
60 if (!view)
61 return CefSize();
62
63 // Execute
64 cef_size_t _retval =
65 CefPanelDelegateCppToC::Get(reinterpret_cast<cef_panel_delegate_t*>(self))
66 ->GetMinimumSize(CefViewCToCpp::Wrap(view));
67
68 // Return type: simple
69 return _retval;
70 }
71
72 cef_size_t CEF_CALLBACK
panel_delegate_get_maximum_size(struct _cef_view_delegate_t * self,cef_view_t * view)73 panel_delegate_get_maximum_size(struct _cef_view_delegate_t* self,
74 cef_view_t* view) {
75 shutdown_checker::AssertNotShutdown();
76
77 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
78
79 DCHECK(self);
80 if (!self)
81 return CefSize();
82 // Verify param: view; type: refptr_diff
83 DCHECK(view);
84 if (!view)
85 return CefSize();
86
87 // Execute
88 cef_size_t _retval =
89 CefPanelDelegateCppToC::Get(reinterpret_cast<cef_panel_delegate_t*>(self))
90 ->GetMaximumSize(CefViewCToCpp::Wrap(view));
91
92 // Return type: simple
93 return _retval;
94 }
95
96 int CEF_CALLBACK
panel_delegate_get_height_for_width(struct _cef_view_delegate_t * self,cef_view_t * view,int width)97 panel_delegate_get_height_for_width(struct _cef_view_delegate_t* self,
98 cef_view_t* view,
99 int width) {
100 shutdown_checker::AssertNotShutdown();
101
102 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
103
104 DCHECK(self);
105 if (!self)
106 return 0;
107 // Verify param: view; type: refptr_diff
108 DCHECK(view);
109 if (!view)
110 return 0;
111
112 // Execute
113 int _retval =
114 CefPanelDelegateCppToC::Get(reinterpret_cast<cef_panel_delegate_t*>(self))
115 ->GetHeightForWidth(CefViewCToCpp::Wrap(view), width);
116
117 // Return type: simple
118 return _retval;
119 }
120
121 void CEF_CALLBACK
panel_delegate_on_parent_view_changed(struct _cef_view_delegate_t * self,cef_view_t * view,int added,cef_view_t * parent)122 panel_delegate_on_parent_view_changed(struct _cef_view_delegate_t* self,
123 cef_view_t* view,
124 int added,
125 cef_view_t* parent) {
126 shutdown_checker::AssertNotShutdown();
127
128 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
129
130 DCHECK(self);
131 if (!self)
132 return;
133 // Verify param: view; type: refptr_diff
134 DCHECK(view);
135 if (!view)
136 return;
137 // Verify param: parent; type: refptr_diff
138 DCHECK(parent);
139 if (!parent)
140 return;
141
142 // Execute
143 CefPanelDelegateCppToC::Get(reinterpret_cast<cef_panel_delegate_t*>(self))
144 ->OnParentViewChanged(CefViewCToCpp::Wrap(view), added ? true : false,
145 CefViewCToCpp::Wrap(parent));
146 }
147
148 void CEF_CALLBACK
panel_delegate_on_child_view_changed(struct _cef_view_delegate_t * self,cef_view_t * view,int added,cef_view_t * child)149 panel_delegate_on_child_view_changed(struct _cef_view_delegate_t* self,
150 cef_view_t* view,
151 int added,
152 cef_view_t* child) {
153 shutdown_checker::AssertNotShutdown();
154
155 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
156
157 DCHECK(self);
158 if (!self)
159 return;
160 // Verify param: view; type: refptr_diff
161 DCHECK(view);
162 if (!view)
163 return;
164 // Verify param: child; type: refptr_diff
165 DCHECK(child);
166 if (!child)
167 return;
168
169 // Execute
170 CefPanelDelegateCppToC::Get(reinterpret_cast<cef_panel_delegate_t*>(self))
171 ->OnChildViewChanged(CefViewCToCpp::Wrap(view), added ? true : false,
172 CefViewCToCpp::Wrap(child));
173 }
174
175 void CEF_CALLBACK
panel_delegate_on_window_changed(struct _cef_view_delegate_t * self,cef_view_t * view,int added)176 panel_delegate_on_window_changed(struct _cef_view_delegate_t* self,
177 cef_view_t* view,
178 int added) {
179 shutdown_checker::AssertNotShutdown();
180
181 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
182
183 DCHECK(self);
184 if (!self)
185 return;
186 // Verify param: view; type: refptr_diff
187 DCHECK(view);
188 if (!view)
189 return;
190
191 // Execute
192 CefPanelDelegateCppToC::Get(reinterpret_cast<cef_panel_delegate_t*>(self))
193 ->OnWindowChanged(CefViewCToCpp::Wrap(view), added ? true : false);
194 }
195
196 void CEF_CALLBACK
panel_delegate_on_layout_changed(struct _cef_view_delegate_t * self,cef_view_t * view,const cef_rect_t * new_bounds)197 panel_delegate_on_layout_changed(struct _cef_view_delegate_t* self,
198 cef_view_t* view,
199 const cef_rect_t* new_bounds) {
200 shutdown_checker::AssertNotShutdown();
201
202 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
203
204 DCHECK(self);
205 if (!self)
206 return;
207 // Verify param: view; type: refptr_diff
208 DCHECK(view);
209 if (!view)
210 return;
211 // Verify param: new_bounds; type: simple_byref_const
212 DCHECK(new_bounds);
213 if (!new_bounds)
214 return;
215
216 // Translate param: new_bounds; type: simple_byref_const
217 CefRect new_boundsVal = new_bounds ? *new_bounds : CefRect();
218
219 // Execute
220 CefPanelDelegateCppToC::Get(reinterpret_cast<cef_panel_delegate_t*>(self))
221 ->OnLayoutChanged(CefViewCToCpp::Wrap(view), new_boundsVal);
222 }
223
panel_delegate_on_focus(struct _cef_view_delegate_t * self,cef_view_t * view)224 void CEF_CALLBACK panel_delegate_on_focus(struct _cef_view_delegate_t* self,
225 cef_view_t* view) {
226 shutdown_checker::AssertNotShutdown();
227
228 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
229
230 DCHECK(self);
231 if (!self)
232 return;
233 // Verify param: view; type: refptr_diff
234 DCHECK(view);
235 if (!view)
236 return;
237
238 // Execute
239 CefPanelDelegateCppToC::Get(reinterpret_cast<cef_panel_delegate_t*>(self))
240 ->OnFocus(CefViewCToCpp::Wrap(view));
241 }
242
panel_delegate_on_blur(struct _cef_view_delegate_t * self,cef_view_t * view)243 void CEF_CALLBACK panel_delegate_on_blur(struct _cef_view_delegate_t* self,
244 cef_view_t* view) {
245 shutdown_checker::AssertNotShutdown();
246
247 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
248
249 DCHECK(self);
250 if (!self)
251 return;
252 // Verify param: view; type: refptr_diff
253 DCHECK(view);
254 if (!view)
255 return;
256
257 // Execute
258 CefPanelDelegateCppToC::Get(reinterpret_cast<cef_panel_delegate_t*>(self))
259 ->OnBlur(CefViewCToCpp::Wrap(view));
260 }
261
262 } // namespace
263
264 // CONSTRUCTOR - Do not edit by hand.
265
CefPanelDelegateCppToC()266 CefPanelDelegateCppToC::CefPanelDelegateCppToC() {
267 GetStruct()->base.get_preferred_size = panel_delegate_get_preferred_size;
268 GetStruct()->base.get_minimum_size = panel_delegate_get_minimum_size;
269 GetStruct()->base.get_maximum_size = panel_delegate_get_maximum_size;
270 GetStruct()->base.get_height_for_width = panel_delegate_get_height_for_width;
271 GetStruct()->base.on_parent_view_changed =
272 panel_delegate_on_parent_view_changed;
273 GetStruct()->base.on_child_view_changed =
274 panel_delegate_on_child_view_changed;
275 GetStruct()->base.on_window_changed = panel_delegate_on_window_changed;
276 GetStruct()->base.on_layout_changed = panel_delegate_on_layout_changed;
277 GetStruct()->base.on_focus = panel_delegate_on_focus;
278 GetStruct()->base.on_blur = panel_delegate_on_blur;
279 }
280
281 // DESTRUCTOR - Do not edit by hand.
282
~CefPanelDelegateCppToC()283 CefPanelDelegateCppToC::~CefPanelDelegateCppToC() {
284 shutdown_checker::AssertNotShutdown();
285 }
286
287 template <>
288 CefRefPtr<CefPanelDelegate> CefCppToCRefCounted<
289 CefPanelDelegateCppToC,
290 CefPanelDelegate,
UnwrapDerived(CefWrapperType type,cef_panel_delegate_t * s)291 cef_panel_delegate_t>::UnwrapDerived(CefWrapperType type,
292 cef_panel_delegate_t* s) {
293 if (type == WT_WINDOW_DELEGATE) {
294 return CefWindowDelegateCppToC::Unwrap(
295 reinterpret_cast<cef_window_delegate_t*>(s));
296 }
297 NOTREACHED() << "Unexpected class type: " << type;
298 return nullptr;
299 }
300
301 template <>
302 CefWrapperType CefCppToCRefCounted<CefPanelDelegateCppToC,
303 CefPanelDelegate,
304 cef_panel_delegate_t>::kWrapperType =
305 WT_PANEL_DELEGATE;
306