diff --git a/include/capi/cef_menu_model_delegate_capi.h b/include/capi/cef_menu_model_delegate_capi.h index d04bcf690..00c6116cf 100644 --- a/include/capi/cef_menu_model_delegate_capi.h +++ b/include/capi/cef_menu_model_delegate_capi.h @@ -70,6 +70,19 @@ typedef struct _cef_menu_model_delegate_t { /// void (CEF_CALLBACK *menu_will_show)(struct _cef_menu_model_delegate_t* self, struct _cef_menu_model_t* menu_model); + + /// + // The menu has closed. + /// + void (CEF_CALLBACK *menu_closed)(struct _cef_menu_model_delegate_t* self, + struct _cef_menu_model_t* menu_model); + + /// + // Optionally modify a menu item label. Return true (1) if |label| was + // modified. + /// + int (CEF_CALLBACK *format_label)(struct _cef_menu_model_delegate_t* self, + struct _cef_menu_model_t* menu_model, cef_string_t* label); } cef_menu_model_delegate_t; diff --git a/include/cef_menu_model_delegate.h b/include/cef_menu_model_delegate.h index b4e234189..84ebae18e 100644 --- a/include/cef_menu_model_delegate.h +++ b/include/cef_menu_model_delegate.h @@ -63,20 +63,20 @@ class CefMenuModelDelegate : public virtual CefBase { // The menu is about to show. /// /*--cef()--*/ - virtual void MenuWillShow(CefRefPtr menu_model) {}; + virtual void MenuWillShow(CefRefPtr menu_model) {} /// // The menu has closed. /// /*--cef()--*/ - virtual void MenuClosed(CefRefPtr menu_model) {}; + virtual void MenuClosed(CefRefPtr menu_model) {} /// // Optionally modify a menu item label. Return true if |label| was modified. /// /*--cef()--*/ virtual bool FormatLabel(CefRefPtr menu_model, - CefString& label) { return false; }; + CefString& label) { return false; } }; #endif // CEF_INCLUDE_VIEWS_CEF_MENU_MODEL_DELEGATE_H_ diff --git a/libcef_dll/cpptoc/menu_model_delegate_cpptoc.cc b/libcef_dll/cpptoc/menu_model_delegate_cpptoc.cc index 4862b5f9f..fe07faceb 100644 --- a/libcef_dll/cpptoc/menu_model_delegate_cpptoc.cc +++ b/libcef_dll/cpptoc/menu_model_delegate_cpptoc.cc @@ -55,6 +55,52 @@ void CEF_CALLBACK menu_model_delegate_menu_will_show( CefMenuModelCToCpp::Wrap(menu_model)); } +void CEF_CALLBACK menu_model_delegate_menu_closed( + struct _cef_menu_model_delegate_t* self, cef_menu_model_t* menu_model) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: menu_model; type: refptr_diff + DCHECK(menu_model); + if (!menu_model) + return; + + // Execute + CefMenuModelDelegateCppToC::Get(self)->MenuClosed( + CefMenuModelCToCpp::Wrap(menu_model)); +} + +int CEF_CALLBACK menu_model_delegate_format_label( + struct _cef_menu_model_delegate_t* self, cef_menu_model_t* menu_model, + cef_string_t* label) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: menu_model; type: refptr_diff + DCHECK(menu_model); + if (!menu_model) + return 0; + // Verify param: label; type: string_byref + DCHECK(label); + if (!label) + return 0; + + // Translate param: label; type: string_byref + CefString labelStr(label); + + // Execute + bool _retval = CefMenuModelDelegateCppToC::Get(self)->FormatLabel( + CefMenuModelCToCpp::Wrap(menu_model), + labelStr); + + // Return type: bool + return _retval; +} + } // namespace @@ -63,6 +109,8 @@ void CEF_CALLBACK menu_model_delegate_menu_will_show( CefMenuModelDelegateCppToC::CefMenuModelDelegateCppToC() { GetStruct()->execute_command = menu_model_delegate_execute_command; GetStruct()->menu_will_show = menu_model_delegate_menu_will_show; + GetStruct()->menu_closed = menu_model_delegate_menu_closed; + GetStruct()->format_label = menu_model_delegate_format_label; } template<> CefRefPtr CefCppToC menu_model) { + cef_menu_model_delegate_t* _struct = GetStruct(); + if (CEF_MEMBER_MISSING(_struct, menu_closed)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: menu_model; type: refptr_diff + DCHECK(menu_model.get()); + if (!menu_model.get()) + return; + + // Execute + _struct->menu_closed(_struct, + CefMenuModelCppToC::Wrap(menu_model)); +} + +bool CefMenuModelDelegateCToCpp::FormatLabel(CefRefPtr menu_model, + CefString& label) { + cef_menu_model_delegate_t* _struct = GetStruct(); + if (CEF_MEMBER_MISSING(_struct, format_label)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: menu_model; type: refptr_diff + DCHECK(menu_model.get()); + if (!menu_model.get()) + return false; + + // Execute + int _retval = _struct->format_label(_struct, + CefMenuModelCppToC::Wrap(menu_model), + label.GetWritableStruct()); + + // Return type: bool + return _retval?true:false; +} + // CONSTRUCTOR - Do not edit by hand. diff --git a/libcef_dll/ctocpp/menu_model_delegate_ctocpp.h b/libcef_dll/ctocpp/menu_model_delegate_ctocpp.h index 5e975539b..654d14146 100644 --- a/libcef_dll/ctocpp/menu_model_delegate_ctocpp.h +++ b/libcef_dll/ctocpp/menu_model_delegate_ctocpp.h @@ -36,6 +36,9 @@ class CefMenuModelDelegateCToCpp void ExecuteCommand(CefRefPtr menu_model, int command_id, cef_event_flags_t event_flags) override; void MenuWillShow(CefRefPtr menu_model) override; + void MenuClosed(CefRefPtr menu_model) override; + bool FormatLabel(CefRefPtr menu_model, + CefString& label) override; }; #endif // BUILDING_CEF_SHARED diff --git a/tools/cef_parser.py b/tools/cef_parser.py index cfd736877..8d354c882 100644 --- a/tools/cef_parser.py +++ b/tools/cef_parser.py @@ -584,7 +584,7 @@ class obj_header: '\nclass'+_cre_space+_cre_cfname+_cre_space+ ':'+_cre_space+'public'+_cre_virtual+ _cre_space+_cre_cfname+_cre_space+ - '{(.*?)};', re.MULTILINE | re.DOTALL) + '{(.*?)\n};', re.MULTILINE | re.DOTALL) list = p.findall(data) if len(list) > 0: added = True