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=9f30f2caa9eedc0d4fe963dbf0127602ffcbec61$ 37 // 38 39 #ifndef CEF_INCLUDE_CAPI_CEF_MENU_MODEL_CAPI_H_ 40 #define CEF_INCLUDE_CAPI_CEF_MENU_MODEL_CAPI_H_ 41 #pragma once 42 43 #include "include/capi/cef_base_capi.h" 44 #include "include/capi/cef_menu_model_delegate_capi.h" 45 46 #ifdef __cplusplus 47 extern "C" { 48 #endif 49 50 /// 51 // Supports creation and modification of menus. See cef_menu_id_t for the 52 // command ids that have default implementations. All user-defined command ids 53 // should be between MENU_ID_USER_FIRST and MENU_ID_USER_LAST. The functions of 54 // this structure can only be accessed on the browser process the UI thread. 55 /// 56 typedef struct _cef_menu_model_t { 57 /// 58 // Base structure. 59 /// 60 cef_base_ref_counted_t base; 61 62 /// 63 // Returns true (1) if this menu is a submenu. 64 /// 65 int(CEF_CALLBACK* is_sub_menu)(struct _cef_menu_model_t* self); 66 67 /// 68 // Clears the menu. Returns true (1) on success. 69 /// 70 int(CEF_CALLBACK* clear)(struct _cef_menu_model_t* self); 71 72 /// 73 // Returns the number of items in this menu. 74 /// 75 int(CEF_CALLBACK* get_count)(struct _cef_menu_model_t* self); 76 77 /// 78 // Add a separator to the menu. Returns true (1) on success. 79 /// 80 int(CEF_CALLBACK* add_separator)(struct _cef_menu_model_t* self); 81 82 /// 83 // Add an item to the menu. Returns true (1) on success. 84 /// 85 int(CEF_CALLBACK* add_item)(struct _cef_menu_model_t* self, 86 int command_id, 87 const cef_string_t* label); 88 89 /// 90 // Add a check item to the menu. Returns true (1) on success. 91 /// 92 int(CEF_CALLBACK* add_check_item)(struct _cef_menu_model_t* self, 93 int command_id, 94 const cef_string_t* label); 95 96 /// 97 // Add a radio item to the menu. Only a single item with the specified 98 // |group_id| can be checked at a time. Returns true (1) on success. 99 /// 100 int(CEF_CALLBACK* add_radio_item)(struct _cef_menu_model_t* self, 101 int command_id, 102 const cef_string_t* label, 103 int group_id); 104 105 /// 106 // Add a sub-menu to the menu. The new sub-menu is returned. 107 /// 108 struct _cef_menu_model_t*(CEF_CALLBACK* add_sub_menu)( 109 struct _cef_menu_model_t* self, 110 int command_id, 111 const cef_string_t* label); 112 113 /// 114 // Insert a separator in the menu at the specified |index|. Returns true (1) 115 // on success. 116 /// 117 int(CEF_CALLBACK* insert_separator_at)(struct _cef_menu_model_t* self, 118 int index); 119 120 /// 121 // Insert an item in the menu at the specified |index|. Returns true (1) on 122 // success. 123 /// 124 int(CEF_CALLBACK* insert_item_at)(struct _cef_menu_model_t* self, 125 int index, 126 int command_id, 127 const cef_string_t* label); 128 129 /// 130 // Insert a check item in the menu at the specified |index|. Returns true (1) 131 // on success. 132 /// 133 int(CEF_CALLBACK* insert_check_item_at)(struct _cef_menu_model_t* self, 134 int index, 135 int command_id, 136 const cef_string_t* label); 137 138 /// 139 // Insert a radio item in the menu at the specified |index|. Only a single 140 // item with the specified |group_id| can be checked at a time. Returns true 141 // (1) on success. 142 /// 143 int(CEF_CALLBACK* insert_radio_item_at)(struct _cef_menu_model_t* self, 144 int index, 145 int command_id, 146 const cef_string_t* label, 147 int group_id); 148 149 /// 150 // Insert a sub-menu in the menu at the specified |index|. The new sub-menu is 151 // returned. 152 /// 153 struct _cef_menu_model_t*(CEF_CALLBACK* insert_sub_menu_at)( 154 struct _cef_menu_model_t* self, 155 int index, 156 int command_id, 157 const cef_string_t* label); 158 159 /// 160 // Removes the item with the specified |command_id|. Returns true (1) on 161 // success. 162 /// 163 int(CEF_CALLBACK* remove)(struct _cef_menu_model_t* self, int command_id); 164 165 /// 166 // Removes the item at the specified |index|. Returns true (1) on success. 167 /// 168 int(CEF_CALLBACK* remove_at)(struct _cef_menu_model_t* self, int index); 169 170 /// 171 // Returns the index associated with the specified |command_id| or -1 if not 172 // found due to the command id not existing in the menu. 173 /// 174 int(CEF_CALLBACK* get_index_of)(struct _cef_menu_model_t* self, 175 int command_id); 176 177 /// 178 // Returns the command id at the specified |index| or -1 if not found due to 179 // invalid range or the index being a separator. 180 /// 181 int(CEF_CALLBACK* get_command_id_at)(struct _cef_menu_model_t* self, 182 int index); 183 184 /// 185 // Sets the command id at the specified |index|. Returns true (1) on success. 186 /// 187 int(CEF_CALLBACK* set_command_id_at)(struct _cef_menu_model_t* self, 188 int index, 189 int command_id); 190 191 /// 192 // Returns the label for the specified |command_id| or NULL if not found. 193 /// 194 // The resulting string must be freed by calling cef_string_userfree_free(). 195 cef_string_userfree_t(CEF_CALLBACK* get_label)(struct _cef_menu_model_t* self, 196 int command_id); 197 198 /// 199 // Returns the label at the specified |index| or NULL if not found due to 200 // invalid range or the index being a separator. 201 /// 202 // The resulting string must be freed by calling cef_string_userfree_free(). 203 cef_string_userfree_t( 204 CEF_CALLBACK* get_label_at)(struct _cef_menu_model_t* self, int index); 205 206 /// 207 // Sets the label for the specified |command_id|. Returns true (1) on success. 208 /// 209 int(CEF_CALLBACK* set_label)(struct _cef_menu_model_t* self, 210 int command_id, 211 const cef_string_t* label); 212 213 /// 214 // Set the label at the specified |index|. Returns true (1) on success. 215 /// 216 int(CEF_CALLBACK* set_label_at)(struct _cef_menu_model_t* self, 217 int index, 218 const cef_string_t* label); 219 220 /// 221 // Returns the item type for the specified |command_id|. 222 /// 223 cef_menu_item_type_t(CEF_CALLBACK* get_type)(struct _cef_menu_model_t* self, 224 int command_id); 225 226 /// 227 // Returns the item type at the specified |index|. 228 /// 229 cef_menu_item_type_t( 230 CEF_CALLBACK* get_type_at)(struct _cef_menu_model_t* self, int index); 231 232 /// 233 // Returns the group id for the specified |command_id| or -1 if invalid. 234 /// 235 int(CEF_CALLBACK* get_group_id)(struct _cef_menu_model_t* self, 236 int command_id); 237 238 /// 239 // Returns the group id at the specified |index| or -1 if invalid. 240 /// 241 int(CEF_CALLBACK* get_group_id_at)(struct _cef_menu_model_t* self, int index); 242 243 /// 244 // Sets the group id for the specified |command_id|. Returns true (1) on 245 // success. 246 /// 247 int(CEF_CALLBACK* set_group_id)(struct _cef_menu_model_t* self, 248 int command_id, 249 int group_id); 250 251 /// 252 // Sets the group id at the specified |index|. Returns true (1) on success. 253 /// 254 int(CEF_CALLBACK* set_group_id_at)(struct _cef_menu_model_t* self, 255 int index, 256 int group_id); 257 258 /// 259 // Returns the submenu for the specified |command_id| or NULL if invalid. 260 /// 261 struct _cef_menu_model_t*(CEF_CALLBACK* get_sub_menu)( 262 struct _cef_menu_model_t* self, 263 int command_id); 264 265 /// 266 // Returns the submenu at the specified |index| or NULL if invalid. 267 /// 268 struct _cef_menu_model_t*( 269 CEF_CALLBACK* get_sub_menu_at)(struct _cef_menu_model_t* self, int index); 270 271 /// 272 // Returns true (1) if the specified |command_id| is visible. 273 /// 274 int(CEF_CALLBACK* is_visible)(struct _cef_menu_model_t* self, int command_id); 275 276 /// 277 // Returns true (1) if the specified |index| is visible. 278 /// 279 int(CEF_CALLBACK* is_visible_at)(struct _cef_menu_model_t* self, int index); 280 281 /// 282 // Change the visibility of the specified |command_id|. Returns true (1) on 283 // success. 284 /// 285 int(CEF_CALLBACK* set_visible)(struct _cef_menu_model_t* self, 286 int command_id, 287 int visible); 288 289 /// 290 // Change the visibility at the specified |index|. Returns true (1) on 291 // success. 292 /// 293 int(CEF_CALLBACK* set_visible_at)(struct _cef_menu_model_t* self, 294 int index, 295 int visible); 296 297 /// 298 // Returns true (1) if the specified |command_id| is enabled. 299 /// 300 int(CEF_CALLBACK* is_enabled)(struct _cef_menu_model_t* self, int command_id); 301 302 /// 303 // Returns true (1) if the specified |index| is enabled. 304 /// 305 int(CEF_CALLBACK* is_enabled_at)(struct _cef_menu_model_t* self, int index); 306 307 /// 308 // Change the enabled status of the specified |command_id|. Returns true (1) 309 // on success. 310 /// 311 int(CEF_CALLBACK* set_enabled)(struct _cef_menu_model_t* self, 312 int command_id, 313 int enabled); 314 315 /// 316 // Change the enabled status at the specified |index|. Returns true (1) on 317 // success. 318 /// 319 int(CEF_CALLBACK* set_enabled_at)(struct _cef_menu_model_t* self, 320 int index, 321 int enabled); 322 323 /// 324 // Returns true (1) if the specified |command_id| is checked. Only applies to 325 // check and radio items. 326 /// 327 int(CEF_CALLBACK* is_checked)(struct _cef_menu_model_t* self, int command_id); 328 329 /// 330 // Returns true (1) if the specified |index| is checked. Only applies to check 331 // and radio items. 332 /// 333 int(CEF_CALLBACK* is_checked_at)(struct _cef_menu_model_t* self, int index); 334 335 /// 336 // Check the specified |command_id|. Only applies to check and radio items. 337 // Returns true (1) on success. 338 /// 339 int(CEF_CALLBACK* set_checked)(struct _cef_menu_model_t* self, 340 int command_id, 341 int checked); 342 343 /// 344 // Check the specified |index|. Only applies to check and radio items. Returns 345 // true (1) on success. 346 /// 347 int(CEF_CALLBACK* set_checked_at)(struct _cef_menu_model_t* self, 348 int index, 349 int checked); 350 351 /// 352 // Returns true (1) if the specified |command_id| has a keyboard accelerator 353 // assigned. 354 /// 355 int(CEF_CALLBACK* has_accelerator)(struct _cef_menu_model_t* self, 356 int command_id); 357 358 /// 359 // Returns true (1) if the specified |index| has a keyboard accelerator 360 // assigned. 361 /// 362 int(CEF_CALLBACK* has_accelerator_at)(struct _cef_menu_model_t* self, 363 int index); 364 365 /// 366 // Set the keyboard accelerator for the specified |command_id|. |key_code| can 367 // be any virtual key or character value. Returns true (1) on success. 368 /// 369 int(CEF_CALLBACK* set_accelerator)(struct _cef_menu_model_t* self, 370 int command_id, 371 int key_code, 372 int shift_pressed, 373 int ctrl_pressed, 374 int alt_pressed); 375 376 /// 377 // Set the keyboard accelerator at the specified |index|. |key_code| can be 378 // any virtual key or character value. Returns true (1) on success. 379 /// 380 int(CEF_CALLBACK* set_accelerator_at)(struct _cef_menu_model_t* self, 381 int index, 382 int key_code, 383 int shift_pressed, 384 int ctrl_pressed, 385 int alt_pressed); 386 387 /// 388 // Remove the keyboard accelerator for the specified |command_id|. Returns 389 // true (1) on success. 390 /// 391 int(CEF_CALLBACK* remove_accelerator)(struct _cef_menu_model_t* self, 392 int command_id); 393 394 /// 395 // Remove the keyboard accelerator at the specified |index|. Returns true (1) 396 // on success. 397 /// 398 int(CEF_CALLBACK* remove_accelerator_at)(struct _cef_menu_model_t* self, 399 int index); 400 401 /// 402 // Retrieves the keyboard accelerator for the specified |command_id|. Returns 403 // true (1) on success. 404 /// 405 int(CEF_CALLBACK* get_accelerator)(struct _cef_menu_model_t* self, 406 int command_id, 407 int* key_code, 408 int* shift_pressed, 409 int* ctrl_pressed, 410 int* alt_pressed); 411 412 /// 413 // Retrieves the keyboard accelerator for the specified |index|. Returns true 414 // (1) on success. 415 /// 416 int(CEF_CALLBACK* get_accelerator_at)(struct _cef_menu_model_t* self, 417 int index, 418 int* key_code, 419 int* shift_pressed, 420 int* ctrl_pressed, 421 int* alt_pressed); 422 423 /// 424 // Set the explicit color for |command_id| and |color_type| to |color|. 425 // Specify a |color| value of 0 to remove the explicit color. If no explicit 426 // color or default color is set for |color_type| then the system color will 427 // be used. Returns true (1) on success. 428 /// 429 int(CEF_CALLBACK* set_color)(struct _cef_menu_model_t* self, 430 int command_id, 431 cef_menu_color_type_t color_type, 432 cef_color_t color); 433 434 /// 435 // Set the explicit color for |command_id| and |index| to |color|. Specify a 436 // |color| value of 0 to remove the explicit color. Specify an |index| value 437 // of -1 to set the default color for items that do not have an explicit color 438 // set. If no explicit color or default color is set for |color_type| then the 439 // system color will be used. Returns true (1) on success. 440 /// 441 int(CEF_CALLBACK* set_color_at)(struct _cef_menu_model_t* self, 442 int index, 443 cef_menu_color_type_t color_type, 444 cef_color_t color); 445 446 /// 447 // Returns in |color| the color that was explicitly set for |command_id| and 448 // |color_type|. If a color was not set then 0 will be returned in |color|. 449 // Returns true (1) on success. 450 /// 451 int(CEF_CALLBACK* get_color)(struct _cef_menu_model_t* self, 452 int command_id, 453 cef_menu_color_type_t color_type, 454 cef_color_t* color); 455 456 /// 457 // Returns in |color| the color that was explicitly set for |command_id| and 458 // |color_type|. Specify an |index| value of -1 to return the default color in 459 // |color|. If a color was not set then 0 will be returned in |color|. Returns 460 // true (1) on success. 461 /// 462 int(CEF_CALLBACK* get_color_at)(struct _cef_menu_model_t* self, 463 int index, 464 cef_menu_color_type_t color_type, 465 cef_color_t* color); 466 467 /// 468 // Sets the font list for the specified |command_id|. If |font_list| is NULL 469 // the system font will be used. Returns true (1) on success. The format is 470 // "<FONT_FAMILY_LIST>,[STYLES] <SIZE>", where: - FONT_FAMILY_LIST is a comma- 471 // separated list of font family names, - STYLES is an optional space- 472 // separated list of style names (case-sensitive 473 // "Bold" and "Italic" are supported), and 474 // - SIZE is an integer font size in pixels with the suffix "px". 475 // 476 // Here are examples of valid font description strings: - "Arial, Helvetica, 477 // Bold Italic 14px" - "Arial, 14px" 478 /// 479 int(CEF_CALLBACK* set_font_list)(struct _cef_menu_model_t* self, 480 int command_id, 481 const cef_string_t* font_list); 482 483 /// 484 // Sets the font list for the specified |index|. Specify an |index| value of 485 // -1 to set the default font. If |font_list| is NULL the system font will be 486 // used. Returns true (1) on success. The format is 487 // "<FONT_FAMILY_LIST>,[STYLES] <SIZE>", where: - FONT_FAMILY_LIST is a comma- 488 // separated list of font family names, - STYLES is an optional space- 489 // separated list of style names (case-sensitive 490 // "Bold" and "Italic" are supported), and 491 // - SIZE is an integer font size in pixels with the suffix "px". 492 // 493 // Here are examples of valid font description strings: - "Arial, Helvetica, 494 // Bold Italic 14px" - "Arial, 14px" 495 /// 496 int(CEF_CALLBACK* set_font_list_at)(struct _cef_menu_model_t* self, 497 int index, 498 const cef_string_t* font_list); 499 } cef_menu_model_t; 500 501 /// 502 // Create a new MenuModel with the specified |delegate|. 503 /// 504 CEF_EXPORT cef_menu_model_t* cef_menu_model_create( 505 struct _cef_menu_model_delegate_t* delegate); 506 507 #ifdef __cplusplus 508 } 509 #endif 510 511 #endif // CEF_INCLUDE_CAPI_CEF_MENU_MODEL_CAPI_H_ 512