]> git.sesse.net Git - casparcg/blob - dependencies64/cef/include/capi/cef_context_menu_handler_capi.h
* Merged html producer and updated to latest CEF version (does not have satisfactory...
[casparcg] / dependencies64 / cef / include / capi / cef_context_menu_handler_capi.h
1 // Copyright (c) 2015 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
37 #ifndef CEF_INCLUDE_CAPI_CEF_CONTEXT_MENU_HANDLER_CAPI_H_
38 #define CEF_INCLUDE_CAPI_CEF_CONTEXT_MENU_HANDLER_CAPI_H_
39 #pragma once
40
41 #include "include/capi/cef_base_capi.h"
42 #include "include/capi/cef_browser_capi.h"
43 #include "include/capi/cef_frame_capi.h"
44 #include "include/capi/cef_menu_model_capi.h"
45
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49
50 struct _cef_context_menu_params_t;
51
52 ///
53 // Implement this structure to handle context menu events. The functions of this
54 // structure will be called on the UI thread.
55 ///
56 typedef struct _cef_context_menu_handler_t {
57   ///
58   // Base structure.
59   ///
60   cef_base_t base;
61
62   ///
63   // Called before a context menu is displayed. |params| provides information
64   // about the context menu state. |model| initially contains the default
65   // context menu. The |model| can be cleared to show no context menu or
66   // modified to show a custom menu. Do not keep references to |params| or
67   // |model| outside of this callback.
68   ///
69   void (CEF_CALLBACK *on_before_context_menu)(
70       struct _cef_context_menu_handler_t* self, struct _cef_browser_t* browser,
71       struct _cef_frame_t* frame, struct _cef_context_menu_params_t* params,
72       struct _cef_menu_model_t* model);
73
74   ///
75   // Called to execute a command selected from the context menu. Return true (1)
76   // if the command was handled or false (0) for the default implementation. See
77   // cef_menu_id_t for the command ids that have default implementations. All
78   // user-defined command ids should be between MENU_ID_USER_FIRST and
79   // MENU_ID_USER_LAST. |params| will have the same values as what was passed to
80   // on_before_context_menu(). Do not keep a reference to |params| outside of
81   // this callback.
82   ///
83   int (CEF_CALLBACK *on_context_menu_command)(
84       struct _cef_context_menu_handler_t* self, struct _cef_browser_t* browser,
85       struct _cef_frame_t* frame, struct _cef_context_menu_params_t* params,
86       int command_id, cef_event_flags_t event_flags);
87
88   ///
89   // Called when the context menu is dismissed irregardless of whether the menu
90   // was NULL or a command was selected.
91   ///
92   void (CEF_CALLBACK *on_context_menu_dismissed)(
93       struct _cef_context_menu_handler_t* self, struct _cef_browser_t* browser,
94       struct _cef_frame_t* frame);
95 } cef_context_menu_handler_t;
96
97
98 ///
99 // Provides information about the context menu state. The ethods of this
100 // structure can only be accessed on browser process the UI thread.
101 ///
102 typedef struct _cef_context_menu_params_t {
103   ///
104   // Base structure.
105   ///
106   cef_base_t base;
107
108   ///
109   // Returns the X coordinate of the mouse where the context menu was invoked.
110   // Coords are relative to the associated RenderView's origin.
111   ///
112   int (CEF_CALLBACK *get_xcoord)(struct _cef_context_menu_params_t* self);
113
114   ///
115   // Returns the Y coordinate of the mouse where the context menu was invoked.
116   // Coords are relative to the associated RenderView's origin.
117   ///
118   int (CEF_CALLBACK *get_ycoord)(struct _cef_context_menu_params_t* self);
119
120   ///
121   // Returns flags representing the type of node that the context menu was
122   // invoked on.
123   ///
124   cef_context_menu_type_flags_t (CEF_CALLBACK *get_type_flags)(
125       struct _cef_context_menu_params_t* self);
126
127   ///
128   // Returns the URL of the link, if any, that encloses the node that the
129   // context menu was invoked on.
130   ///
131   // The resulting string must be freed by calling cef_string_userfree_free().
132   cef_string_userfree_t (CEF_CALLBACK *get_link_url)(
133       struct _cef_context_menu_params_t* self);
134
135   ///
136   // Returns the link URL, if any, to be used ONLY for "copy link address". We
137   // don't validate this field in the frontend process.
138   ///
139   // The resulting string must be freed by calling cef_string_userfree_free().
140   cef_string_userfree_t (CEF_CALLBACK *get_unfiltered_link_url)(
141       struct _cef_context_menu_params_t* self);
142
143   ///
144   // Returns the source URL, if any, for the element that the context menu was
145   // invoked on. Example of elements with source URLs are img, audio, and video.
146   ///
147   // The resulting string must be freed by calling cef_string_userfree_free().
148   cef_string_userfree_t (CEF_CALLBACK *get_source_url)(
149       struct _cef_context_menu_params_t* self);
150
151   ///
152   // Returns true (1) if the context menu was invoked on an image which has non-
153   // NULL contents.
154   ///
155   int (CEF_CALLBACK *has_image_contents)(
156       struct _cef_context_menu_params_t* self);
157
158   ///
159   // Returns the URL of the top level page that the context menu was invoked on.
160   ///
161   // The resulting string must be freed by calling cef_string_userfree_free().
162   cef_string_userfree_t (CEF_CALLBACK *get_page_url)(
163       struct _cef_context_menu_params_t* self);
164
165   ///
166   // Returns the URL of the subframe that the context menu was invoked on.
167   ///
168   // The resulting string must be freed by calling cef_string_userfree_free().
169   cef_string_userfree_t (CEF_CALLBACK *get_frame_url)(
170       struct _cef_context_menu_params_t* self);
171
172   ///
173   // Returns the character encoding of the subframe that the context menu was
174   // invoked on.
175   ///
176   // The resulting string must be freed by calling cef_string_userfree_free().
177   cef_string_userfree_t (CEF_CALLBACK *get_frame_charset)(
178       struct _cef_context_menu_params_t* self);
179
180   ///
181   // Returns the type of context node that the context menu was invoked on.
182   ///
183   cef_context_menu_media_type_t (CEF_CALLBACK *get_media_type)(
184       struct _cef_context_menu_params_t* self);
185
186   ///
187   // Returns flags representing the actions supported by the media element, if
188   // any, that the context menu was invoked on.
189   ///
190   cef_context_menu_media_state_flags_t (CEF_CALLBACK *get_media_state_flags)(
191       struct _cef_context_menu_params_t* self);
192
193   ///
194   // Returns the text of the selection, if any, that the context menu was
195   // invoked on.
196   ///
197   // The resulting string must be freed by calling cef_string_userfree_free().
198   cef_string_userfree_t (CEF_CALLBACK *get_selection_text)(
199       struct _cef_context_menu_params_t* self);
200
201   ///
202   // Returns the text of the misspelled word, if any, that the context menu was
203   // invoked on.
204   ///
205   // The resulting string must be freed by calling cef_string_userfree_free().
206   cef_string_userfree_t (CEF_CALLBACK *get_misspelled_word)(
207       struct _cef_context_menu_params_t* self);
208
209   ///
210   // Returns true (1) if suggestions exist, false (0) otherwise. Fills in
211   // |suggestions| from the spell check service for the misspelled word if there
212   // is one.
213   ///
214   int (CEF_CALLBACK *get_dictionary_suggestions)(
215       struct _cef_context_menu_params_t* self, cef_string_list_t suggestions);
216
217   ///
218   // Returns true (1) if the context menu was invoked on an editable node.
219   ///
220   int (CEF_CALLBACK *is_editable)(struct _cef_context_menu_params_t* self);
221
222   ///
223   // Returns true (1) if the context menu was invoked on an editable node where
224   // spell-check is enabled.
225   ///
226   int (CEF_CALLBACK *is_spell_check_enabled)(
227       struct _cef_context_menu_params_t* self);
228
229   ///
230   // Returns flags representing the actions supported by the editable node, if
231   // any, that the context menu was invoked on.
232   ///
233   cef_context_menu_edit_state_flags_t (CEF_CALLBACK *get_edit_state_flags)(
234       struct _cef_context_menu_params_t* self);
235 } cef_context_menu_params_t;
236
237
238 #ifdef __cplusplus
239 }
240 #endif
241
242 #endif  // CEF_INCLUDE_CAPI_CEF_CONTEXT_MENU_HANDLER_CAPI_H_