Add context menu support (issue #509):

- Add new CefContextMenuHandler, CefContextMenuParams and CefMenuModel classes.
- Add cef_strings.grd and related infrastructure for supporting translation of CEF strings.
- Generate include/cef_pack_resources.h and include/cef_pack_strings.h files at build time that include all IDs used by CEF pack files.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@595 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2012-04-19 20:31:46 +00:00
parent 07bba96106
commit 7bc494880f
52 changed files with 6578 additions and 36 deletions

View File

@@ -13,6 +13,7 @@
#include "libcef_dll/cpptoc/browser_cpptoc.h"
#include "libcef_dll/cpptoc/process_message_cpptoc.h"
#include "libcef_dll/ctocpp/client_ctocpp.h"
#include "libcef_dll/ctocpp/context_menu_handler_ctocpp.h"
#include "libcef_dll/ctocpp/display_handler_ctocpp.h"
#include "libcef_dll/ctocpp/geolocation_handler_ctocpp.h"
#include "libcef_dll/ctocpp/jsdialog_handler_ctocpp.h"
@@ -102,6 +103,20 @@ CefRefPtr<CefJSDialogHandler> CefClientCToCpp::GetJSDialogHandler() {
return CefJSDialogHandlerCToCpp::Wrap(_retval);
}
CefRefPtr<CefContextMenuHandler> CefClientCToCpp::GetContextMenuHandler() {
if (CEF_MEMBER_MISSING(struct_, get_context_menu_handler))
return NULL;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_context_menu_handler_t* _retval = struct_->get_context_menu_handler(
struct_);
// Return type: refptr_same
return CefContextMenuHandlerCToCpp::Wrap(_retval);
}
bool CefClientCToCpp::OnProcessMessageRecieved(CefRefPtr<CefBrowser> browser,
CefProcessId source_process, CefRefPtr<CefProcessMessage> message) {
if (CEF_MEMBER_MISSING(struct_, on_process_message_recieved))

View File

@@ -38,6 +38,7 @@ class CefClientCToCpp
virtual CefRefPtr<CefDisplayHandler> GetDisplayHandler() OVERRIDE;
virtual CefRefPtr<CefGeolocationHandler> GetGeolocationHandler() OVERRIDE;
virtual CefRefPtr<CefJSDialogHandler> GetJSDialogHandler() OVERRIDE;
virtual CefRefPtr<CefContextMenuHandler> GetContextMenuHandler() OVERRIDE;
virtual bool OnProcessMessageRecieved(CefRefPtr<CefBrowser> browser,
CefProcessId source_process,
CefRefPtr<CefProcessMessage> message) OVERRIDE;

View File

@@ -0,0 +1,116 @@
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/cpptoc/browser_cpptoc.h"
#include "libcef_dll/cpptoc/context_menu_params_cpptoc.h"
#include "libcef_dll/cpptoc/frame_cpptoc.h"
#include "libcef_dll/cpptoc/menu_model_cpptoc.h"
#include "libcef_dll/ctocpp/context_menu_handler_ctocpp.h"
// VIRTUAL METHODS - Body may be edited by hand.
void CefContextMenuHandlerCToCpp::OnBeforeContextMenu(
CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame,
CefRefPtr<CefContextMenuParams> params, CefRefPtr<CefMenuModel> model) {
if (CEF_MEMBER_MISSING(struct_, on_before_context_menu))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: browser; type: refptr_diff
DCHECK(browser.get());
if (!browser.get())
return;
// Verify param: frame; type: refptr_diff
DCHECK(frame.get());
if (!frame.get())
return;
// Verify param: params; type: refptr_diff
DCHECK(params.get());
if (!params.get())
return;
// Verify param: model; type: refptr_diff
DCHECK(model.get());
if (!model.get())
return;
// Execute
struct_->on_before_context_menu(struct_,
CefBrowserCppToC::Wrap(browser),
CefFrameCppToC::Wrap(frame),
CefContextMenuParamsCppToC::Wrap(params),
CefMenuModelCppToC::Wrap(model));
}
bool CefContextMenuHandlerCToCpp::OnContextMenuCommand(
CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame,
CefRefPtr<CefContextMenuParams> params, int command_id,
EventFlags event_flags) {
if (CEF_MEMBER_MISSING(struct_, on_context_menu_command))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: browser; type: refptr_diff
DCHECK(browser.get());
if (!browser.get())
return false;
// Verify param: frame; type: refptr_diff
DCHECK(frame.get());
if (!frame.get())
return false;
// Verify param: params; type: refptr_diff
DCHECK(params.get());
if (!params.get())
return false;
// Execute
int _retval = struct_->on_context_menu_command(struct_,
CefBrowserCppToC::Wrap(browser),
CefFrameCppToC::Wrap(frame),
CefContextMenuParamsCppToC::Wrap(params),
command_id,
event_flags);
// Return type: bool
return _retval?true:false;
}
void CefContextMenuHandlerCToCpp::OnContextMenuDismissed(
CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame) {
if (CEF_MEMBER_MISSING(struct_, on_context_menu_dismissed))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: browser; type: refptr_diff
DCHECK(browser.get());
if (!browser.get())
return;
// Verify param: frame; type: refptr_diff
DCHECK(frame.get());
if (!frame.get())
return;
// Execute
struct_->on_context_menu_dismissed(struct_,
CefBrowserCppToC::Wrap(browser),
CefFrameCppToC::Wrap(frame));
}
#ifndef NDEBUG
template<> long CefCToCpp<CefContextMenuHandlerCToCpp, CefContextMenuHandler,
cef_context_menu_handler_t>::DebugObjCt = 0;
#endif

View File

@@ -0,0 +1,49 @@
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_CONTEXT_MENU_HANDLER_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_CONTEXT_MENU_HANDLER_CTOCPP_H_
#pragma once
#ifndef BUILDING_CEF_SHARED
#pragma message("Warning: "__FILE__" may be accessed DLL-side only")
#else // BUILDING_CEF_SHARED
#include "include/cef_context_menu_handler.h"
#include "include/capi/cef_context_menu_handler_capi.h"
#include "libcef_dll/ctocpp/ctocpp.h"
// Wrap a C structure with a C++ class.
// This class may be instantiated and accessed DLL-side only.
class CefContextMenuHandlerCToCpp
: public CefCToCpp<CefContextMenuHandlerCToCpp, CefContextMenuHandler,
cef_context_menu_handler_t> {
public:
explicit CefContextMenuHandlerCToCpp(cef_context_menu_handler_t* str)
: CefCToCpp<CefContextMenuHandlerCToCpp, CefContextMenuHandler,
cef_context_menu_handler_t>(str) {}
virtual ~CefContextMenuHandlerCToCpp() {}
// CefContextMenuHandler methods
virtual void OnBeforeContextMenu(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame, CefRefPtr<CefContextMenuParams> params,
CefRefPtr<CefMenuModel> model) OVERRIDE;
virtual bool OnContextMenuCommand(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame, CefRefPtr<CefContextMenuParams> params,
int command_id, EventFlags event_flags) OVERRIDE;
virtual void OnContextMenuDismissed(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame) OVERRIDE;
};
#endif // BUILDING_CEF_SHARED
#endif // CEF_LIBCEF_DLL_CTOCPP_CONTEXT_MENU_HANDLER_CTOCPP_H_

View File

@@ -0,0 +1,249 @@
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/ctocpp/context_menu_params_ctocpp.h"
// VIRTUAL METHODS - Body may be edited by hand.
int CefContextMenuParamsCToCpp::GetXCoord() {
if (CEF_MEMBER_MISSING(struct_, get_xcoord))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->get_xcoord(struct_);
// Return type: simple
return _retval;
}
int CefContextMenuParamsCToCpp::GetYCoord() {
if (CEF_MEMBER_MISSING(struct_, get_ycoord))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->get_ycoord(struct_);
// Return type: simple
return _retval;
}
CefContextMenuParams::TypeFlags CefContextMenuParamsCToCpp::GetTypeFlags() {
if (CEF_MEMBER_MISSING(struct_, get_type_flags))
return CM_TYPEFLAG_NONE;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_context_menu_type_flags_t _retval = struct_->get_type_flags(struct_);
// Return type: simple
return _retval;
}
CefString CefContextMenuParamsCToCpp::GetLinkUrl() {
if (CEF_MEMBER_MISSING(struct_, get_link_url))
return CefString();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_string_userfree_t _retval = struct_->get_link_url(struct_);
// Return type: string
CefString _retvalStr;
_retvalStr.AttachToUserFree(_retval);
return _retvalStr;
}
CefString CefContextMenuParamsCToCpp::GetUnfilteredLinkUrl() {
if (CEF_MEMBER_MISSING(struct_, get_unfiltered_link_url))
return CefString();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_string_userfree_t _retval = struct_->get_unfiltered_link_url(struct_);
// Return type: string
CefString _retvalStr;
_retvalStr.AttachToUserFree(_retval);
return _retvalStr;
}
CefString CefContextMenuParamsCToCpp::GetSourceUrl() {
if (CEF_MEMBER_MISSING(struct_, get_source_url))
return CefString();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_string_userfree_t _retval = struct_->get_source_url(struct_);
// Return type: string
CefString _retvalStr;
_retvalStr.AttachToUserFree(_retval);
return _retvalStr;
}
bool CefContextMenuParamsCToCpp::IsImageBlocked() {
if (CEF_MEMBER_MISSING(struct_, is_image_blocked))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->is_image_blocked(struct_);
// Return type: bool
return _retval?true:false;
}
CefString CefContextMenuParamsCToCpp::GetPageUrl() {
if (CEF_MEMBER_MISSING(struct_, get_page_url))
return CefString();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_string_userfree_t _retval = struct_->get_page_url(struct_);
// Return type: string
CefString _retvalStr;
_retvalStr.AttachToUserFree(_retval);
return _retvalStr;
}
CefString CefContextMenuParamsCToCpp::GetFrameUrl() {
if (CEF_MEMBER_MISSING(struct_, get_frame_url))
return CefString();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_string_userfree_t _retval = struct_->get_frame_url(struct_);
// Return type: string
CefString _retvalStr;
_retvalStr.AttachToUserFree(_retval);
return _retvalStr;
}
CefString CefContextMenuParamsCToCpp::GetFrameCharset() {
if (CEF_MEMBER_MISSING(struct_, get_frame_charset))
return CefString();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_string_userfree_t _retval = struct_->get_frame_charset(struct_);
// Return type: string
CefString _retvalStr;
_retvalStr.AttachToUserFree(_retval);
return _retvalStr;
}
CefContextMenuParams::MediaType CefContextMenuParamsCToCpp::GetMediaType() {
if (CEF_MEMBER_MISSING(struct_, get_media_type))
return CM_MEDIATYPE_NONE;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_context_menu_media_type_t _retval = struct_->get_media_type(struct_);
// Return type: simple
return _retval;
}
CefContextMenuParams::MediaStateFlags CefContextMenuParamsCToCpp::GetMediaStateFlags(
) {
if (CEF_MEMBER_MISSING(struct_, get_media_state_flags))
return CM_MEDIAFLAG_NONE;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_context_menu_media_state_flags_t _retval = struct_->get_media_state_flags(
struct_);
// Return type: simple
return _retval;
}
CefString CefContextMenuParamsCToCpp::GetSelectionText() {
if (CEF_MEMBER_MISSING(struct_, get_selection_text))
return CefString();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_string_userfree_t _retval = struct_->get_selection_text(struct_);
// Return type: string
CefString _retvalStr;
_retvalStr.AttachToUserFree(_retval);
return _retvalStr;
}
bool CefContextMenuParamsCToCpp::IsEditable() {
if (CEF_MEMBER_MISSING(struct_, is_editable))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->is_editable(struct_);
// Return type: bool
return _retval?true:false;
}
bool CefContextMenuParamsCToCpp::IsSpeechInputEnabled() {
if (CEF_MEMBER_MISSING(struct_, is_speech_input_enabled))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->is_speech_input_enabled(struct_);
// Return type: bool
return _retval?true:false;
}
CefContextMenuParams::EditStateFlags CefContextMenuParamsCToCpp::GetEditStateFlags(
) {
if (CEF_MEMBER_MISSING(struct_, get_edit_state_flags))
return CM_EDITFLAG_NONE;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_context_menu_edit_state_flags_t _retval = struct_->get_edit_state_flags(
struct_);
// Return type: simple
return _retval;
}
#ifndef NDEBUG
template<> long CefCToCpp<CefContextMenuParamsCToCpp, CefContextMenuParams,
cef_context_menu_params_t>::DebugObjCt = 0;
#endif

View File

@@ -0,0 +1,57 @@
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_CONTEXT_MENU_PARAMS_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_CONTEXT_MENU_PARAMS_CTOCPP_H_
#pragma once
#ifndef USING_CEF_SHARED
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
#else // USING_CEF_SHARED
#include "include/cef_context_menu_handler.h"
#include "include/capi/cef_context_menu_handler_capi.h"
#include "libcef_dll/ctocpp/ctocpp.h"
// Wrap a C structure with a C++ class.
// This class may be instantiated and accessed wrapper-side only.
class CefContextMenuParamsCToCpp
: public CefCToCpp<CefContextMenuParamsCToCpp, CefContextMenuParams,
cef_context_menu_params_t> {
public:
explicit CefContextMenuParamsCToCpp(cef_context_menu_params_t* str)
: CefCToCpp<CefContextMenuParamsCToCpp, CefContextMenuParams,
cef_context_menu_params_t>(str) {}
virtual ~CefContextMenuParamsCToCpp() {}
// CefContextMenuParams methods
virtual int GetXCoord() OVERRIDE;
virtual int GetYCoord() OVERRIDE;
virtual TypeFlags GetTypeFlags() OVERRIDE;
virtual CefString GetLinkUrl() OVERRIDE;
virtual CefString GetUnfilteredLinkUrl() OVERRIDE;
virtual CefString GetSourceUrl() OVERRIDE;
virtual bool IsImageBlocked() OVERRIDE;
virtual CefString GetPageUrl() OVERRIDE;
virtual CefString GetFrameUrl() OVERRIDE;
virtual CefString GetFrameCharset() OVERRIDE;
virtual MediaType GetMediaType() OVERRIDE;
virtual MediaStateFlags GetMediaStateFlags() OVERRIDE;
virtual CefString GetSelectionText() OVERRIDE;
virtual bool IsEditable() OVERRIDE;
virtual bool IsSpeechInputEnabled() OVERRIDE;
virtual EditStateFlags GetEditStateFlags() OVERRIDE;
};
#endif // USING_CEF_SHARED
#endif // CEF_LIBCEF_DLL_CTOCPP_CONTEXT_MENU_PARAMS_CTOCPP_H_

View File

@@ -0,0 +1,839 @@
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/ctocpp/menu_model_ctocpp.h"
// VIRTUAL METHODS - Body may be edited by hand.
bool CefMenuModelCToCpp::Clear() {
if (CEF_MEMBER_MISSING(struct_, clear))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->clear(struct_);
// Return type: bool
return _retval?true:false;
}
int CefMenuModelCToCpp::GetCount() {
if (CEF_MEMBER_MISSING(struct_, get_count))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->get_count(struct_);
// Return type: simple
return _retval;
}
bool CefMenuModelCToCpp::AddSeparator() {
if (CEF_MEMBER_MISSING(struct_, add_separator))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->add_separator(struct_);
// Return type: bool
return _retval?true:false;
}
bool CefMenuModelCToCpp::AddItem(int command_id, const CefString& label) {
if (CEF_MEMBER_MISSING(struct_, add_item))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: label; type: string_byref_const
DCHECK(!label.empty());
if (label.empty())
return false;
// Execute
int _retval = struct_->add_item(struct_,
command_id,
label.GetStruct());
// Return type: bool
return _retval?true:false;
}
bool CefMenuModelCToCpp::AddCheckItem(int command_id, const CefString& label) {
if (CEF_MEMBER_MISSING(struct_, add_check_item))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: label; type: string_byref_const
DCHECK(!label.empty());
if (label.empty())
return false;
// Execute
int _retval = struct_->add_check_item(struct_,
command_id,
label.GetStruct());
// Return type: bool
return _retval?true:false;
}
bool CefMenuModelCToCpp::AddRadioItem(int command_id, const CefString& label,
int group_id) {
if (CEF_MEMBER_MISSING(struct_, add_radio_item))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: label; type: string_byref_const
DCHECK(!label.empty());
if (label.empty())
return false;
// Execute
int _retval = struct_->add_radio_item(struct_,
command_id,
label.GetStruct(),
group_id);
// Return type: bool
return _retval?true:false;
}
CefRefPtr<CefMenuModel> CefMenuModelCToCpp::AddSubMenu(int command_id,
const CefString& label) {
if (CEF_MEMBER_MISSING(struct_, add_sub_menu))
return NULL;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: label; type: string_byref_const
DCHECK(!label.empty());
if (label.empty())
return NULL;
// Execute
cef_menu_model_t* _retval = struct_->add_sub_menu(struct_,
command_id,
label.GetStruct());
// Return type: refptr_same
return CefMenuModelCToCpp::Wrap(_retval);
}
bool CefMenuModelCToCpp::InsertSeparatorAt(int index) {
if (CEF_MEMBER_MISSING(struct_, insert_separator_at))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->insert_separator_at(struct_,
index);
// Return type: bool
return _retval?true:false;
}
bool CefMenuModelCToCpp::InsertItemAt(int index, int command_id,
const CefString& label) {
if (CEF_MEMBER_MISSING(struct_, insert_item_at))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: label; type: string_byref_const
DCHECK(!label.empty());
if (label.empty())
return false;
// Execute
int _retval = struct_->insert_item_at(struct_,
index,
command_id,
label.GetStruct());
// Return type: bool
return _retval?true:false;
}
bool CefMenuModelCToCpp::InsertCheckItemAt(int index, int command_id,
const CefString& label) {
if (CEF_MEMBER_MISSING(struct_, insert_check_item_at))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: label; type: string_byref_const
DCHECK(!label.empty());
if (label.empty())
return false;
// Execute
int _retval = struct_->insert_check_item_at(struct_,
index,
command_id,
label.GetStruct());
// Return type: bool
return _retval?true:false;
}
bool CefMenuModelCToCpp::InsertRadioItemAt(int index, int command_id,
const CefString& label, int group_id) {
if (CEF_MEMBER_MISSING(struct_, insert_radio_item_at))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: label; type: string_byref_const
DCHECK(!label.empty());
if (label.empty())
return false;
// Execute
int _retval = struct_->insert_radio_item_at(struct_,
index,
command_id,
label.GetStruct(),
group_id);
// Return type: bool
return _retval?true:false;
}
CefRefPtr<CefMenuModel> CefMenuModelCToCpp::InsertSubMenuAt(int index,
int command_id, const CefString& label) {
if (CEF_MEMBER_MISSING(struct_, insert_sub_menu_at))
return NULL;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: label; type: string_byref_const
DCHECK(!label.empty());
if (label.empty())
return NULL;
// Execute
cef_menu_model_t* _retval = struct_->insert_sub_menu_at(struct_,
index,
command_id,
label.GetStruct());
// Return type: refptr_same
return CefMenuModelCToCpp::Wrap(_retval);
}
bool CefMenuModelCToCpp::Remove(int command_id) {
if (CEF_MEMBER_MISSING(struct_, remove))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->remove(struct_,
command_id);
// Return type: bool
return _retval?true:false;
}
bool CefMenuModelCToCpp::RemoveAt(int index) {
if (CEF_MEMBER_MISSING(struct_, remove_at))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->remove_at(struct_,
index);
// Return type: bool
return _retval?true:false;
}
int CefMenuModelCToCpp::GetIndexOf(int command_id) {
if (CEF_MEMBER_MISSING(struct_, get_index_of))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->get_index_of(struct_,
command_id);
// Return type: simple
return _retval;
}
int CefMenuModelCToCpp::GetCommandIdAt(int index) {
if (CEF_MEMBER_MISSING(struct_, get_command_id_at))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->get_command_id_at(struct_,
index);
// Return type: simple
return _retval;
}
bool CefMenuModelCToCpp::SetCommandIdAt(int index, int command_id) {
if (CEF_MEMBER_MISSING(struct_, set_command_id_at))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->set_command_id_at(struct_,
index,
command_id);
// Return type: bool
return _retval?true:false;
}
CefString CefMenuModelCToCpp::GetLabel(int command_id) {
if (CEF_MEMBER_MISSING(struct_, get_label))
return CefString();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_string_userfree_t _retval = struct_->get_label(struct_,
command_id);
// Return type: string
CefString _retvalStr;
_retvalStr.AttachToUserFree(_retval);
return _retvalStr;
}
CefString CefMenuModelCToCpp::GetLabelAt(int index) {
if (CEF_MEMBER_MISSING(struct_, get_label_at))
return CefString();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_string_userfree_t _retval = struct_->get_label_at(struct_,
index);
// Return type: string
CefString _retvalStr;
_retvalStr.AttachToUserFree(_retval);
return _retvalStr;
}
bool CefMenuModelCToCpp::SetLabel(int command_id, const CefString& label) {
if (CEF_MEMBER_MISSING(struct_, set_label))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: label; type: string_byref_const
DCHECK(!label.empty());
if (label.empty())
return false;
// Execute
int _retval = struct_->set_label(struct_,
command_id,
label.GetStruct());
// Return type: bool
return _retval?true:false;
}
bool CefMenuModelCToCpp::SetLabelAt(int index, const CefString& label) {
if (CEF_MEMBER_MISSING(struct_, set_label_at))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: label; type: string_byref_const
DCHECK(!label.empty());
if (label.empty())
return false;
// Execute
int _retval = struct_->set_label_at(struct_,
index,
label.GetStruct());
// Return type: bool
return _retval?true:false;
}
CefMenuModel::MenuItemType CefMenuModelCToCpp::GetType(int command_id) {
if (CEF_MEMBER_MISSING(struct_, get_type))
return MENUITEMTYPE_NONE;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_menu_item_type_t _retval = struct_->get_type(struct_,
command_id);
// Return type: simple
return _retval;
}
CefMenuModel::MenuItemType CefMenuModelCToCpp::GetTypeAt(int index) {
if (CEF_MEMBER_MISSING(struct_, get_type_at))
return MENUITEMTYPE_NONE;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_menu_item_type_t _retval = struct_->get_type_at(struct_,
index);
// Return type: simple
return _retval;
}
int CefMenuModelCToCpp::GetGroupId(int command_id) {
if (CEF_MEMBER_MISSING(struct_, get_group_id))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->get_group_id(struct_,
command_id);
// Return type: simple
return _retval;
}
int CefMenuModelCToCpp::GetGroupIdAt(int index) {
if (CEF_MEMBER_MISSING(struct_, get_group_id_at))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->get_group_id_at(struct_,
index);
// Return type: simple
return _retval;
}
bool CefMenuModelCToCpp::SetGroupId(int command_id, int group_id) {
if (CEF_MEMBER_MISSING(struct_, set_group_id))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->set_group_id(struct_,
command_id,
group_id);
// Return type: bool
return _retval?true:false;
}
bool CefMenuModelCToCpp::SetGroupIdAt(int index, int group_id) {
if (CEF_MEMBER_MISSING(struct_, set_group_id_at))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->set_group_id_at(struct_,
index,
group_id);
// Return type: bool
return _retval?true:false;
}
CefRefPtr<CefMenuModel> CefMenuModelCToCpp::GetSubMenu(int command_id) {
if (CEF_MEMBER_MISSING(struct_, get_sub_menu))
return NULL;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_menu_model_t* _retval = struct_->get_sub_menu(struct_,
command_id);
// Return type: refptr_same
return CefMenuModelCToCpp::Wrap(_retval);
}
CefRefPtr<CefMenuModel> CefMenuModelCToCpp::GetSubMenuAt(int index) {
if (CEF_MEMBER_MISSING(struct_, get_sub_menu_at))
return NULL;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_menu_model_t* _retval = struct_->get_sub_menu_at(struct_,
index);
// Return type: refptr_same
return CefMenuModelCToCpp::Wrap(_retval);
}
bool CefMenuModelCToCpp::IsVisible(int command_id) {
if (CEF_MEMBER_MISSING(struct_, is_visible))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->is_visible(struct_,
command_id);
// Return type: bool
return _retval?true:false;
}
bool CefMenuModelCToCpp::IsVisibleAt(int index) {
if (CEF_MEMBER_MISSING(struct_, is_visible_at))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->is_visible_at(struct_,
index);
// Return type: bool
return _retval?true:false;
}
bool CefMenuModelCToCpp::SetVisible(int command_id, bool visible) {
if (CEF_MEMBER_MISSING(struct_, set_visible))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->set_visible(struct_,
command_id,
visible);
// Return type: bool
return _retval?true:false;
}
bool CefMenuModelCToCpp::SetVisibleAt(int index, bool visible) {
if (CEF_MEMBER_MISSING(struct_, set_visible_at))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->set_visible_at(struct_,
index,
visible);
// Return type: bool
return _retval?true:false;
}
bool CefMenuModelCToCpp::IsEnabled(int command_id) {
if (CEF_MEMBER_MISSING(struct_, is_enabled))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->is_enabled(struct_,
command_id);
// Return type: bool
return _retval?true:false;
}
bool CefMenuModelCToCpp::IsEnabledAt(int index) {
if (CEF_MEMBER_MISSING(struct_, is_enabled_at))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->is_enabled_at(struct_,
index);
// Return type: bool
return _retval?true:false;
}
bool CefMenuModelCToCpp::SetEnabled(int command_id, bool enabled) {
if (CEF_MEMBER_MISSING(struct_, set_enabled))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->set_enabled(struct_,
command_id,
enabled);
// Return type: bool
return _retval?true:false;
}
bool CefMenuModelCToCpp::SetEnabledAt(int index, bool enabled) {
if (CEF_MEMBER_MISSING(struct_, set_enabled_at))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->set_enabled_at(struct_,
index,
enabled);
// Return type: bool
return _retval?true:false;
}
bool CefMenuModelCToCpp::IsChecked(int command_id) {
if (CEF_MEMBER_MISSING(struct_, is_checked))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->is_checked(struct_,
command_id);
// Return type: bool
return _retval?true:false;
}
bool CefMenuModelCToCpp::IsCheckedAt(int index) {
if (CEF_MEMBER_MISSING(struct_, is_checked_at))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->is_checked_at(struct_,
index);
// Return type: bool
return _retval?true:false;
}
bool CefMenuModelCToCpp::SetChecked(int command_id, bool checked) {
if (CEF_MEMBER_MISSING(struct_, set_checked))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->set_checked(struct_,
command_id,
checked);
// Return type: bool
return _retval?true:false;
}
bool CefMenuModelCToCpp::SetCheckedAt(int index, bool checked) {
if (CEF_MEMBER_MISSING(struct_, set_checked_at))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->set_checked_at(struct_,
index,
checked);
// Return type: bool
return _retval?true:false;
}
bool CefMenuModelCToCpp::HasAccelerator(int command_id) {
if (CEF_MEMBER_MISSING(struct_, has_accelerator))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->has_accelerator(struct_,
command_id);
// Return type: bool
return _retval?true:false;
}
bool CefMenuModelCToCpp::HasAcceleratorAt(int index) {
if (CEF_MEMBER_MISSING(struct_, has_accelerator_at))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->has_accelerator_at(struct_,
index);
// Return type: bool
return _retval?true:false;
}
bool CefMenuModelCToCpp::SetAccelerator(int command_id, int key_code,
bool shift_pressed, bool ctrl_pressed, bool alt_pressed) {
if (CEF_MEMBER_MISSING(struct_, set_accelerator))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->set_accelerator(struct_,
command_id,
key_code,
shift_pressed,
ctrl_pressed,
alt_pressed);
// Return type: bool
return _retval?true:false;
}
bool CefMenuModelCToCpp::SetAcceleratorAt(int index, int key_code,
bool shift_pressed, bool ctrl_pressed, bool alt_pressed) {
if (CEF_MEMBER_MISSING(struct_, set_accelerator_at))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->set_accelerator_at(struct_,
index,
key_code,
shift_pressed,
ctrl_pressed,
alt_pressed);
// Return type: bool
return _retval?true:false;
}
bool CefMenuModelCToCpp::RemoveAccelerator(int command_id) {
if (CEF_MEMBER_MISSING(struct_, remove_accelerator))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->remove_accelerator(struct_,
command_id);
// Return type: bool
return _retval?true:false;
}
bool CefMenuModelCToCpp::RemoveAcceleratorAt(int index) {
if (CEF_MEMBER_MISSING(struct_, remove_accelerator_at))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = struct_->remove_accelerator_at(struct_,
index);
// Return type: bool
return _retval?true:false;
}
bool CefMenuModelCToCpp::GetAccelerator(int command_id, int& key_code,
bool& shift_pressed, bool& ctrl_pressed, bool& alt_pressed) {
if (CEF_MEMBER_MISSING(struct_, get_accelerator))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Translate param: shift_pressed; type: bool_byref
int shift_pressedInt = shift_pressed;
// Translate param: ctrl_pressed; type: bool_byref
int ctrl_pressedInt = ctrl_pressed;
// Translate param: alt_pressed; type: bool_byref
int alt_pressedInt = alt_pressed;
// Execute
int _retval = struct_->get_accelerator(struct_,
command_id,
&key_code,
&shift_pressedInt,
&ctrl_pressedInt,
&alt_pressedInt);
// Restore param:shift_pressed; type: bool_byref
shift_pressed = shift_pressedInt?true:false;
// Restore param:ctrl_pressed; type: bool_byref
ctrl_pressed = ctrl_pressedInt?true:false;
// Restore param:alt_pressed; type: bool_byref
alt_pressed = alt_pressedInt?true:false;
// Return type: bool
return _retval?true:false;
}
bool CefMenuModelCToCpp::GetAcceleratorAt(int index, int& key_code,
bool& shift_pressed, bool& ctrl_pressed, bool& alt_pressed) {
if (CEF_MEMBER_MISSING(struct_, get_accelerator_at))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Translate param: shift_pressed; type: bool_byref
int shift_pressedInt = shift_pressed;
// Translate param: ctrl_pressed; type: bool_byref
int ctrl_pressedInt = ctrl_pressed;
// Translate param: alt_pressed; type: bool_byref
int alt_pressedInt = alt_pressed;
// Execute
int _retval = struct_->get_accelerator_at(struct_,
index,
&key_code,
&shift_pressedInt,
&ctrl_pressedInt,
&alt_pressedInt);
// Restore param:shift_pressed; type: bool_byref
shift_pressed = shift_pressedInt?true:false;
// Restore param:ctrl_pressed; type: bool_byref
ctrl_pressed = ctrl_pressedInt?true:false;
// Restore param:alt_pressed; type: bool_byref
alt_pressed = alt_pressedInt?true:false;
// Return type: bool
return _retval?true:false;
}
#ifndef NDEBUG
template<> long CefCToCpp<CefMenuModelCToCpp, CefMenuModel,
cef_menu_model_t>::DebugObjCt = 0;
#endif

View File

@@ -0,0 +1,98 @@
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_MENU_MODEL_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_MENU_MODEL_CTOCPP_H_
#pragma once
#ifndef USING_CEF_SHARED
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
#else // USING_CEF_SHARED
#include "include/cef_menu_model.h"
#include "include/capi/cef_menu_model_capi.h"
#include "libcef_dll/ctocpp/ctocpp.h"
// Wrap a C structure with a C++ class.
// This class may be instantiated and accessed wrapper-side only.
class CefMenuModelCToCpp
: public CefCToCpp<CefMenuModelCToCpp, CefMenuModel, cef_menu_model_t> {
public:
explicit CefMenuModelCToCpp(cef_menu_model_t* str)
: CefCToCpp<CefMenuModelCToCpp, CefMenuModel, cef_menu_model_t>(str) {}
virtual ~CefMenuModelCToCpp() {}
// CefMenuModel methods
virtual bool Clear() OVERRIDE;
virtual int GetCount() OVERRIDE;
virtual bool AddSeparator() OVERRIDE;
virtual bool AddItem(int command_id, const CefString& label) OVERRIDE;
virtual bool AddCheckItem(int command_id, const CefString& label) OVERRIDE;
virtual bool AddRadioItem(int command_id, const CefString& label,
int group_id) OVERRIDE;
virtual CefRefPtr<CefMenuModel> AddSubMenu(int command_id,
const CefString& label) OVERRIDE;
virtual bool InsertSeparatorAt(int index) OVERRIDE;
virtual bool InsertItemAt(int index, int command_id,
const CefString& label) OVERRIDE;
virtual bool InsertCheckItemAt(int index, int command_id,
const CefString& label) OVERRIDE;
virtual bool InsertRadioItemAt(int index, int command_id,
const CefString& label, int group_id) OVERRIDE;
virtual CefRefPtr<CefMenuModel> InsertSubMenuAt(int index, int command_id,
const CefString& label) OVERRIDE;
virtual bool Remove(int command_id) OVERRIDE;
virtual bool RemoveAt(int index) OVERRIDE;
virtual int GetIndexOf(int command_id) OVERRIDE;
virtual int GetCommandIdAt(int index) OVERRIDE;
virtual bool SetCommandIdAt(int index, int command_id) OVERRIDE;
virtual CefString GetLabel(int command_id) OVERRIDE;
virtual CefString GetLabelAt(int index) OVERRIDE;
virtual bool SetLabel(int command_id, const CefString& label) OVERRIDE;
virtual bool SetLabelAt(int index, const CefString& label) OVERRIDE;
virtual MenuItemType GetType(int command_id) OVERRIDE;
virtual MenuItemType GetTypeAt(int index) OVERRIDE;
virtual int GetGroupId(int command_id) OVERRIDE;
virtual int GetGroupIdAt(int index) OVERRIDE;
virtual bool SetGroupId(int command_id, int group_id) OVERRIDE;
virtual bool SetGroupIdAt(int index, int group_id) OVERRIDE;
virtual CefRefPtr<CefMenuModel> GetSubMenu(int command_id) OVERRIDE;
virtual CefRefPtr<CefMenuModel> GetSubMenuAt(int index) OVERRIDE;
virtual bool IsVisible(int command_id) OVERRIDE;
virtual bool IsVisibleAt(int index) OVERRIDE;
virtual bool SetVisible(int command_id, bool visible) OVERRIDE;
virtual bool SetVisibleAt(int index, bool visible) OVERRIDE;
virtual bool IsEnabled(int command_id) OVERRIDE;
virtual bool IsEnabledAt(int index) OVERRIDE;
virtual bool SetEnabled(int command_id, bool enabled) OVERRIDE;
virtual bool SetEnabledAt(int index, bool enabled) OVERRIDE;
virtual bool IsChecked(int command_id) OVERRIDE;
virtual bool IsCheckedAt(int index) OVERRIDE;
virtual bool SetChecked(int command_id, bool checked) OVERRIDE;
virtual bool SetCheckedAt(int index, bool checked) OVERRIDE;
virtual bool HasAccelerator(int command_id) OVERRIDE;
virtual bool HasAcceleratorAt(int index) OVERRIDE;
virtual bool SetAccelerator(int command_id, int key_code, bool shift_pressed,
bool ctrl_pressed, bool alt_pressed) OVERRIDE;
virtual bool SetAcceleratorAt(int index, int key_code, bool shift_pressed,
bool ctrl_pressed, bool alt_pressed) OVERRIDE;
virtual bool RemoveAccelerator(int command_id) OVERRIDE;
virtual bool RemoveAcceleratorAt(int index) OVERRIDE;
virtual bool GetAccelerator(int command_id, int& key_code,
bool& shift_pressed, bool& ctrl_pressed, bool& alt_pressed) OVERRIDE;
virtual bool GetAcceleratorAt(int index, int& key_code, bool& shift_pressed,
bool& ctrl_pressed, bool& alt_pressed) OVERRIDE;
};
#endif // USING_CEF_SHARED
#endif // CEF_LIBCEF_DLL_CTOCPP_MENU_MODEL_CTOCPP_H_