• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2022 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 // This file was generated by the CEF translator tool and should not edited
33 // by hand. See the translator.README.txt file in the tools directory for
34 // more information.
35 //
36 // $hash=d2aadfa4159846c2719387e2814d5e108def4b81$
37 //
38 
39 #ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_VIEW_CAPI_H_
40 #define CEF_INCLUDE_CAPI_VIEWS_CEF_VIEW_CAPI_H_
41 #pragma once
42 
43 #include "include/capi/views/cef_view_delegate_capi.h"
44 
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48 
49 struct _cef_browser_view_t;
50 struct _cef_button_t;
51 struct _cef_panel_t;
52 struct _cef_scroll_view_t;
53 struct _cef_textfield_t;
54 struct _cef_window_t;
55 
56 ///
57 // A View is a rectangle within the views View hierarchy. It is the base
58 // structure for all Views. All size and position values are in density
59 // independent pixels (DIP) unless otherwise indicated. Methods must be called
60 // on the browser process UI thread unless otherwise indicated.
61 ///
62 typedef struct _cef_view_t {
63   ///
64   // Base structure.
65   ///
66   cef_base_ref_counted_t base;
67 
68   ///
69   // Returns this View as a BrowserView or NULL if this is not a BrowserView.
70   ///
71   struct _cef_browser_view_t*(CEF_CALLBACK* as_browser_view)(
72       struct _cef_view_t* self);
73 
74   ///
75   // Returns this View as a Button or NULL if this is not a Button.
76   ///
77   struct _cef_button_t*(CEF_CALLBACK* as_button)(struct _cef_view_t* self);
78 
79   ///
80   // Returns this View as a Panel or NULL if this is not a Panel.
81   ///
82   struct _cef_panel_t*(CEF_CALLBACK* as_panel)(struct _cef_view_t* self);
83 
84   ///
85   // Returns this View as a ScrollView or NULL if this is not a ScrollView.
86   ///
87   struct _cef_scroll_view_t*(CEF_CALLBACK* as_scroll_view)(
88       struct _cef_view_t* self);
89 
90   ///
91   // Returns this View as a Textfield or NULL if this is not a Textfield.
92   ///
93   struct _cef_textfield_t*(CEF_CALLBACK* as_textfield)(
94       struct _cef_view_t* self);
95 
96   ///
97   // Returns the type of this View as a string. Used primarily for testing
98   // purposes.
99   ///
100   // The resulting string must be freed by calling cef_string_userfree_free().
101   cef_string_userfree_t(CEF_CALLBACK* get_type_string)(
102       struct _cef_view_t* self);
103 
104   ///
105   // Returns a string representation of this View which includes the type and
106   // various type-specific identifying attributes. If |include_children| is true
107   // (1) any child Views will also be included. Used primarily for testing
108   // purposes.
109   ///
110   // The resulting string must be freed by calling cef_string_userfree_free().
111   cef_string_userfree_t(CEF_CALLBACK* to_string)(struct _cef_view_t* self,
112                                                  int include_children);
113 
114   ///
115   // Returns true (1) if this View is valid.
116   ///
117   int(CEF_CALLBACK* is_valid)(struct _cef_view_t* self);
118 
119   ///
120   // Returns true (1) if this View is currently attached to another View. A View
121   // can only be attached to one View at a time.
122   ///
123   int(CEF_CALLBACK* is_attached)(struct _cef_view_t* self);
124 
125   ///
126   // Returns true (1) if this View is the same as |that| View.
127   ///
128   int(CEF_CALLBACK* is_same)(struct _cef_view_t* self,
129                              struct _cef_view_t* that);
130 
131   ///
132   // Returns the delegate associated with this View, if any.
133   ///
134   struct _cef_view_delegate_t*(CEF_CALLBACK* get_delegate)(
135       struct _cef_view_t* self);
136 
137   ///
138   // Returns the top-level Window hosting this View, if any.
139   ///
140   struct _cef_window_t*(CEF_CALLBACK* get_window)(struct _cef_view_t* self);
141 
142   ///
143   // Returns the ID for this View.
144   ///
145   int(CEF_CALLBACK* get_id)(struct _cef_view_t* self);
146 
147   ///
148   // Sets the ID for this View. ID should be unique within the subtree that you
149   // intend to search for it. 0 is the default ID for views.
150   ///
151   void(CEF_CALLBACK* set_id)(struct _cef_view_t* self, int id);
152 
153   ///
154   // Returns the group id of this View, or -1 if not set.
155   ///
156   int(CEF_CALLBACK* get_group_id)(struct _cef_view_t* self);
157 
158   ///
159   // A group id is used to tag Views which are part of the same logical group.
160   // Focus can be moved between views with the same group using the arrow keys.
161   // The group id is immutable once it's set.
162   ///
163   void(CEF_CALLBACK* set_group_id)(struct _cef_view_t* self, int group_id);
164 
165   ///
166   // Returns the View that contains this View, if any.
167   ///
168   struct _cef_view_t*(CEF_CALLBACK* get_parent_view)(struct _cef_view_t* self);
169 
170   ///
171   // Recursively descends the view tree starting at this View, and returns the
172   // first child that it encounters with the given ID. Returns NULL if no
173   // matching child view is found.
174   ///
175   struct _cef_view_t*(CEF_CALLBACK* get_view_for_id)(struct _cef_view_t* self,
176                                                      int id);
177 
178   ///
179   // Sets the bounds (size and position) of this View. |bounds| is in parent
180   // coordinates, or DIP screen coordinates if there is no parent.
181   ///
182   void(CEF_CALLBACK* set_bounds)(struct _cef_view_t* self,
183                                  const cef_rect_t* bounds);
184 
185   ///
186   // Returns the bounds (size and position) of this View in parent coordinates,
187   // or DIP screen coordinates if there is no parent.
188   ///
189   cef_rect_t(CEF_CALLBACK* get_bounds)(struct _cef_view_t* self);
190 
191   ///
192   // Returns the bounds (size and position) of this View in DIP screen
193   // coordinates.
194   ///
195   cef_rect_t(CEF_CALLBACK* get_bounds_in_screen)(struct _cef_view_t* self);
196 
197   ///
198   // Sets the size of this View without changing the position. |size| in parent
199   // coordinates, or DIP screen coordinates if there is no parent.
200   ///
201   void(CEF_CALLBACK* set_size)(struct _cef_view_t* self,
202                                const cef_size_t* size);
203 
204   ///
205   // Returns the size of this View in parent coordinates, or DIP screen
206   // coordinates if there is no parent.
207   ///
208   cef_size_t(CEF_CALLBACK* get_size)(struct _cef_view_t* self);
209 
210   ///
211   // Sets the position of this View without changing the size. |position| is in
212   // parent coordinates, or DIP screen coordinates if there is no parent.
213   ///
214   void(CEF_CALLBACK* set_position)(struct _cef_view_t* self,
215                                    const cef_point_t* position);
216 
217   ///
218   // Returns the position of this View. Position is in parent coordinates, or
219   // DIP screen coordinates if there is no parent.
220   ///
221   cef_point_t(CEF_CALLBACK* get_position)(struct _cef_view_t* self);
222 
223   ///
224   // Sets the insets for this View. |insets| is in parent coordinates, or DIP
225   // screen coordinates if there is no parent.
226   ///
227   void(CEF_CALLBACK* set_insets)(struct _cef_view_t* self,
228                                  const cef_insets_t* insets);
229 
230   ///
231   // Returns the insets for this View in parent coordinates, or DIP screen
232   // coordinates if there is no parent.
233   ///
234   cef_insets_t(CEF_CALLBACK* get_insets)(struct _cef_view_t* self);
235 
236   ///
237   // Returns the size this View would like to be if enough space is available.
238   // Size is in parent coordinates, or DIP screen coordinates if there is no
239   // parent.
240   ///
241   cef_size_t(CEF_CALLBACK* get_preferred_size)(struct _cef_view_t* self);
242 
243   ///
244   // Size this View to its preferred size. Size is in parent coordinates, or DIP
245   // screen coordinates if there is no parent.
246   ///
247   void(CEF_CALLBACK* size_to_preferred_size)(struct _cef_view_t* self);
248 
249   ///
250   // Returns the minimum size for this View. Size is in parent coordinates, or
251   // DIP screen coordinates if there is no parent.
252   ///
253   cef_size_t(CEF_CALLBACK* get_minimum_size)(struct _cef_view_t* self);
254 
255   ///
256   // Returns the maximum size for this View. Size is in parent coordinates, or
257   // DIP screen coordinates if there is no parent.
258   ///
259   cef_size_t(CEF_CALLBACK* get_maximum_size)(struct _cef_view_t* self);
260 
261   ///
262   // Returns the height necessary to display this View with the provided width.
263   ///
264   int(CEF_CALLBACK* get_height_for_width)(struct _cef_view_t* self, int width);
265 
266   ///
267   // Indicate that this View and all parent Views require a re-layout. This
268   // ensures the next call to layout() will propagate to this View even if the
269   // bounds of parent Views do not change.
270   ///
271   void(CEF_CALLBACK* invalidate_layout)(struct _cef_view_t* self);
272 
273   ///
274   // Sets whether this View is visible. Windows are hidden by default and other
275   // views are visible by default. This View and any parent views must be set as
276   // visible for this View to be drawn in a Window. If this View is set as
277   // hidden then it and any child views will not be drawn and, if any of those
278   // views currently have focus, then focus will also be cleared. Painting is
279   // scheduled as needed. If this View is a Window then calling this function is
280   // equivalent to calling the Window show() and hide() functions.
281   ///
282   void(CEF_CALLBACK* set_visible)(struct _cef_view_t* self, int visible);
283 
284   ///
285   // Returns whether this View is visible. A view may be visible but still not
286   // drawn in a Window if any parent views are hidden. If this View is a Window
287   // then a return value of true (1) indicates that this Window is currently
288   // visible to the user on-screen. If this View is not a Window then call
289   // is_drawn() to determine whether this View and all parent views are visible
290   // and will be drawn.
291   ///
292   int(CEF_CALLBACK* is_visible)(struct _cef_view_t* self);
293 
294   ///
295   // Returns whether this View is visible and drawn in a Window. A view is drawn
296   // if it and all parent views are visible. If this View is a Window then
297   // calling this function is equivalent to calling is_visible(). Otherwise, to
298   // determine if the containing Window is visible to the user on-screen call
299   // is_visible() on the Window.
300   ///
301   int(CEF_CALLBACK* is_drawn)(struct _cef_view_t* self);
302 
303   ///
304   // Set whether this View is enabled. A disabled View does not receive keyboard
305   // or mouse inputs. If |enabled| differs from the current value the View will
306   // be repainted. Also, clears focus if the focused View is disabled.
307   ///
308   void(CEF_CALLBACK* set_enabled)(struct _cef_view_t* self, int enabled);
309 
310   ///
311   // Returns whether this View is enabled.
312   ///
313   int(CEF_CALLBACK* is_enabled)(struct _cef_view_t* self);
314 
315   ///
316   // Sets whether this View is capable of taking focus. It will clear focus if
317   // the focused View is set to be non-focusable. This is false (0) by default
318   // so that a View used as a container does not get the focus.
319   ///
320   void(CEF_CALLBACK* set_focusable)(struct _cef_view_t* self, int focusable);
321 
322   ///
323   // Returns true (1) if this View is focusable, enabled and drawn.
324   ///
325   int(CEF_CALLBACK* is_focusable)(struct _cef_view_t* self);
326 
327   ///
328   // Return whether this View is focusable when the user requires full keyboard
329   // access, even though it may not be normally focusable.
330   ///
331   int(CEF_CALLBACK* is_accessibility_focusable)(struct _cef_view_t* self);
332 
333   ///
334   // Request keyboard focus. If this View is focusable it will become the
335   // focused View.
336   ///
337   void(CEF_CALLBACK* request_focus)(struct _cef_view_t* self);
338 
339   ///
340   // Sets the background color for this View.
341   ///
342   void(CEF_CALLBACK* set_background_color)(struct _cef_view_t* self,
343                                            cef_color_t color);
344 
345   ///
346   // Returns the background color for this View.
347   ///
348   cef_color_t(CEF_CALLBACK* get_background_color)(struct _cef_view_t* self);
349 
350   ///
351   // Convert |point| from this View's coordinate system to DIP screen
352   // coordinates. This View must belong to a Window when calling this function.
353   // Returns true (1) if the conversion is successful or false (0) otherwise.
354   // Use cef_display_t::convert_point_to_pixels() after calling this function if
355   // further conversion to display-specific pixel coordinates is desired.
356   ///
357   int(CEF_CALLBACK* convert_point_to_screen)(struct _cef_view_t* self,
358                                              cef_point_t* point);
359 
360   ///
361   // Convert |point| to this View's coordinate system from DIP screen
362   // coordinates. This View must belong to a Window when calling this function.
363   // Returns true (1) if the conversion is successful or false (0) otherwise.
364   // Use cef_display_t::convert_point_from_pixels() before calling this function
365   // if conversion from display-specific pixel coordinates is necessary.
366   ///
367   int(CEF_CALLBACK* convert_point_from_screen)(struct _cef_view_t* self,
368                                                cef_point_t* point);
369 
370   ///
371   // Convert |point| from this View's coordinate system to that of the Window.
372   // This View must belong to a Window when calling this function. Returns true
373   // (1) if the conversion is successful or false (0) otherwise.
374   ///
375   int(CEF_CALLBACK* convert_point_to_window)(struct _cef_view_t* self,
376                                              cef_point_t* point);
377 
378   ///
379   // Convert |point| to this View's coordinate system from that of the Window.
380   // This View must belong to a Window when calling this function. Returns true
381   // (1) if the conversion is successful or false (0) otherwise.
382   ///
383   int(CEF_CALLBACK* convert_point_from_window)(struct _cef_view_t* self,
384                                                cef_point_t* point);
385 
386   ///
387   // Convert |point| from this View's coordinate system to that of |view|.
388   // |view| needs to be in the same Window but not necessarily the same view
389   // hierarchy. Returns true (1) if the conversion is successful or false (0)
390   // otherwise.
391   ///
392   int(CEF_CALLBACK* convert_point_to_view)(struct _cef_view_t* self,
393                                            struct _cef_view_t* view,
394                                            cef_point_t* point);
395 
396   ///
397   // Convert |point| to this View's coordinate system from that |view|. |view|
398   // needs to be in the same Window but not necessarily the same view hierarchy.
399   // Returns true (1) if the conversion is successful or false (0) otherwise.
400   ///
401   int(CEF_CALLBACK* convert_point_from_view)(struct _cef_view_t* self,
402                                              struct _cef_view_t* view,
403                                              cef_point_t* point);
404 } cef_view_t;
405 
406 #ifdef __cplusplus
407 }
408 #endif
409 
410 #endif  // CEF_INCLUDE_CAPI_VIEWS_CEF_VIEW_CAPI_H_
411