• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2021 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=52a0deb8b7ae62e474acb1474cf922c3e9a04f14$
13 //
14 
15 #include "libcef_dll/cpptoc/views/button_delegate_cpptoc.h"
16 #include "libcef_dll/cpptoc/views/menu_button_delegate_cpptoc.h"
17 #include "libcef_dll/ctocpp/views/button_ctocpp.h"
18 #include "libcef_dll/ctocpp/views/view_ctocpp.h"
19 #include "libcef_dll/shutdown_checker.h"
20 
21 namespace {
22 
23 // MEMBER FUNCTIONS - Body may be edited by hand.
24 
25 void CEF_CALLBACK
button_delegate_on_button_pressed(struct _cef_button_delegate_t * self,cef_button_t * button)26 button_delegate_on_button_pressed(struct _cef_button_delegate_t* self,
27                                   cef_button_t* button) {
28   shutdown_checker::AssertNotShutdown();
29 
30   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31 
32   DCHECK(self);
33   if (!self)
34     return;
35   // Verify param: button; type: refptr_diff
36   DCHECK(button);
37   if (!button)
38     return;
39 
40   // Execute
41   CefButtonDelegateCppToC::Get(self)->OnButtonPressed(
42       CefButtonCToCpp::Wrap(button));
43 }
44 
45 void CEF_CALLBACK
button_delegate_on_button_state_changed(struct _cef_button_delegate_t * self,cef_button_t * button)46 button_delegate_on_button_state_changed(struct _cef_button_delegate_t* self,
47                                         cef_button_t* button) {
48   shutdown_checker::AssertNotShutdown();
49 
50   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
51 
52   DCHECK(self);
53   if (!self)
54     return;
55   // Verify param: button; type: refptr_diff
56   DCHECK(button);
57   if (!button)
58     return;
59 
60   // Execute
61   CefButtonDelegateCppToC::Get(self)->OnButtonStateChanged(
62       CefButtonCToCpp::Wrap(button));
63 }
64 
65 cef_size_t CEF_CALLBACK
button_delegate_get_preferred_size(struct _cef_view_delegate_t * self,cef_view_t * view)66 button_delegate_get_preferred_size(struct _cef_view_delegate_t* self,
67                                    cef_view_t* view) {
68   shutdown_checker::AssertNotShutdown();
69 
70   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
71 
72   DCHECK(self);
73   if (!self)
74     return CefSize();
75   // Verify param: view; type: refptr_diff
76   DCHECK(view);
77   if (!view)
78     return CefSize();
79 
80   // Execute
81   cef_size_t _retval = CefButtonDelegateCppToC::Get(
82                            reinterpret_cast<cef_button_delegate_t*>(self))
83                            ->GetPreferredSize(CefViewCToCpp::Wrap(view));
84 
85   // Return type: simple
86   return _retval;
87 }
88 
89 cef_size_t CEF_CALLBACK
button_delegate_get_minimum_size(struct _cef_view_delegate_t * self,cef_view_t * view)90 button_delegate_get_minimum_size(struct _cef_view_delegate_t* self,
91                                  cef_view_t* view) {
92   shutdown_checker::AssertNotShutdown();
93 
94   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
95 
96   DCHECK(self);
97   if (!self)
98     return CefSize();
99   // Verify param: view; type: refptr_diff
100   DCHECK(view);
101   if (!view)
102     return CefSize();
103 
104   // Execute
105   cef_size_t _retval = CefButtonDelegateCppToC::Get(
106                            reinterpret_cast<cef_button_delegate_t*>(self))
107                            ->GetMinimumSize(CefViewCToCpp::Wrap(view));
108 
109   // Return type: simple
110   return _retval;
111 }
112 
113 cef_size_t CEF_CALLBACK
button_delegate_get_maximum_size(struct _cef_view_delegate_t * self,cef_view_t * view)114 button_delegate_get_maximum_size(struct _cef_view_delegate_t* self,
115                                  cef_view_t* view) {
116   shutdown_checker::AssertNotShutdown();
117 
118   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
119 
120   DCHECK(self);
121   if (!self)
122     return CefSize();
123   // Verify param: view; type: refptr_diff
124   DCHECK(view);
125   if (!view)
126     return CefSize();
127 
128   // Execute
129   cef_size_t _retval = CefButtonDelegateCppToC::Get(
130                            reinterpret_cast<cef_button_delegate_t*>(self))
131                            ->GetMaximumSize(CefViewCToCpp::Wrap(view));
132 
133   // Return type: simple
134   return _retval;
135 }
136 
137 int CEF_CALLBACK
button_delegate_get_height_for_width(struct _cef_view_delegate_t * self,cef_view_t * view,int width)138 button_delegate_get_height_for_width(struct _cef_view_delegate_t* self,
139                                      cef_view_t* view,
140                                      int width) {
141   shutdown_checker::AssertNotShutdown();
142 
143   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
144 
145   DCHECK(self);
146   if (!self)
147     return 0;
148   // Verify param: view; type: refptr_diff
149   DCHECK(view);
150   if (!view)
151     return 0;
152 
153   // Execute
154   int _retval = CefButtonDelegateCppToC::Get(
155                     reinterpret_cast<cef_button_delegate_t*>(self))
156                     ->GetHeightForWidth(CefViewCToCpp::Wrap(view), width);
157 
158   // Return type: simple
159   return _retval;
160 }
161 
162 void CEF_CALLBACK
button_delegate_on_parent_view_changed(struct _cef_view_delegate_t * self,cef_view_t * view,int added,cef_view_t * parent)163 button_delegate_on_parent_view_changed(struct _cef_view_delegate_t* self,
164                                        cef_view_t* view,
165                                        int added,
166                                        cef_view_t* parent) {
167   shutdown_checker::AssertNotShutdown();
168 
169   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
170 
171   DCHECK(self);
172   if (!self)
173     return;
174   // Verify param: view; type: refptr_diff
175   DCHECK(view);
176   if (!view)
177     return;
178   // Verify param: parent; type: refptr_diff
179   DCHECK(parent);
180   if (!parent)
181     return;
182 
183   // Execute
184   CefButtonDelegateCppToC::Get(reinterpret_cast<cef_button_delegate_t*>(self))
185       ->OnParentViewChanged(CefViewCToCpp::Wrap(view), added ? true : false,
186                             CefViewCToCpp::Wrap(parent));
187 }
188 
189 void CEF_CALLBACK
button_delegate_on_child_view_changed(struct _cef_view_delegate_t * self,cef_view_t * view,int added,cef_view_t * child)190 button_delegate_on_child_view_changed(struct _cef_view_delegate_t* self,
191                                       cef_view_t* view,
192                                       int added,
193                                       cef_view_t* child) {
194   shutdown_checker::AssertNotShutdown();
195 
196   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
197 
198   DCHECK(self);
199   if (!self)
200     return;
201   // Verify param: view; type: refptr_diff
202   DCHECK(view);
203   if (!view)
204     return;
205   // Verify param: child; type: refptr_diff
206   DCHECK(child);
207   if (!child)
208     return;
209 
210   // Execute
211   CefButtonDelegateCppToC::Get(reinterpret_cast<cef_button_delegate_t*>(self))
212       ->OnChildViewChanged(CefViewCToCpp::Wrap(view), added ? true : false,
213                            CefViewCToCpp::Wrap(child));
214 }
215 
216 void CEF_CALLBACK
button_delegate_on_window_changed(struct _cef_view_delegate_t * self,cef_view_t * view,int added)217 button_delegate_on_window_changed(struct _cef_view_delegate_t* self,
218                                   cef_view_t* view,
219                                   int added) {
220   shutdown_checker::AssertNotShutdown();
221 
222   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
223 
224   DCHECK(self);
225   if (!self)
226     return;
227   // Verify param: view; type: refptr_diff
228   DCHECK(view);
229   if (!view)
230     return;
231 
232   // Execute
233   CefButtonDelegateCppToC::Get(reinterpret_cast<cef_button_delegate_t*>(self))
234       ->OnWindowChanged(CefViewCToCpp::Wrap(view), added ? true : false);
235 }
236 
button_delegate_on_focus(struct _cef_view_delegate_t * self,cef_view_t * view)237 void CEF_CALLBACK button_delegate_on_focus(struct _cef_view_delegate_t* self,
238                                            cef_view_t* view) {
239   shutdown_checker::AssertNotShutdown();
240 
241   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
242 
243   DCHECK(self);
244   if (!self)
245     return;
246   // Verify param: view; type: refptr_diff
247   DCHECK(view);
248   if (!view)
249     return;
250 
251   // Execute
252   CefButtonDelegateCppToC::Get(reinterpret_cast<cef_button_delegate_t*>(self))
253       ->OnFocus(CefViewCToCpp::Wrap(view));
254 }
255 
button_delegate_on_blur(struct _cef_view_delegate_t * self,cef_view_t * view)256 void CEF_CALLBACK button_delegate_on_blur(struct _cef_view_delegate_t* self,
257                                           cef_view_t* view) {
258   shutdown_checker::AssertNotShutdown();
259 
260   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
261 
262   DCHECK(self);
263   if (!self)
264     return;
265   // Verify param: view; type: refptr_diff
266   DCHECK(view);
267   if (!view)
268     return;
269 
270   // Execute
271   CefButtonDelegateCppToC::Get(reinterpret_cast<cef_button_delegate_t*>(self))
272       ->OnBlur(CefViewCToCpp::Wrap(view));
273 }
274 
275 }  // namespace
276 
277 // CONSTRUCTOR - Do not edit by hand.
278 
CefButtonDelegateCppToC()279 CefButtonDelegateCppToC::CefButtonDelegateCppToC() {
280   GetStruct()->on_button_pressed = button_delegate_on_button_pressed;
281   GetStruct()->on_button_state_changed =
282       button_delegate_on_button_state_changed;
283   GetStruct()->base.get_preferred_size = button_delegate_get_preferred_size;
284   GetStruct()->base.get_minimum_size = button_delegate_get_minimum_size;
285   GetStruct()->base.get_maximum_size = button_delegate_get_maximum_size;
286   GetStruct()->base.get_height_for_width = button_delegate_get_height_for_width;
287   GetStruct()->base.on_parent_view_changed =
288       button_delegate_on_parent_view_changed;
289   GetStruct()->base.on_child_view_changed =
290       button_delegate_on_child_view_changed;
291   GetStruct()->base.on_window_changed = button_delegate_on_window_changed;
292   GetStruct()->base.on_focus = button_delegate_on_focus;
293   GetStruct()->base.on_blur = button_delegate_on_blur;
294 }
295 
296 // DESTRUCTOR - Do not edit by hand.
297 
~CefButtonDelegateCppToC()298 CefButtonDelegateCppToC::~CefButtonDelegateCppToC() {
299   shutdown_checker::AssertNotShutdown();
300 }
301 
302 template <>
303 CefRefPtr<CefButtonDelegate> CefCppToCRefCounted<
304     CefButtonDelegateCppToC,
305     CefButtonDelegate,
UnwrapDerived(CefWrapperType type,cef_button_delegate_t * s)306     cef_button_delegate_t>::UnwrapDerived(CefWrapperType type,
307                                           cef_button_delegate_t* s) {
308   if (type == WT_MENU_BUTTON_DELEGATE) {
309     return CefMenuButtonDelegateCppToC::Unwrap(
310         reinterpret_cast<cef_menu_button_delegate_t*>(s));
311   }
312   NOTREACHED() << "Unexpected class type: " << type;
313   return nullptr;
314 }
315 
316 template <>
317 CefWrapperType CefCppToCRefCounted<CefButtonDelegateCppToC,
318                                    CefButtonDelegate,
319                                    cef_button_delegate_t>::kWrapperType =
320     WT_BUTTON_DELEGATE;
321