Fix CefMenuModelDelegate methods missing from the CAPI (issue #2006)

This commit is contained in:
Marshall Greenblatt 2016-10-28 13:17:32 -04:00
parent 4adaa2b552
commit e39accd266
6 changed files with 108 additions and 4 deletions

View File

@ -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;

View File

@ -63,20 +63,20 @@ class CefMenuModelDelegate : public virtual CefBase {
// The menu is about to show.
///
/*--cef()--*/
virtual void MenuWillShow(CefRefPtr<CefMenuModel> menu_model) {};
virtual void MenuWillShow(CefRefPtr<CefMenuModel> menu_model) {}
///
// The menu has closed.
///
/*--cef()--*/
virtual void MenuClosed(CefRefPtr<CefMenuModel> menu_model) {};
virtual void MenuClosed(CefRefPtr<CefMenuModel> menu_model) {}
///
// Optionally modify a menu item label. Return true if |label| was modified.
///
/*--cef()--*/
virtual bool FormatLabel(CefRefPtr<CefMenuModel> menu_model,
CefString& label) { return false; };
CefString& label) { return false; }
};
#endif // CEF_INCLUDE_VIEWS_CEF_MENU_MODEL_DELEGATE_H_

View File

@ -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<CefMenuModelDelegate> CefCppToC<CefMenuModelDelegateCppToC,

View File

@ -55,6 +55,46 @@ void CefMenuModelDelegateCToCpp::MenuWillShow(
CefMenuModelCppToC::Wrap(menu_model));
}
void CefMenuModelDelegateCToCpp::MenuClosed(
CefRefPtr<CefMenuModel> 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<CefMenuModel> 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.

View File

@ -36,6 +36,9 @@ class CefMenuModelDelegateCToCpp
void ExecuteCommand(CefRefPtr<CefMenuModel> menu_model, int command_id,
cef_event_flags_t event_flags) override;
void MenuWillShow(CefRefPtr<CefMenuModel> menu_model) override;
void MenuClosed(CefRefPtr<CefMenuModel> menu_model) override;
bool FormatLabel(CefRefPtr<CefMenuModel> menu_model,
CefString& label) override;
};
#endif // BUILDING_CEF_SHARED

View File

@ -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