• 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=925b09f77cd71327a447bf5c9601cc21a7eb7c3a$
37 //
38 
39 #ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_MENU_BUTTON_CAPI_H_
40 #define CEF_INCLUDE_CAPI_VIEWS_CEF_MENU_BUTTON_CAPI_H_
41 #pragma once
42 
43 #include "include/capi/cef_menu_model_capi.h"
44 #include "include/capi/views/cef_label_button_capi.h"
45 #include "include/capi/views/cef_menu_button_delegate_capi.h"
46 
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
50 
51 ///
52 // MenuButton is a button with optional text, icon and/or menu marker that shows
53 // a menu when clicked with the left mouse button. All size and position values
54 // are in density independent pixels (DIP) unless otherwise indicated. Methods
55 // must be called on the browser process UI thread unless otherwise indicated.
56 ///
57 typedef struct _cef_menu_button_t {
58   ///
59   // Base structure.
60   ///
61   cef_label_button_t base;
62 
63   ///
64   // Show a menu with contents |menu_model|. |screen_point| specifies the menu
65   // position in screen coordinates. |anchor_position| specifies how the menu
66   // will be anchored relative to |screen_point|. This function should be called
67   // from cef_menu_button_delegate_t::on_menu_button_pressed().
68   ///
69   void(CEF_CALLBACK* show_menu)(struct _cef_menu_button_t* self,
70                                 struct _cef_menu_model_t* menu_model,
71                                 const cef_point_t* screen_point,
72                                 cef_menu_anchor_position_t anchor_position);
73 
74   ///
75   // Show the menu for this button. Results in a call to
76   // cef_menu_button_delegate_t::on_menu_button_pressed().
77   ///
78   void(CEF_CALLBACK* trigger_menu)(struct _cef_menu_button_t* self);
79 } cef_menu_button_t;
80 
81 ///
82 // Create a new MenuButton. A |delegate| must be provided to call show_menu()
83 // when the button is clicked. |text| will be shown on the MenuButton and used
84 // as the default accessible name. If |with_frame| is true (1) the button will
85 // have a visible frame at all times, center alignment, additional padding and a
86 // default minimum size of 70x33 DIP. If |with_frame| is false (0) the button
87 // will only have a visible frame on hover/press, left alignment, less padding
88 // and no default minimum size.
89 ///
90 CEF_EXPORT cef_menu_button_t* cef_menu_button_create(
91     struct _cef_menu_button_delegate_t* delegate,
92     const cef_string_t* text);
93 
94 #ifdef __cplusplus
95 }
96 #endif
97 
98 #endif  // CEF_INCLUDE_CAPI_VIEWS_CEF_MENU_BUTTON_CAPI_H_
99