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=0009ced13fa9f1e26064455df0c9f5043d7618cf$
13 //
14
15 #include "libcef_dll/cpptoc/views/textfield_delegate_cpptoc.h"
16 #include "libcef_dll/ctocpp/views/textfield_ctocpp.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 int CEF_CALLBACK
textfield_delegate_on_key_event(struct _cef_textfield_delegate_t * self,cef_textfield_t * textfield,const struct _cef_key_event_t * event)25 textfield_delegate_on_key_event(struct _cef_textfield_delegate_t* self,
26 cef_textfield_t* textfield,
27 const struct _cef_key_event_t* event) {
28 shutdown_checker::AssertNotShutdown();
29
30 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31
32 DCHECK(self);
33 if (!self)
34 return 0;
35 // Verify param: textfield; type: refptr_diff
36 DCHECK(textfield);
37 if (!textfield)
38 return 0;
39 // Verify param: event; type: struct_byref_const
40 DCHECK(event);
41 if (!event)
42 return 0;
43
44 // Translate param: event; type: struct_byref_const
45 CefKeyEvent eventObj;
46 if (event)
47 eventObj.Set(*event, false);
48
49 // Execute
50 bool _retval = CefTextfieldDelegateCppToC::Get(self)->OnKeyEvent(
51 CefTextfieldCToCpp::Wrap(textfield), eventObj);
52
53 // Return type: bool
54 return _retval;
55 }
56
57 void CEF_CALLBACK
textfield_delegate_on_after_user_action(struct _cef_textfield_delegate_t * self,cef_textfield_t * textfield)58 textfield_delegate_on_after_user_action(struct _cef_textfield_delegate_t* self,
59 cef_textfield_t* textfield) {
60 shutdown_checker::AssertNotShutdown();
61
62 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
63
64 DCHECK(self);
65 if (!self)
66 return;
67 // Verify param: textfield; type: refptr_diff
68 DCHECK(textfield);
69 if (!textfield)
70 return;
71
72 // Execute
73 CefTextfieldDelegateCppToC::Get(self)->OnAfterUserAction(
74 CefTextfieldCToCpp::Wrap(textfield));
75 }
76
77 cef_size_t CEF_CALLBACK
textfield_delegate_get_preferred_size(struct _cef_view_delegate_t * self,cef_view_t * view)78 textfield_delegate_get_preferred_size(struct _cef_view_delegate_t* self,
79 cef_view_t* view) {
80 shutdown_checker::AssertNotShutdown();
81
82 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
83
84 DCHECK(self);
85 if (!self)
86 return CefSize();
87 // Verify param: view; type: refptr_diff
88 DCHECK(view);
89 if (!view)
90 return CefSize();
91
92 // Execute
93 cef_size_t _retval = CefTextfieldDelegateCppToC::Get(
94 reinterpret_cast<cef_textfield_delegate_t*>(self))
95 ->GetPreferredSize(CefViewCToCpp::Wrap(view));
96
97 // Return type: simple
98 return _retval;
99 }
100
101 cef_size_t CEF_CALLBACK
textfield_delegate_get_minimum_size(struct _cef_view_delegate_t * self,cef_view_t * view)102 textfield_delegate_get_minimum_size(struct _cef_view_delegate_t* self,
103 cef_view_t* view) {
104 shutdown_checker::AssertNotShutdown();
105
106 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
107
108 DCHECK(self);
109 if (!self)
110 return CefSize();
111 // Verify param: view; type: refptr_diff
112 DCHECK(view);
113 if (!view)
114 return CefSize();
115
116 // Execute
117 cef_size_t _retval = CefTextfieldDelegateCppToC::Get(
118 reinterpret_cast<cef_textfield_delegate_t*>(self))
119 ->GetMinimumSize(CefViewCToCpp::Wrap(view));
120
121 // Return type: simple
122 return _retval;
123 }
124
125 cef_size_t CEF_CALLBACK
textfield_delegate_get_maximum_size(struct _cef_view_delegate_t * self,cef_view_t * view)126 textfield_delegate_get_maximum_size(struct _cef_view_delegate_t* self,
127 cef_view_t* view) {
128 shutdown_checker::AssertNotShutdown();
129
130 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
131
132 DCHECK(self);
133 if (!self)
134 return CefSize();
135 // Verify param: view; type: refptr_diff
136 DCHECK(view);
137 if (!view)
138 return CefSize();
139
140 // Execute
141 cef_size_t _retval = CefTextfieldDelegateCppToC::Get(
142 reinterpret_cast<cef_textfield_delegate_t*>(self))
143 ->GetMaximumSize(CefViewCToCpp::Wrap(view));
144
145 // Return type: simple
146 return _retval;
147 }
148
149 int CEF_CALLBACK
textfield_delegate_get_height_for_width(struct _cef_view_delegate_t * self,cef_view_t * view,int width)150 textfield_delegate_get_height_for_width(struct _cef_view_delegate_t* self,
151 cef_view_t* view,
152 int width) {
153 shutdown_checker::AssertNotShutdown();
154
155 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
156
157 DCHECK(self);
158 if (!self)
159 return 0;
160 // Verify param: view; type: refptr_diff
161 DCHECK(view);
162 if (!view)
163 return 0;
164
165 // Execute
166 int _retval = CefTextfieldDelegateCppToC::Get(
167 reinterpret_cast<cef_textfield_delegate_t*>(self))
168 ->GetHeightForWidth(CefViewCToCpp::Wrap(view), width);
169
170 // Return type: simple
171 return _retval;
172 }
173
174 void CEF_CALLBACK
textfield_delegate_on_parent_view_changed(struct _cef_view_delegate_t * self,cef_view_t * view,int added,cef_view_t * parent)175 textfield_delegate_on_parent_view_changed(struct _cef_view_delegate_t* self,
176 cef_view_t* view,
177 int added,
178 cef_view_t* parent) {
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 // Verify param: parent; type: refptr_diff
191 DCHECK(parent);
192 if (!parent)
193 return;
194
195 // Execute
196 CefTextfieldDelegateCppToC::Get(
197 reinterpret_cast<cef_textfield_delegate_t*>(self))
198 ->OnParentViewChanged(CefViewCToCpp::Wrap(view), added ? true : false,
199 CefViewCToCpp::Wrap(parent));
200 }
201
202 void CEF_CALLBACK
textfield_delegate_on_child_view_changed(struct _cef_view_delegate_t * self,cef_view_t * view,int added,cef_view_t * child)203 textfield_delegate_on_child_view_changed(struct _cef_view_delegate_t* self,
204 cef_view_t* view,
205 int added,
206 cef_view_t* child) {
207 shutdown_checker::AssertNotShutdown();
208
209 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
210
211 DCHECK(self);
212 if (!self)
213 return;
214 // Verify param: view; type: refptr_diff
215 DCHECK(view);
216 if (!view)
217 return;
218 // Verify param: child; type: refptr_diff
219 DCHECK(child);
220 if (!child)
221 return;
222
223 // Execute
224 CefTextfieldDelegateCppToC::Get(
225 reinterpret_cast<cef_textfield_delegate_t*>(self))
226 ->OnChildViewChanged(CefViewCToCpp::Wrap(view), added ? true : false,
227 CefViewCToCpp::Wrap(child));
228 }
229
230 void CEF_CALLBACK
textfield_delegate_on_window_changed(struct _cef_view_delegate_t * self,cef_view_t * view,int added)231 textfield_delegate_on_window_changed(struct _cef_view_delegate_t* self,
232 cef_view_t* view,
233 int added) {
234 shutdown_checker::AssertNotShutdown();
235
236 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
237
238 DCHECK(self);
239 if (!self)
240 return;
241 // Verify param: view; type: refptr_diff
242 DCHECK(view);
243 if (!view)
244 return;
245
246 // Execute
247 CefTextfieldDelegateCppToC::Get(
248 reinterpret_cast<cef_textfield_delegate_t*>(self))
249 ->OnWindowChanged(CefViewCToCpp::Wrap(view), added ? true : false);
250 }
251
252 void CEF_CALLBACK
textfield_delegate_on_layout_changed(struct _cef_view_delegate_t * self,cef_view_t * view,const cef_rect_t * new_bounds)253 textfield_delegate_on_layout_changed(struct _cef_view_delegate_t* self,
254 cef_view_t* view,
255 const cef_rect_t* new_bounds) {
256 shutdown_checker::AssertNotShutdown();
257
258 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
259
260 DCHECK(self);
261 if (!self)
262 return;
263 // Verify param: view; type: refptr_diff
264 DCHECK(view);
265 if (!view)
266 return;
267 // Verify param: new_bounds; type: simple_byref_const
268 DCHECK(new_bounds);
269 if (!new_bounds)
270 return;
271
272 // Translate param: new_bounds; type: simple_byref_const
273 CefRect new_boundsVal = new_bounds ? *new_bounds : CefRect();
274
275 // Execute
276 CefTextfieldDelegateCppToC::Get(
277 reinterpret_cast<cef_textfield_delegate_t*>(self))
278 ->OnLayoutChanged(CefViewCToCpp::Wrap(view), new_boundsVal);
279 }
280
textfield_delegate_on_focus(struct _cef_view_delegate_t * self,cef_view_t * view)281 void CEF_CALLBACK textfield_delegate_on_focus(struct _cef_view_delegate_t* self,
282 cef_view_t* view) {
283 shutdown_checker::AssertNotShutdown();
284
285 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
286
287 DCHECK(self);
288 if (!self)
289 return;
290 // Verify param: view; type: refptr_diff
291 DCHECK(view);
292 if (!view)
293 return;
294
295 // Execute
296 CefTextfieldDelegateCppToC::Get(
297 reinterpret_cast<cef_textfield_delegate_t*>(self))
298 ->OnFocus(CefViewCToCpp::Wrap(view));
299 }
300
textfield_delegate_on_blur(struct _cef_view_delegate_t * self,cef_view_t * view)301 void CEF_CALLBACK textfield_delegate_on_blur(struct _cef_view_delegate_t* self,
302 cef_view_t* view) {
303 shutdown_checker::AssertNotShutdown();
304
305 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
306
307 DCHECK(self);
308 if (!self)
309 return;
310 // Verify param: view; type: refptr_diff
311 DCHECK(view);
312 if (!view)
313 return;
314
315 // Execute
316 CefTextfieldDelegateCppToC::Get(
317 reinterpret_cast<cef_textfield_delegate_t*>(self))
318 ->OnBlur(CefViewCToCpp::Wrap(view));
319 }
320
321 } // namespace
322
323 // CONSTRUCTOR - Do not edit by hand.
324
CefTextfieldDelegateCppToC()325 CefTextfieldDelegateCppToC::CefTextfieldDelegateCppToC() {
326 GetStruct()->on_key_event = textfield_delegate_on_key_event;
327 GetStruct()->on_after_user_action = textfield_delegate_on_after_user_action;
328 GetStruct()->base.get_preferred_size = textfield_delegate_get_preferred_size;
329 GetStruct()->base.get_minimum_size = textfield_delegate_get_minimum_size;
330 GetStruct()->base.get_maximum_size = textfield_delegate_get_maximum_size;
331 GetStruct()->base.get_height_for_width =
332 textfield_delegate_get_height_for_width;
333 GetStruct()->base.on_parent_view_changed =
334 textfield_delegate_on_parent_view_changed;
335 GetStruct()->base.on_child_view_changed =
336 textfield_delegate_on_child_view_changed;
337 GetStruct()->base.on_window_changed = textfield_delegate_on_window_changed;
338 GetStruct()->base.on_layout_changed = textfield_delegate_on_layout_changed;
339 GetStruct()->base.on_focus = textfield_delegate_on_focus;
340 GetStruct()->base.on_blur = textfield_delegate_on_blur;
341 }
342
343 // DESTRUCTOR - Do not edit by hand.
344
~CefTextfieldDelegateCppToC()345 CefTextfieldDelegateCppToC::~CefTextfieldDelegateCppToC() {
346 shutdown_checker::AssertNotShutdown();
347 }
348
349 template <>
350 CefRefPtr<CefTextfieldDelegate> CefCppToCRefCounted<
351 CefTextfieldDelegateCppToC,
352 CefTextfieldDelegate,
UnwrapDerived(CefWrapperType type,cef_textfield_delegate_t * s)353 cef_textfield_delegate_t>::UnwrapDerived(CefWrapperType type,
354 cef_textfield_delegate_t* s) {
355 NOTREACHED() << "Unexpected class type: " << type;
356 return nullptr;
357 }
358
359 template <>
360 CefWrapperType CefCppToCRefCounted<CefTextfieldDelegateCppToC,
361 CefTextfieldDelegate,
362 cef_textfield_delegate_t>::kWrapperType =
363 WT_TEXTFIELD_DELEGATE;
364