1 // Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are
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
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.
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.
30 // ---------------------------------------------------------------------------
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
37 #ifndef CEF_INCLUDE_CAPI_CEF_MENU_MODEL_CAPI_H_
38 #define CEF_INCLUDE_CAPI_CEF_MENU_MODEL_CAPI_H_
41 #include "include/capi/cef_base_capi.h"
49 // Supports creation and modification of menus. See cef_menu_id_t for the
50 // command ids that have default implementations. All user-defined command ids
51 // should be between MENU_ID_USER_FIRST and MENU_ID_USER_LAST. The functions of
52 // this structure can only be accessed on the browser process the UI thread.
54 typedef struct _cef_menu_model_t {
61 // Clears the menu. Returns true (1) on success.
63 int (CEF_CALLBACK *clear)(struct _cef_menu_model_t* self);
66 // Returns the number of items in this menu.
68 int (CEF_CALLBACK *get_count)(struct _cef_menu_model_t* self);
71 // Add a separator to the menu. Returns true (1) on success.
73 int (CEF_CALLBACK *add_separator)(struct _cef_menu_model_t* self);
76 // Add an item to the menu. Returns true (1) on success.
78 int (CEF_CALLBACK *add_item)(struct _cef_menu_model_t* self, int command_id,
79 const cef_string_t* label);
82 // Add a check item to the menu. Returns true (1) on success.
84 int (CEF_CALLBACK *add_check_item)(struct _cef_menu_model_t* self,
85 int command_id, const cef_string_t* label);
88 // Add a radio item to the menu. Only a single item with the specified
89 // |group_id| can be checked at a time. Returns true (1) on success.
91 int (CEF_CALLBACK *add_radio_item)(struct _cef_menu_model_t* self,
92 int command_id, const cef_string_t* label, int group_id);
95 // Add a sub-menu to the menu. The new sub-menu is returned.
97 struct _cef_menu_model_t* (CEF_CALLBACK *add_sub_menu)(
98 struct _cef_menu_model_t* self, int command_id,
99 const cef_string_t* label);
102 // Insert a separator in the menu at the specified |index|. Returns true (1)
105 int (CEF_CALLBACK *insert_separator_at)(struct _cef_menu_model_t* self,
109 // Insert an item in the menu at the specified |index|. Returns true (1) on
112 int (CEF_CALLBACK *insert_item_at)(struct _cef_menu_model_t* self, int index,
113 int command_id, const cef_string_t* label);
116 // Insert a check item in the menu at the specified |index|. Returns true (1)
119 int (CEF_CALLBACK *insert_check_item_at)(struct _cef_menu_model_t* self,
120 int index, int command_id, const cef_string_t* label);
123 // Insert a radio item in the menu at the specified |index|. Only a single
124 // item with the specified |group_id| can be checked at a time. Returns true
127 int (CEF_CALLBACK *insert_radio_item_at)(struct _cef_menu_model_t* self,
128 int index, int command_id, const cef_string_t* label, int group_id);
131 // Insert a sub-menu in the menu at the specified |index|. The new sub-menu is
134 struct _cef_menu_model_t* (CEF_CALLBACK *insert_sub_menu_at)(
135 struct _cef_menu_model_t* self, int index, int command_id,
136 const cef_string_t* label);
139 // Removes the item with the specified |command_id|. Returns true (1) on
142 int (CEF_CALLBACK *remove)(struct _cef_menu_model_t* self, int command_id);
145 // Removes the item at the specified |index|. Returns true (1) on success.
147 int (CEF_CALLBACK *remove_at)(struct _cef_menu_model_t* self, int index);
150 // Returns the index associated with the specified |command_id| or -1 if not
151 // found due to the command id not existing in the menu.
153 int (CEF_CALLBACK *get_index_of)(struct _cef_menu_model_t* self,
157 // Returns the command id at the specified |index| or -1 if not found due to
158 // invalid range or the index being a separator.
160 int (CEF_CALLBACK *get_command_id_at)(struct _cef_menu_model_t* self,
164 // Sets the command id at the specified |index|. Returns true (1) on success.
166 int (CEF_CALLBACK *set_command_id_at)(struct _cef_menu_model_t* self,
167 int index, int command_id);
170 // Returns the label for the specified |command_id| or NULL if not found.
172 // The resulting string must be freed by calling cef_string_userfree_free().
173 cef_string_userfree_t (CEF_CALLBACK *get_label)(
174 struct _cef_menu_model_t* self, int command_id);
177 // Returns the label at the specified |index| or NULL if not found due to
178 // invalid range or the index being a separator.
180 // The resulting string must be freed by calling cef_string_userfree_free().
181 cef_string_userfree_t (CEF_CALLBACK *get_label_at)(
182 struct _cef_menu_model_t* self, int index);
185 // Sets the label for the specified |command_id|. Returns true (1) on success.
187 int (CEF_CALLBACK *set_label)(struct _cef_menu_model_t* self, int command_id,
188 const cef_string_t* label);
191 // Set the label at the specified |index|. Returns true (1) on success.
193 int (CEF_CALLBACK *set_label_at)(struct _cef_menu_model_t* self, int index,
194 const cef_string_t* label);
197 // Returns the item type for the specified |command_id|.
199 cef_menu_item_type_t (CEF_CALLBACK *get_type)(struct _cef_menu_model_t* self,
203 // Returns the item type at the specified |index|.
205 cef_menu_item_type_t (CEF_CALLBACK *get_type_at)(
206 struct _cef_menu_model_t* self, int index);
209 // Returns the group id for the specified |command_id| or -1 if invalid.
211 int (CEF_CALLBACK *get_group_id)(struct _cef_menu_model_t* self,
215 // Returns the group id at the specified |index| or -1 if invalid.
217 int (CEF_CALLBACK *get_group_id_at)(struct _cef_menu_model_t* self,
221 // Sets the group id for the specified |command_id|. Returns true (1) on
224 int (CEF_CALLBACK *set_group_id)(struct _cef_menu_model_t* self,
225 int command_id, int group_id);
228 // Sets the group id at the specified |index|. Returns true (1) on success.
230 int (CEF_CALLBACK *set_group_id_at)(struct _cef_menu_model_t* self, int index,
234 // Returns the submenu for the specified |command_id| or NULL if invalid.
236 struct _cef_menu_model_t* (CEF_CALLBACK *get_sub_menu)(
237 struct _cef_menu_model_t* self, int command_id);
240 // Returns the submenu at the specified |index| or NULL if invalid.
242 struct _cef_menu_model_t* (CEF_CALLBACK *get_sub_menu_at)(
243 struct _cef_menu_model_t* self, int index);
246 // Returns true (1) if the specified |command_id| is visible.
248 int (CEF_CALLBACK *is_visible)(struct _cef_menu_model_t* self,
252 // Returns true (1) if the specified |index| is visible.
254 int (CEF_CALLBACK *is_visible_at)(struct _cef_menu_model_t* self, int index);
257 // Change the visibility of the specified |command_id|. Returns true (1) on
260 int (CEF_CALLBACK *set_visible)(struct _cef_menu_model_t* self,
261 int command_id, int visible);
264 // Change the visibility at the specified |index|. Returns true (1) on
267 int (CEF_CALLBACK *set_visible_at)(struct _cef_menu_model_t* self, int index,
271 // Returns true (1) if the specified |command_id| is enabled.
273 int (CEF_CALLBACK *is_enabled)(struct _cef_menu_model_t* self,
277 // Returns true (1) if the specified |index| is enabled.
279 int (CEF_CALLBACK *is_enabled_at)(struct _cef_menu_model_t* self, int index);
282 // Change the enabled status of the specified |command_id|. Returns true (1)
285 int (CEF_CALLBACK *set_enabled)(struct _cef_menu_model_t* self,
286 int command_id, int enabled);
289 // Change the enabled status at the specified |index|. Returns true (1) on
292 int (CEF_CALLBACK *set_enabled_at)(struct _cef_menu_model_t* self, int index,
296 // Returns true (1) if the specified |command_id| is checked. Only applies to
297 // check and radio items.
299 int (CEF_CALLBACK *is_checked)(struct _cef_menu_model_t* self,
303 // Returns true (1) if the specified |index| is checked. Only applies to check
306 int (CEF_CALLBACK *is_checked_at)(struct _cef_menu_model_t* self, int index);
309 // Check the specified |command_id|. Only applies to check and radio items.
310 // Returns true (1) on success.
312 int (CEF_CALLBACK *set_checked)(struct _cef_menu_model_t* self,
313 int command_id, int checked);
316 // Check the specified |index|. Only applies to check and radio items. Returns
317 // true (1) on success.
319 int (CEF_CALLBACK *set_checked_at)(struct _cef_menu_model_t* self, int index,
323 // Returns true (1) if the specified |command_id| has a keyboard accelerator
326 int (CEF_CALLBACK *has_accelerator)(struct _cef_menu_model_t* self,
330 // Returns true (1) if the specified |index| has a keyboard accelerator
333 int (CEF_CALLBACK *has_accelerator_at)(struct _cef_menu_model_t* self,
337 // Set the keyboard accelerator for the specified |command_id|. |key_code| can
338 // be any virtual key or character value. Returns true (1) on success.
340 int (CEF_CALLBACK *set_accelerator)(struct _cef_menu_model_t* self,
341 int command_id, int key_code, int shift_pressed, int ctrl_pressed,
345 // Set the keyboard accelerator at the specified |index|. |key_code| can be
346 // any virtual key or character value. Returns true (1) on success.
348 int (CEF_CALLBACK *set_accelerator_at)(struct _cef_menu_model_t* self,
349 int index, int key_code, int shift_pressed, int ctrl_pressed,
353 // Remove the keyboard accelerator for the specified |command_id|. Returns
354 // true (1) on success.
356 int (CEF_CALLBACK *remove_accelerator)(struct _cef_menu_model_t* self,
360 // Remove the keyboard accelerator at the specified |index|. Returns true (1)
363 int (CEF_CALLBACK *remove_accelerator_at)(struct _cef_menu_model_t* self,
367 // Retrieves the keyboard accelerator for the specified |command_id|. Returns
368 // true (1) on success.
370 int (CEF_CALLBACK *get_accelerator)(struct _cef_menu_model_t* self,
371 int command_id, int* key_code, int* shift_pressed, int* ctrl_pressed,
375 // Retrieves the keyboard accelerator for the specified |index|. Returns true
378 int (CEF_CALLBACK *get_accelerator_at)(struct _cef_menu_model_t* self,
379 int index, int* key_code, int* shift_pressed, int* ctrl_pressed,
388 #endif // CEF_INCLUDE_CAPI_CEF_MENU_MODEL_CAPI_H_