1 // Copyright (c) 2016 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 // The contents of this file must follow a specific format in order to 33 // support the CEF translator tool. See the translator.README.txt file in the 34 // tools directory for more information. 35 // 36 37 #ifndef CEF_INCLUDE_VIEWS_CEF_MENU_MODEL_DELEGATE_H_ 38 #define CEF_INCLUDE_VIEWS_CEF_MENU_MODEL_DELEGATE_H_ 39 #pragma once 40 41 #include "include/cef_base.h" 42 43 class CefMenuModel; 44 45 /// 46 // Implement this interface to handle menu model events. The methods of this 47 // class will be called on the browser process UI thread unless otherwise 48 // indicated. 49 /// 50 /*--cef(source=client)--*/ 51 class CefMenuModelDelegate : public virtual CefBaseRefCounted { 52 public: 53 /// 54 // Perform the action associated with the specified |command_id| and 55 // optional |event_flags|. 56 /// 57 /*--cef()--*/ 58 virtual void ExecuteCommand(CefRefPtr<CefMenuModel> menu_model, 59 int command_id, 60 cef_event_flags_t event_flags) = 0; 61 62 /// 63 // Called when the user moves the mouse outside the menu and over the owning 64 // window. 65 /// 66 /*--cef()--*/ MouseOutsideMenu(CefRefPtr<CefMenuModel> menu_model,const CefPoint & screen_point)67 virtual void MouseOutsideMenu(CefRefPtr<CefMenuModel> menu_model, 68 const CefPoint& screen_point) {} 69 70 /// 71 // Called on unhandled open submenu keyboard commands. |is_rtl| will be true 72 // if the menu is displaying a right-to-left language. 73 /// 74 /*--cef()--*/ UnhandledOpenSubmenu(CefRefPtr<CefMenuModel> menu_model,bool is_rtl)75 virtual void UnhandledOpenSubmenu(CefRefPtr<CefMenuModel> menu_model, 76 bool is_rtl) {} 77 78 /// 79 // Called on unhandled close submenu keyboard commands. |is_rtl| will be true 80 // if the menu is displaying a right-to-left language. 81 /// 82 /*--cef()--*/ UnhandledCloseSubmenu(CefRefPtr<CefMenuModel> menu_model,bool is_rtl)83 virtual void UnhandledCloseSubmenu(CefRefPtr<CefMenuModel> menu_model, 84 bool is_rtl) {} 85 86 /// 87 // The menu is about to show. 88 /// 89 /*--cef()--*/ MenuWillShow(CefRefPtr<CefMenuModel> menu_model)90 virtual void MenuWillShow(CefRefPtr<CefMenuModel> menu_model) {} 91 92 /// 93 // The menu has closed. 94 /// 95 /*--cef()--*/ MenuClosed(CefRefPtr<CefMenuModel> menu_model)96 virtual void MenuClosed(CefRefPtr<CefMenuModel> menu_model) {} 97 98 /// 99 // Optionally modify a menu item label. Return true if |label| was modified. 100 /// 101 /*--cef()--*/ FormatLabel(CefRefPtr<CefMenuModel> menu_model,CefString & label)102 virtual bool FormatLabel(CefRefPtr<CefMenuModel> menu_model, 103 CefString& label) { 104 return false; 105 } 106 }; 107 108 #endif // CEF_INCLUDE_VIEWS_CEF_MENU_MODEL_DELEGATE_H_ 109