mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-02-02 12:17:15 +01:00
Revert the CefMenuModel separator changes added in revision 747.
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@749 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
2e83d58814
commit
e99d9c86a6
@ -70,8 +70,7 @@ typedef struct _cef_menu_model_t {
|
||||
//
|
||||
// Add a separator to the menu. Returns true (1) on success.
|
||||
///
|
||||
int (CEF_CALLBACK *add_separator)(struct _cef_menu_model_t* self,
|
||||
enum cef_menu_separator_type_t type);
|
||||
int (CEF_CALLBACK *add_separator)(struct _cef_menu_model_t* self);
|
||||
|
||||
//
|
||||
// Add an item to the menu. Returns true (1) on success.
|
||||
@ -104,7 +103,7 @@ typedef struct _cef_menu_model_t {
|
||||
// on success.
|
||||
///
|
||||
int (CEF_CALLBACK *insert_separator_at)(struct _cef_menu_model_t* self,
|
||||
int index, enum cef_menu_separator_type_t type);
|
||||
int index);
|
||||
|
||||
//
|
||||
// Insert an item in the menu at the specified |index|. Returns true (1) on
|
||||
@ -206,12 +205,6 @@ typedef struct _cef_menu_model_t {
|
||||
enum cef_menu_item_type_t (CEF_CALLBACK *get_type_at)(
|
||||
struct _cef_menu_model_t* self, int index);
|
||||
|
||||
///
|
||||
// Returns the separator type at the specified |index|.
|
||||
///
|
||||
enum cef_menu_separator_type_t (CEF_CALLBACK *get_separator_type_at)(
|
||||
struct _cef_menu_model_t* self, int index);
|
||||
|
||||
///
|
||||
// Returns the group id for the specified |command_id| or -1 if invalid.
|
||||
///
|
||||
|
@ -50,7 +50,6 @@
|
||||
class CefMenuModel : public virtual CefBase {
|
||||
public:
|
||||
typedef cef_menu_item_type_t MenuItemType;
|
||||
typedef cef_menu_separator_type_t MenuSeparatorType;
|
||||
|
||||
///
|
||||
// Clears the menu. Returns true on success.
|
||||
@ -68,7 +67,7 @@ class CefMenuModel : public virtual CefBase {
|
||||
// Add a separator to the menu. Returns true on success.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool AddSeparator(MenuSeparatorType type) =0;
|
||||
virtual bool AddSeparator() =0;
|
||||
|
||||
//
|
||||
// Add an item to the menu. Returns true on success.
|
||||
@ -104,7 +103,7 @@ class CefMenuModel : public virtual CefBase {
|
||||
// success.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool InsertSeparatorAt(int index, MenuSeparatorType type) =0;
|
||||
virtual bool InsertSeparatorAt(int index) =0;
|
||||
|
||||
//
|
||||
// Insert an item in the menu at the specified |index|. Returns true on
|
||||
@ -213,12 +212,6 @@ class CefMenuModel : public virtual CefBase {
|
||||
/*--cef(default_retval=MENUITEMTYPE_NONE)--*/
|
||||
virtual MenuItemType GetTypeAt(int index) =0;
|
||||
|
||||
///
|
||||
// Returns the separator type at the specified |index|.
|
||||
///
|
||||
/*--cef(default_retval=MENUSEPARATORTYPE_NONE)--*/
|
||||
virtual MenuSeparatorType GetSeparatorTypeAt(int index) =0;
|
||||
|
||||
///
|
||||
// Returns the group id for the specified |command_id| or -1 if invalid.
|
||||
///
|
||||
|
@ -984,33 +984,6 @@ enum cef_menu_item_type_t {
|
||||
MENUITEMTYPE_SUBMENU,
|
||||
};
|
||||
|
||||
///
|
||||
// Supported menu separator types.
|
||||
///
|
||||
enum cef_menu_separator_type_t {
|
||||
MENUSEPARATORTYPE_NONE,
|
||||
|
||||
///
|
||||
// Normal - top to bottom: Spacing, line, spacing
|
||||
///
|
||||
MENUSEPARATORTYPE_NORMAL,
|
||||
|
||||
///
|
||||
// Upper - top to bottom: Line, spacing
|
||||
///
|
||||
MENUSEPARATORTYPE_UPPER,
|
||||
|
||||
///
|
||||
// Lower - top to bottom: Spacing, line
|
||||
///
|
||||
MENUSEPARATORTYPE_LOWER,
|
||||
|
||||
///
|
||||
// Spacing - top to bottom: Spacing only.
|
||||
///
|
||||
MENUSEPARATORTYPE_SPACING,
|
||||
};
|
||||
|
||||
///
|
||||
// Supported context menu type flags.
|
||||
///
|
||||
|
@ -206,13 +206,13 @@ void CefMenuCreator::CreateDefaultModel() {
|
||||
model_->AddItem(MENU_ID_UNDO, GetLabel(IDS_MENU_UNDO));
|
||||
model_->AddItem(MENU_ID_REDO, GetLabel(IDS_MENU_REDO));
|
||||
|
||||
model_->AddSeparator(MENUSEPARATORTYPE_NORMAL);
|
||||
model_->AddSeparator();
|
||||
model_->AddItem(MENU_ID_CUT, GetLabel(IDS_MENU_CUT));
|
||||
model_->AddItem(MENU_ID_COPY, GetLabel(IDS_MENU_COPY));
|
||||
model_->AddItem(MENU_ID_PASTE, GetLabel(IDS_MENU_PASTE));
|
||||
model_->AddItem(MENU_ID_DELETE, GetLabel(IDS_MENU_DELETE));
|
||||
|
||||
model_->AddSeparator(MENUSEPARATORTYPE_NORMAL);
|
||||
model_->AddSeparator();
|
||||
model_->AddItem(MENU_ID_SELECT_ALL, GetLabel(IDS_MENU_SELECT_ALL));
|
||||
|
||||
if (!(params_.edit_flags & CM_EDITFLAG_CAN_UNDO))
|
||||
@ -237,7 +237,7 @@ void CefMenuCreator::CreateDefaultModel() {
|
||||
model_->AddItem(MENU_ID_BACK, GetLabel(IDS_MENU_BACK));
|
||||
model_->AddItem(MENU_ID_FORWARD, GetLabel(IDS_MENU_FORWARD));
|
||||
|
||||
model_->AddSeparator(MENUSEPARATORTYPE_NORMAL);
|
||||
model_->AddSeparator();
|
||||
model_->AddItem(MENU_ID_PRINT, GetLabel(IDS_MENU_PRINT));
|
||||
model_->AddItem(MENU_ID_VIEW_SOURCE, GetLabel(IDS_MENU_VIEW_SOURCE));
|
||||
|
||||
|
@ -167,7 +167,6 @@ struct CefMenuModelImpl::Item {
|
||||
const CefString& label,
|
||||
int group_id)
|
||||
: type_(type),
|
||||
separator_type_(MENUSEPARATORTYPE_NONE),
|
||||
command_id_(command_id),
|
||||
label_(label),
|
||||
group_id_(group_id),
|
||||
@ -183,7 +182,6 @@ struct CefMenuModelImpl::Item {
|
||||
|
||||
// Basic information.
|
||||
cef_menu_item_type_t type_;
|
||||
cef_menu_separator_type_t separator_type_;
|
||||
int command_id_;
|
||||
CefString label_;
|
||||
int group_id_;
|
||||
@ -227,17 +225,11 @@ int CefMenuModelImpl::GetCount() {
|
||||
return static_cast<int>(items_.size());
|
||||
}
|
||||
|
||||
bool CefMenuModelImpl::AddSeparator(MenuSeparatorType type) {
|
||||
bool CefMenuModelImpl::AddSeparator() {
|
||||
if (!VerifyContext())
|
||||
return false;
|
||||
|
||||
DCHECK(type != MENUSEPARATORTYPE_NONE);
|
||||
if (type == MENUSEPARATORTYPE_NONE)
|
||||
return false;
|
||||
|
||||
Item item(MENUITEMTYPE_SEPARATOR, kSeparatorId, CefString(), -1);
|
||||
item.separator_type_ = type;
|
||||
AppendItem(item);
|
||||
AppendItem(Item(MENUITEMTYPE_SEPARATOR, kSeparatorId, CefString(), -1));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -277,17 +269,12 @@ CefRefPtr<CefMenuModel> CefMenuModelImpl::AddSubMenu(int command_id,
|
||||
return item.submenu_.get();
|
||||
}
|
||||
|
||||
bool CefMenuModelImpl::InsertSeparatorAt(int index, MenuSeparatorType type) {
|
||||
bool CefMenuModelImpl::InsertSeparatorAt(int index) {
|
||||
if (!VerifyContext())
|
||||
return false;
|
||||
|
||||
DCHECK(type != MENUSEPARATORTYPE_NONE);
|
||||
if (type == MENUSEPARATORTYPE_NONE)
|
||||
return false;
|
||||
|
||||
Item item(MENUITEMTYPE_SEPARATOR, kSeparatorId, CefString(), -1);
|
||||
item.separator_type_ = type;
|
||||
InsertItemAt(item, index);
|
||||
InsertItemAt(Item(MENUITEMTYPE_SEPARATOR, kSeparatorId, CefString(), -1),
|
||||
index);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -417,16 +404,6 @@ CefMenuModelImpl::MenuItemType CefMenuModelImpl::GetTypeAt(int index) {
|
||||
return MENUITEMTYPE_NONE;
|
||||
}
|
||||
|
||||
CefMenuModelImpl::MenuSeparatorType
|
||||
CefMenuModelImpl::GetSeparatorTypeAt(int index) {
|
||||
if (!VerifyContext())
|
||||
return MENUSEPARATORTYPE_NONE;
|
||||
|
||||
if (index >= 0 && index < static_cast<int>(items_.size()))
|
||||
return items_[index].separator_type_;
|
||||
return MENUSEPARATORTYPE_NONE;
|
||||
}
|
||||
|
||||
int CefMenuModelImpl::GetGroupId(int command_id) {
|
||||
return GetGroupIdAt(GetIndexOf(command_id));
|
||||
}
|
||||
|
@ -42,14 +42,14 @@ class CefMenuModelImpl : public CefMenuModel {
|
||||
// CefMenuModel methods.
|
||||
virtual bool Clear() OVERRIDE;
|
||||
virtual int GetCount() OVERRIDE;
|
||||
virtual bool AddSeparator(MenuSeparatorType type) 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, MenuSeparatorType type) 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,
|
||||
@ -69,7 +69,6 @@ class CefMenuModelImpl : public CefMenuModel {
|
||||
virtual bool SetLabelAt(int index, const CefString& label) OVERRIDE;
|
||||
virtual MenuItemType GetType(int command_id) OVERRIDE;
|
||||
virtual MenuItemType GetTypeAt(int index) OVERRIDE;
|
||||
virtual MenuSeparatorType GetSeparatorTypeAt(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;
|
||||
|
@ -43,8 +43,7 @@ int CEF_CALLBACK menu_model_get_count(struct _cef_menu_model_t* self) {
|
||||
return _retval;
|
||||
}
|
||||
|
||||
int CEF_CALLBACK menu_model_add_separator(struct _cef_menu_model_t* self,
|
||||
enum cef_menu_separator_type_t type) {
|
||||
int CEF_CALLBACK menu_model_add_separator(struct _cef_menu_model_t* self) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
@ -52,8 +51,7 @@ int CEF_CALLBACK menu_model_add_separator(struct _cef_menu_model_t* self,
|
||||
return 0;
|
||||
|
||||
// Execute
|
||||
bool _retval = CefMenuModelCppToC::Get(self)->AddSeparator(
|
||||
type);
|
||||
bool _retval = CefMenuModelCppToC::Get(self)->AddSeparator();
|
||||
|
||||
// Return type: bool
|
||||
return _retval;
|
||||
@ -146,7 +144,7 @@ struct _cef_menu_model_t* CEF_CALLBACK menu_model_add_sub_menu(
|
||||
}
|
||||
|
||||
int CEF_CALLBACK menu_model_insert_separator_at(struct _cef_menu_model_t* self,
|
||||
int index, enum cef_menu_separator_type_t type) {
|
||||
int index) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
@ -155,8 +153,7 @@ int CEF_CALLBACK menu_model_insert_separator_at(struct _cef_menu_model_t* self,
|
||||
|
||||
// Execute
|
||||
bool _retval = CefMenuModelCppToC::Get(self)->InsertSeparatorAt(
|
||||
index,
|
||||
type);
|
||||
index);
|
||||
|
||||
// Return type: bool
|
||||
return _retval;
|
||||
@ -440,23 +437,6 @@ enum cef_menu_item_type_t CEF_CALLBACK menu_model_get_type_at(
|
||||
return _retval;
|
||||
}
|
||||
|
||||
enum cef_menu_separator_type_t CEF_CALLBACK menu_model_get_separator_type_at(
|
||||
struct _cef_menu_model_t* self, int index) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return MENUSEPARATORTYPE_NONE;
|
||||
|
||||
// Execute
|
||||
cef_menu_separator_type_t _retval = CefMenuModelCppToC::Get(
|
||||
self)->GetSeparatorTypeAt(
|
||||
index);
|
||||
|
||||
// Return type: simple
|
||||
return _retval;
|
||||
}
|
||||
|
||||
int CEF_CALLBACK menu_model_get_group_id(struct _cef_menu_model_t* self,
|
||||
int command_id) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
@ -1005,7 +985,6 @@ CefMenuModelCppToC::CefMenuModelCppToC(CefMenuModel* cls)
|
||||
struct_.struct_.set_label_at = menu_model_set_label_at;
|
||||
struct_.struct_.get_type = menu_model_get_type;
|
||||
struct_.struct_.get_type_at = menu_model_get_type_at;
|
||||
struct_.struct_.get_separator_type_at = menu_model_get_separator_type_at;
|
||||
struct_.struct_.get_group_id = menu_model_get_group_id;
|
||||
struct_.struct_.get_group_id_at = menu_model_get_group_id_at;
|
||||
struct_.struct_.set_group_id = menu_model_set_group_id;
|
||||
|
@ -41,15 +41,14 @@ int CefMenuModelCToCpp::GetCount() {
|
||||
return _retval;
|
||||
}
|
||||
|
||||
bool CefMenuModelCToCpp::AddSeparator(MenuSeparatorType type) {
|
||||
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_,
|
||||
type);
|
||||
int _retval = struct_->add_separator(struct_);
|
||||
|
||||
// Return type: bool
|
||||
return _retval?true:false;
|
||||
@ -138,7 +137,7 @@ CefRefPtr<CefMenuModel> CefMenuModelCToCpp::AddSubMenu(int command_id,
|
||||
return CefMenuModelCToCpp::Wrap(_retval);
|
||||
}
|
||||
|
||||
bool CefMenuModelCToCpp::InsertSeparatorAt(int index, MenuSeparatorType type) {
|
||||
bool CefMenuModelCToCpp::InsertSeparatorAt(int index) {
|
||||
if (CEF_MEMBER_MISSING(struct_, insert_separator_at))
|
||||
return false;
|
||||
|
||||
@ -146,8 +145,7 @@ bool CefMenuModelCToCpp::InsertSeparatorAt(int index, MenuSeparatorType type) {
|
||||
|
||||
// Execute
|
||||
int _retval = struct_->insert_separator_at(struct_,
|
||||
index,
|
||||
type);
|
||||
index);
|
||||
|
||||
// Return type: bool
|
||||
return _retval?true:false;
|
||||
@ -413,21 +411,6 @@ CefMenuModel::MenuItemType CefMenuModelCToCpp::GetTypeAt(int index) {
|
||||
return _retval;
|
||||
}
|
||||
|
||||
CefMenuModel::MenuSeparatorType CefMenuModelCToCpp::GetSeparatorTypeAt(
|
||||
int index) {
|
||||
if (CEF_MEMBER_MISSING(struct_, get_separator_type_at))
|
||||
return MENUSEPARATORTYPE_NONE;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
cef_menu_separator_type_t _retval = struct_->get_separator_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;
|
||||
|
@ -34,14 +34,14 @@ class CefMenuModelCToCpp
|
||||
// CefMenuModel methods
|
||||
virtual bool Clear() OVERRIDE;
|
||||
virtual int GetCount() OVERRIDE;
|
||||
virtual bool AddSeparator(MenuSeparatorType type) 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, MenuSeparatorType type) 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,
|
||||
@ -61,7 +61,6 @@ class CefMenuModelCToCpp
|
||||
virtual bool SetLabelAt(int index, const CefString& label) OVERRIDE;
|
||||
virtual MenuItemType GetType(int command_id) OVERRIDE;
|
||||
virtual MenuItemType GetTypeAt(int index) OVERRIDE;
|
||||
virtual MenuSeparatorType GetSeparatorTypeAt(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;
|
||||
|
@ -94,7 +94,7 @@ void ClientHandler::OnBeforeContextMenu(
|
||||
if ((params->GetTypeFlags() & (CM_TYPEFLAG_PAGE | CM_TYPEFLAG_FRAME)) != 0) {
|
||||
// Add a separator if the menu already has items.
|
||||
if (model->GetCount() > 0)
|
||||
model->AddSeparator(MENUSEPARATORTYPE_NORMAL);
|
||||
model->AddSeparator();
|
||||
|
||||
// Add a "Show DevTools" item to all context menus.
|
||||
model->AddItem(CLIENT_ID_SHOW_DEVTOOLS, "&Show DevTools");
|
||||
@ -490,7 +490,7 @@ void ClientHandler::CreateRequestDelegates(RequestDelegateSet& delegates) {
|
||||
|
||||
void ClientHandler::BuildTestMenu(CefRefPtr<CefMenuModel> model) {
|
||||
if (model->GetCount() > 0)
|
||||
model->AddSeparator(MENUSEPARATORTYPE_NORMAL);
|
||||
model->AddSeparator();
|
||||
|
||||
// Build the sub menu.
|
||||
CefRefPtr<CefMenuModel> submenu =
|
||||
|
Loading…
x
Reference in New Issue
Block a user