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

@@ -92,6 +92,13 @@ typedef struct _cef_client_t {
struct _cef_jsdialog_handler_t* (CEF_CALLBACK *get_jsdialog_handler)(
struct _cef_client_t* self);
///
// Return the handler for context menus. If no handler is provided the default
// implementation will be used.
///
struct _cef_context_menu_handler_t* (CEF_CALLBACK *get_context_menu_handler)(
struct _cef_client_t* self);
///
// Called when a new message is received from a different process. Return true
// (1) if the message was handled or false (0) otherwise. Do not keep a

View File

@@ -0,0 +1,221 @@
// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
#ifndef CEF_INCLUDE_CAPI_CEF_CONTEXT_MENU_HANDLER_CAPI_H_
#define CEF_INCLUDE_CAPI_CEF_CONTEXT_MENU_HANDLER_CAPI_H_
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include "include/capi/cef_base_capi.h"
///
// Implement this structure to handle context menu events. The functions of this
// structure will be called on the UI thread.
///
typedef struct _cef_context_menu_handler_t {
///
// Base structure.
///
cef_base_t base;
///
// Called before a context menu is displayed. |params| provides information
// about the context menu state. |model| initially contains the default
// context menu. The |model| can be cleared to show no context menu or
// modified to show a custom menu. Do not keep references to |params| or
// |model| outside of this callback.
///
void (CEF_CALLBACK *on_before_context_menu)(
struct _cef_context_menu_handler_t* self, struct _cef_browser_t* browser,
struct _cef_frame_t* frame, struct _cef_context_menu_params_t* params,
struct _cef_menu_model_t* model);
///
// Called to execute a command selected from the context menu. Return true (1)
// if the command was handled or false (0) for the default implementation. See
// cef_menu_id_t for the command ids that have default implementations. All
// user-defined command ids should be between MENU_ID_USER_FIRST and
// MENU_ID_USER_LAST. |params| will have the same values as what was passed to
// on_before_context_menu(). Do not keep a reference to |params| outside of
// this callback.
///
int (CEF_CALLBACK *on_context_menu_command)(
struct _cef_context_menu_handler_t* self, struct _cef_browser_t* browser,
struct _cef_frame_t* frame, struct _cef_context_menu_params_t* params,
int command_id, enum cef_event_flags_t event_flags);
///
// Called when the context menu is dismissed irregardless of whether the menu
// was NULL or a command was selected.
///
void (CEF_CALLBACK *on_context_menu_dismissed)(
struct _cef_context_menu_handler_t* self, struct _cef_browser_t* browser,
struct _cef_frame_t* frame);
} cef_context_menu_handler_t;
///
// Provides information about the context menu state. The ethods of this
// structure can only be accessed on browser process the UI thread.
///
typedef struct _cef_context_menu_params_t {
///
// Base structure.
///
cef_base_t base;
///
// Returns the X coordinate of the mouse where the context menu was invoked.
// Coords are relative to the associated RenderView's origin.
///
int (CEF_CALLBACK *get_xcoord)(struct _cef_context_menu_params_t* self);
///
// Returns the Y coordinate of the mouse where the context menu was invoked.
// Coords are relative to the associated RenderView's origin.
///
int (CEF_CALLBACK *get_ycoord)(struct _cef_context_menu_params_t* self);
///
// Returns flags representing the type of node that the context menu was
// invoked on.
///
enum cef_context_menu_type_flags_t (CEF_CALLBACK *get_type_flags)(
struct _cef_context_menu_params_t* self);
///
// Returns the URL of the link, if any, that encloses the node that the
// context menu was invoked on.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_link_url)(
struct _cef_context_menu_params_t* self);
///
// Returns the link URL, if any, to be used ONLY for "copy link address". We
// don't validate this field in the frontend process.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_unfiltered_link_url)(
struct _cef_context_menu_params_t* self);
///
// Returns the source URL, if any, for the element that the context menu was
// invoked on. Example of elements with source URLs are img, audio, and video.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_source_url)(
struct _cef_context_menu_params_t* self);
///
// Returns true (1) if the context menu was invoked on a blocked image.
///
int (CEF_CALLBACK *is_image_blocked)(struct _cef_context_menu_params_t* self);
///
// Returns the URL of the top level page that the context menu was invoked on.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_page_url)(
struct _cef_context_menu_params_t* self);
///
// Returns the URL of the subframe that the context menu was invoked on.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_frame_url)(
struct _cef_context_menu_params_t* self);
///
// Returns the character encoding of the subframe that the context menu was
// invoked on.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_frame_charset)(
struct _cef_context_menu_params_t* self);
///
// Returns the type of context node that the context menu was invoked on.
///
enum cef_context_menu_media_type_t (CEF_CALLBACK *get_media_type)(
struct _cef_context_menu_params_t* self);
///
// Returns flags representing the actions supported by the media element, if
// any, that the context menu was invoked on.
///
enum cef_context_menu_media_state_flags_t (
CEF_CALLBACK *get_media_state_flags)(
struct _cef_context_menu_params_t* self);
///
// Returns the text of the selection, if any, that the context menu was
// invoked on.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_selection_text)(
struct _cef_context_menu_params_t* self);
///
// Returns true (1) if the context menu was invoked on an editable node.
///
int (CEF_CALLBACK *is_editable)(struct _cef_context_menu_params_t* self);
///
// Returns true (1) if the context menu was invoked on an editable node where
// speech-input is enabled.
///
int (CEF_CALLBACK *is_speech_input_enabled)(
struct _cef_context_menu_params_t* self);
///
// Returns flags representing the actions supported by the editable node, if
// any, that the context menu was invoked on.
///
enum cef_context_menu_edit_state_flags_t (CEF_CALLBACK *get_edit_state_flags)(
struct _cef_context_menu_params_t* self);
} cef_context_menu_params_t;
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_CEF_CONTEXT_MENU_HANDLER_CAPI_H_

View File

@@ -0,0 +1,388 @@
// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
#ifndef CEF_INCLUDE_CAPI_CEF_MENU_MODEL_CAPI_H_
#define CEF_INCLUDE_CAPI_CEF_MENU_MODEL_CAPI_H_
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include "include/capi/cef_base_capi.h"
///
// Supports creation and modification of menus. See cef_menu_id_t for the
// command ids that have default implementations. All user-defined command ids
// should be between MENU_ID_USER_FIRST and MENU_ID_USER_LAST. The functions of
// this structure can only be accessed on the browser process the UI thread.
///
typedef struct _cef_menu_model_t {
///
// Base structure.
///
cef_base_t base;
///
// Clears the menu. Returns true (1) on success.
///
int (CEF_CALLBACK *clear)(struct _cef_menu_model_t* self);
///
// Returns the number of items in this menu.
///
int (CEF_CALLBACK *get_count)(struct _cef_menu_model_t* self);
//
// Add a separator to the menu. Returns true (1) on success.
///
int (CEF_CALLBACK *add_separator)(struct _cef_menu_model_t* self);
//
// Add an item to the menu. Returns true (1) on success.
///
int (CEF_CALLBACK *add_item)(struct _cef_menu_model_t* self, int command_id,
const cef_string_t* label);
//
// Add a check item to the menu. Returns true (1) on success.
///
int (CEF_CALLBACK *add_check_item)(struct _cef_menu_model_t* self,
int command_id, const cef_string_t* label);
//
// Add a radio item to the menu. Only a single item with the specified
// |group_id| can be checked at a time. Returns true (1) on success.
///
int (CEF_CALLBACK *add_radio_item)(struct _cef_menu_model_t* self,
int command_id, const cef_string_t* label, int group_id);
//
// Add a sub-menu to the menu. The new sub-menu is returned.
///
struct _cef_menu_model_t* (CEF_CALLBACK *add_sub_menu)(
struct _cef_menu_model_t* self, int command_id,
const cef_string_t* label);
//
// Insert a separator in the menu at the specified |index|. Returns true (1)
// on success.
///
int (CEF_CALLBACK *insert_separator_at)(struct _cef_menu_model_t* self,
int index);
//
// Insert an item in the menu at the specified |index|. Returns true (1) on
// success.
///
int (CEF_CALLBACK *insert_item_at)(struct _cef_menu_model_t* self, int index,
int command_id, const cef_string_t* label);
//
// Insert a check item in the menu at the specified |index|. Returns true (1)
// on success.
///
int (CEF_CALLBACK *insert_check_item_at)(struct _cef_menu_model_t* self,
int index, int command_id, const cef_string_t* label);
//
// Insert a radio item in the menu at the specified |index|. Only a single
// item with the specified |group_id| can be checked at a time. Returns true
// (1) on success.
///
int (CEF_CALLBACK *insert_radio_item_at)(struct _cef_menu_model_t* self,
int index, int command_id, const cef_string_t* label, int group_id);
//
// Insert a sub-menu in the menu at the specified |index|. The new sub-menu is
// returned.
///
struct _cef_menu_model_t* (CEF_CALLBACK *insert_sub_menu_at)(
struct _cef_menu_model_t* self, int index, int command_id,
const cef_string_t* label);
///
// Removes the item with the specified |command_id|. Returns true (1) on
// success.
///
int (CEF_CALLBACK *remove)(struct _cef_menu_model_t* self, int command_id);
///
// Removes the item at the specified |index|. Returns true (1) on success.
///
int (CEF_CALLBACK *remove_at)(struct _cef_menu_model_t* self, int index);
///
// Returns the index associated with the specified |command_id| or -1 if not
// found due to the command id not existing in the menu.
///
int (CEF_CALLBACK *get_index_of)(struct _cef_menu_model_t* self,
int command_id);
///
// Returns the command id at the specified |index| or -1 if not found due to
// invalid range or the index being a separator.
///
int (CEF_CALLBACK *get_command_id_at)(struct _cef_menu_model_t* self,
int index);
///
// Sets the command id at the specified |index|. Returns true (1) on success.
///
int (CEF_CALLBACK *set_command_id_at)(struct _cef_menu_model_t* self,
int index, int command_id);
///
// Returns the label for the specified |command_id| or NULL if not found.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_label)(
struct _cef_menu_model_t* self, int command_id);
///
// Returns the label at the specified |index| or NULL if not found due to
// invalid range or the index being a separator.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_label_at)(
struct _cef_menu_model_t* self, int index);
///
// Sets the label for the specified |command_id|. Returns true (1) on success.
///
int (CEF_CALLBACK *set_label)(struct _cef_menu_model_t* self, int command_id,
const cef_string_t* label);
///
// Set the label at the specified |index|. Returns true (1) on success.
///
int (CEF_CALLBACK *set_label_at)(struct _cef_menu_model_t* self, int index,
const cef_string_t* label);
///
// Returns the item type for the specified |command_id|.
///
enum cef_menu_item_type_t (CEF_CALLBACK *get_type)(
struct _cef_menu_model_t* self, int command_id);
///
// Returns the item type at the specified |index|.
///
enum cef_menu_item_type_t (CEF_CALLBACK *get_type_at)(
struct _cef_menu_model_t* self, int index);
///
// Returns the group id for the specified |command_id| or -1 if invalid.
///
int (CEF_CALLBACK *get_group_id)(struct _cef_menu_model_t* self,
int command_id);
///
// Returns the group id at the specified |index| or -1 if invalid.
///
int (CEF_CALLBACK *get_group_id_at)(struct _cef_menu_model_t* self,
int index);
///
// Sets the group id for the specified |command_id|. Returns true (1) on
// success.
///
int (CEF_CALLBACK *set_group_id)(struct _cef_menu_model_t* self,
int command_id, int group_id);
///
// Sets the group id at the specified |index|. Returns true (1) on success.
///
int (CEF_CALLBACK *set_group_id_at)(struct _cef_menu_model_t* self, int index,
int group_id);
///
// Returns the submenu for the specified |command_id| or NULL if invalid.
///
struct _cef_menu_model_t* (CEF_CALLBACK *get_sub_menu)(
struct _cef_menu_model_t* self, int command_id);
///
// Returns the submenu at the specified |index| or NULL if invalid.
///
struct _cef_menu_model_t* (CEF_CALLBACK *get_sub_menu_at)(
struct _cef_menu_model_t* self, int index);
//
// Returns true (1) if the specified |command_id| is visible.
///
int (CEF_CALLBACK *is_visible)(struct _cef_menu_model_t* self,
int command_id);
//
// Returns true (1) if the specified |index| is visible.
///
int (CEF_CALLBACK *is_visible_at)(struct _cef_menu_model_t* self, int index);
//
// Change the visibility of the specified |command_id|. Returns true (1) on
// success.
///
int (CEF_CALLBACK *set_visible)(struct _cef_menu_model_t* self,
int command_id, int visible);
//
// Change the visibility at the specified |index|. Returns true (1) on
// success.
///
int (CEF_CALLBACK *set_visible_at)(struct _cef_menu_model_t* self, int index,
int visible);
//
// Returns true (1) if the specified |command_id| is enabled.
///
int (CEF_CALLBACK *is_enabled)(struct _cef_menu_model_t* self,
int command_id);
//
// Returns true (1) if the specified |index| is enabled.
///
int (CEF_CALLBACK *is_enabled_at)(struct _cef_menu_model_t* self, int index);
//
// Change the enabled status of the specified |command_id|. Returns true (1)
// on success.
///
int (CEF_CALLBACK *set_enabled)(struct _cef_menu_model_t* self,
int command_id, int enabled);
//
// Change the enabled status at the specified |index|. Returns true (1) on
// success.
///
int (CEF_CALLBACK *set_enabled_at)(struct _cef_menu_model_t* self, int index,
int enabled);
//
// Returns true (1) if the specified |command_id| is checked. Only applies to
// check and radio items.
///
int (CEF_CALLBACK *is_checked)(struct _cef_menu_model_t* self,
int command_id);
//
// Returns true (1) if the specified |index| is checked. Only applies to check
// and radio items.
///
int (CEF_CALLBACK *is_checked_at)(struct _cef_menu_model_t* self, int index);
//
// Check the specified |command_id|. Only applies to check and radio items.
// Returns true (1) on success.
///
int (CEF_CALLBACK *set_checked)(struct _cef_menu_model_t* self,
int command_id, int checked);
//
// Check the specified |index|. Only applies to check and radio items. Returns
// true (1) on success.
///
int (CEF_CALLBACK *set_checked_at)(struct _cef_menu_model_t* self, int index,
int checked);
//
// Returns true (1) if the specified |command_id| has a keyboard accelerator
// assigned.
///
int (CEF_CALLBACK *has_accelerator)(struct _cef_menu_model_t* self,
int command_id);
//
// Returns true (1) if the specified |index| has a keyboard accelerator
// assigned.
///
int (CEF_CALLBACK *has_accelerator_at)(struct _cef_menu_model_t* self,
int index);
//
// Set the keyboard accelerator for the specified |command_id|. |key_code| can
// be any virtual key or character value. Returns true (1) on success.
///
int (CEF_CALLBACK *set_accelerator)(struct _cef_menu_model_t* self,
int command_id, int key_code, int shift_pressed, int ctrl_pressed,
int alt_pressed);
//
// Set the keyboard accelerator at the specified |index|. |key_code| can be
// any virtual key or character value. Returns true (1) on success.
///
int (CEF_CALLBACK *set_accelerator_at)(struct _cef_menu_model_t* self,
int index, int key_code, int shift_pressed, int ctrl_pressed,
int alt_pressed);
//
// Remove the keyboard accelerator for the specified |command_id|. Returns
// true (1) on success.
///
int (CEF_CALLBACK *remove_accelerator)(struct _cef_menu_model_t* self,
int command_id);
//
// Remove the keyboard accelerator at the specified |index|. Returns true (1)
// on success.
///
int (CEF_CALLBACK *remove_accelerator_at)(struct _cef_menu_model_t* self,
int index);
//
// Retrieves the keyboard accelerator for the specified |command_id|. Returns
// true (1) on success.
///
int (CEF_CALLBACK *get_accelerator)(struct _cef_menu_model_t* self,
int command_id, int* key_code, int* shift_pressed, int* ctrl_pressed,
int* alt_pressed);
//
// Retrieves the keyboard accelerator for the specified |index|. Returns true
// (1) on success.
///
int (CEF_CALLBACK *get_accelerator_at)(struct _cef_menu_model_t* self,
int index, int* key_code, int* shift_pressed, int* ctrl_pressed,
int* alt_pressed);
} cef_menu_model_t;
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_CEF_MENU_MODEL_CAPI_H_

View File

@@ -59,12 +59,7 @@ typedef struct _cef_resource_bundle_handler_t {
// Called to retrieve a localized translation for the string specified by
// |message_id|. To provide the translation set |string| to the translation
// string and return true (1). To use the default translation return false
// (0).
//
// WARNING: Be cautious when implementing this function. ID values are auto-
// generated when CEF is built and may change between versions. Existing ID
// values can be discovered by searching for *_strings.h in the
// "obj/global_intermediate" build output directory.
// (0). Supported message IDs are listed in cef_pack_strings.h.
///
int (CEF_CALLBACK *get_localized_string)(
struct _cef_resource_bundle_handler_t* self, int message_id,
@@ -75,12 +70,8 @@ typedef struct _cef_resource_bundle_handler_t {
// provide the resource data set |data| and |data_size| to the data pointer
// and size respectively and return true (1). To use the default resource data
// return false (0). The resource data will not be copied and must remain
// resident in memory.
//
// WARNING: Be cautious when implementing this function. ID values are auto-
// generated when CEF is built and may change between versions. Existing ID
// values can be discovered by searching for *_resources.h in the
// "obj/global_intermediate" build output directory.
// resident in memory. Supported resource IDs are listed in
// cef_pack_resources.h.
///
int (CEF_CALLBACK *get_data_resource)(
struct _cef_resource_bundle_handler_t* self, int resource_id, void** data,

View File

@@ -39,6 +39,7 @@
#pragma once
#include "include/cef_base.h"
#include "include/cef_context_menu_handler.h"
#include "include/cef_display_handler.h"
#include "include/cef_geolocation_handler.h"
#include "include/cef_jsdialog_handler.h"
@@ -103,6 +104,15 @@ class CefClient : public virtual CefBase {
return NULL;
}
///
// Return the handler for context menus. If no handler is provided the default
// implementation will be used.
///
/*--cef()--*/
virtual CefRefPtr<CefContextMenuHandler> GetContextMenuHandler() {
return NULL;
}
///
// Called when a new message is received from a different process. Return true
// if the message was handled or false otherwise. Do not keep a reference to

View File

@@ -0,0 +1,216 @@
// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// The contents of this file must follow a specific format in order to
// support the CEF translator tool. See the translator.README.txt file in the
// tools directory for more information.
//
#ifndef CEF_INCLUDE_CEF_CONTEXT_MENU_HANDLER_H_
#define CEF_INCLUDE_CEF_CONTEXT_MENU_HANDLER_H_
#pragma once
#include "include/cef_base.h"
#include "include/cef_browser.h"
#include "include/cef_frame.h"
#include "include/cef_menu_model.h"
class CefContextMenuParams;
///
// Implement this interface to handle context menu events. The methods of this
// class will be called on the UI thread.
///
/*--cef(source=client)--*/
class CefContextMenuHandler : public virtual CefBase {
public:
typedef cef_event_flags_t EventFlags;
///
// Called before a context menu is displayed. |params| provides information
// about the context menu state. |model| initially contains the default
// context menu. The |model| can be cleared to show no context menu or
// modified to show a custom menu. Do not keep references to |params| or
// |model| outside of this callback.
///
/*--cef()--*/
virtual void OnBeforeContextMenu(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefContextMenuParams> params,
CefRefPtr<CefMenuModel> model) {}
///
// Called to execute a command selected from the context menu. Return true if
// the command was handled or false for the default implementation. See
// cef_menu_id_t for the command ids that have default implementations. All
// user-defined command ids should be between MENU_ID_USER_FIRST and
// MENU_ID_USER_LAST. |params| will have the same values as what was passed to
// OnBeforeContextMenu(). Do not keep a reference to |params| outside of this
// callback.
///
/*--cef()--*/
virtual bool OnContextMenuCommand(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefContextMenuParams> params,
int command_id,
EventFlags event_flags) { return false; }
///
// Called when the context menu is dismissed irregardless of whether the menu
// was empty or a command was selected.
///
/*--cef()--*/
virtual void OnContextMenuDismissed(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame) {}
};
///
// Provides information about the context menu state. The ethods of this class
// can only be accessed on browser process the UI thread.
///
/*--cef(source=library)--*/
class CefContextMenuParams : public virtual CefBase {
public:
typedef cef_context_menu_type_flags_t TypeFlags;
typedef cef_context_menu_media_type_t MediaType;
typedef cef_context_menu_media_state_flags_t MediaStateFlags;
typedef cef_context_menu_edit_state_flags_t EditStateFlags;
///
// Returns the X coordinate of the mouse where the context menu was invoked.
// Coords are relative to the associated RenderView's origin.
///
/*--cef()--*/
virtual int GetXCoord() =0;
///
// Returns the Y coordinate of the mouse where the context menu was invoked.
// Coords are relative to the associated RenderView's origin.
///
/*--cef()--*/
virtual int GetYCoord() =0;
///
// Returns flags representing the type of node that the context menu was
// invoked on.
///
/*--cef(default_retval=CM_TYPEFLAG_NONE)--*/
virtual TypeFlags GetTypeFlags() =0;
///
// Returns the URL of the link, if any, that encloses the node that the
// context menu was invoked on.
///
/*--cef()--*/
virtual CefString GetLinkUrl() =0;
///
// Returns the link URL, if any, to be used ONLY for "copy link address". We
// don't validate this field in the frontend process.
///
/*--cef()--*/
virtual CefString GetUnfilteredLinkUrl() =0;
///
// Returns the source URL, if any, for the element that the context menu was
// invoked on. Example of elements with source URLs are img, audio, and video.
///
/*--cef()--*/
virtual CefString GetSourceUrl() =0;
///
// Returns true if the context menu was invoked on a blocked image.
///
/*--cef()--*/
virtual bool IsImageBlocked() =0;
///
// Returns the URL of the top level page that the context menu was invoked on.
///
/*--cef()--*/
virtual CefString GetPageUrl() =0;
///
// Returns the URL of the subframe that the context menu was invoked on.
///
/*--cef()--*/
virtual CefString GetFrameUrl() =0;
///
// Returns the character encoding of the subframe that the context menu was
// invoked on.
///
/*--cef()--*/
virtual CefString GetFrameCharset() =0;
///
// Returns the type of context node that the context menu was invoked on.
///
/*--cef(default_retval=CM_MEDIATYPE_NONE)--*/
virtual MediaType GetMediaType() =0;
///
// Returns flags representing the actions supported by the media element, if
// any, that the context menu was invoked on.
///
/*--cef(default_retval=CM_MEDIAFLAG_NONE)--*/
virtual MediaStateFlags GetMediaStateFlags() =0;
///
// Returns the text of the selection, if any, that the context menu was
// invoked on.
///
/*--cef()--*/
virtual CefString GetSelectionText() =0;
///
// Returns true if the context menu was invoked on an editable node.
///
/*--cef()--*/
virtual bool IsEditable() =0;
///
// Returns true if the context menu was invoked on an editable node where
// speech-input is enabled.
///
/*--cef()--*/
virtual bool IsSpeechInputEnabled() =0;
///
// Returns flags representing the actions supported by the editable node, if
// any, that the context menu was invoked on.
///
/*--cef(default_retval=CM_EDITFLAG_NONE)--*/
virtual EditStateFlags GetEditStateFlags() =0;
};
#endif // CEF_INCLUDE_CEF_CONTEXT_MENU_HANDLER_H_

402
include/cef_menu_model.h Normal file
View File

@@ -0,0 +1,402 @@
// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// The contents of this file must follow a specific format in order to
// support the CEF translator tool. See the translator.README.txt file in the
// tools directory for more information.
//
#ifndef CEF_INCLUDE_CEF_MENU_MODEL_H_
#define CEF_INCLUDE_CEF_MENU_MODEL_H_
#pragma once
#include "include/cef_base.h"
///
// Supports creation and modification of menus. See cef_menu_id_t for the
// command ids that have default implementations. All user-defined command ids
// should be between MENU_ID_USER_FIRST and MENU_ID_USER_LAST. The methods of
// this class can only be accessed on the browser process the UI thread.
///
/*--cef(source=library)--*/
class CefMenuModel : public virtual CefBase {
public:
typedef cef_menu_item_type_t MenuItemType;
///
// Clears the menu. Returns true on success.
///
/*--cef()--*/
virtual bool Clear() =0;
///
// Returns the number of items in this menu.
///
/*--cef()--*/
virtual int GetCount() =0;
//
// Add a separator to the menu. Returns true on success.
///
/*--cef()--*/
virtual bool AddSeparator() =0;
//
// Add an item to the menu. Returns true on success.
///
/*--cef()--*/
virtual bool AddItem(int command_id,
const CefString& label) =0;
//
// Add a check item to the menu. Returns true on success.
///
/*--cef()--*/
virtual bool AddCheckItem(int command_id,
const CefString& label) =0;
//
// Add a radio item to the menu. Only a single item with the specified
// |group_id| can be checked at a time. Returns true on success.
///
/*--cef()--*/
virtual bool AddRadioItem(int command_id,
const CefString& label,
int group_id) =0;
//
// Add a sub-menu to the menu. The new sub-menu is returned.
///
/*--cef()--*/
virtual CefRefPtr<CefMenuModel> AddSubMenu(int command_id,
const CefString& label) =0;
//
// Insert a separator in the menu at the specified |index|. Returns true on
// success.
///
/*--cef()--*/
virtual bool InsertSeparatorAt(int index) =0;
//
// Insert an item in the menu at the specified |index|. Returns true on
// success.
///
/*--cef()--*/
virtual bool InsertItemAt(int index,
int command_id,
const CefString& label) =0;
//
// Insert a check item in the menu at the specified |index|. Returns true on
// success.
///
/*--cef()--*/
virtual bool InsertCheckItemAt(int index,
int command_id,
const CefString& label) =0;
//
// Insert a radio item in the menu at the specified |index|. Only a single
// item with the specified |group_id| can be checked at a time. Returns true
// on success.
///
/*--cef()--*/
virtual bool InsertRadioItemAt(int index,
int command_id,
const CefString& label,
int group_id) =0;
//
// Insert a sub-menu in the menu at the specified |index|. The new sub-menu
// is returned.
///
/*--cef()--*/
virtual CefRefPtr<CefMenuModel> InsertSubMenuAt(int index,
int command_id,
const CefString& label) =0;
///
// Removes the item with the specified |command_id|. Returns true on success.
///
/*--cef()--*/
virtual bool Remove(int command_id) =0;
///
// Removes the item at the specified |index|. Returns true on success.
///
/*--cef()--*/
virtual bool RemoveAt(int index) =0;
///
// Returns the index associated with the specified |command_id| or -1 if not
// found due to the command id not existing in the menu.
///
/*--cef()--*/
virtual int GetIndexOf(int command_id) =0;
///
// Returns the command id at the specified |index| or -1 if not found due to
// invalid range or the index being a separator.
///
/*--cef()--*/
virtual int GetCommandIdAt(int index) =0;
///
// Sets the command id at the specified |index|. Returns true on success.
///
/*--cef()--*/
virtual bool SetCommandIdAt(int index, int command_id) =0;
///
// Returns the label for the specified |command_id| or empty if not found.
///
/*--cef()--*/
virtual CefString GetLabel(int command_id) =0;
///
// Returns the label at the specified |index| or empty if not found due to
// invalid range or the index being a separator.
///
/*--cef()--*/
virtual CefString GetLabelAt(int index) =0;
///
// Sets the label for the specified |command_id|. Returns true on success.
///
/*--cef()--*/
virtual bool SetLabel(int command_id, const CefString& label) =0;
///
// Set the label at the specified |index|. Returns true on success.
///
/*--cef()--*/
virtual bool SetLabelAt(int index, const CefString& label) =0;
///
// Returns the item type for the specified |command_id|.
///
/*--cef(default_retval=MENUITEMTYPE_NONE)--*/
virtual MenuItemType GetType(int command_id) =0;
///
// Returns the item type at the specified |index|.
///
/*--cef(default_retval=MENUITEMTYPE_NONE)--*/
virtual MenuItemType GetTypeAt(int index) =0;
///
// Returns the group id for the specified |command_id| or -1 if invalid.
///
/*--cef()--*/
virtual int GetGroupId(int command_id) =0;
///
// Returns the group id at the specified |index| or -1 if invalid.
///
/*--cef()--*/
virtual int GetGroupIdAt(int index) =0;
///
// Sets the group id for the specified |command_id|. Returns true on success.
///
/*--cef()--*/
virtual bool SetGroupId(int command_id, int group_id) =0;
///
// Sets the group id at the specified |index|. Returns true on success.
///
/*--cef()--*/
virtual bool SetGroupIdAt(int index, int group_id) =0;
///
// Returns the submenu for the specified |command_id| or empty if invalid.
///
/*--cef()--*/
virtual CefRefPtr<CefMenuModel> GetSubMenu(int command_id) =0;
///
// Returns the submenu at the specified |index| or empty if invalid.
///
/*--cef()--*/
virtual CefRefPtr<CefMenuModel> GetSubMenuAt(int index) =0;
//
// Returns true if the specified |command_id| is visible.
///
/*--cef()--*/
virtual bool IsVisible(int command_id) =0;
//
// Returns true if the specified |index| is visible.
///
/*--cef()--*/
virtual bool IsVisibleAt(int index) =0;
//
// Change the visibility of the specified |command_id|. Returns true on
// success.
///
/*--cef()--*/
virtual bool SetVisible(int command_id, bool visible) =0;
//
// Change the visibility at the specified |index|. Returns true on success.
///
/*--cef()--*/
virtual bool SetVisibleAt(int index, bool visible) =0;
//
// Returns true if the specified |command_id| is enabled.
///
/*--cef()--*/
virtual bool IsEnabled(int command_id) =0;
//
// Returns true if the specified |index| is enabled.
///
/*--cef()--*/
virtual bool IsEnabledAt(int index) =0;
//
// Change the enabled status of the specified |command_id|. Returns true on
// success.
///
/*--cef()--*/
virtual bool SetEnabled(int command_id, bool enabled) =0;
//
// Change the enabled status at the specified |index|. Returns true on
// success.
///
/*--cef()--*/
virtual bool SetEnabledAt(int index, bool enabled) =0;
//
// Returns true if the specified |command_id| is checked. Only applies to
// check and radio items.
///
/*--cef()--*/
virtual bool IsChecked(int command_id) =0;
//
// Returns true if the specified |index| is checked. Only applies to check
// and radio items.
///
/*--cef()--*/
virtual bool IsCheckedAt(int index) =0;
//
// Check the specified |command_id|. Only applies to check and radio items.
// Returns true on success.
///
/*--cef()--*/
virtual bool SetChecked(int command_id, bool checked) =0;
//
// Check the specified |index|. Only applies to check and radio items. Returns
// true on success.
///
/*--cef()--*/
virtual bool SetCheckedAt(int index, bool checked) =0;
//
// Returns true if the specified |command_id| has a keyboard accelerator
// assigned.
///
/*--cef()--*/
virtual bool HasAccelerator(int command_id) =0;
//
// Returns true if the specified |index| has a keyboard accelerator assigned.
///
/*--cef()--*/
virtual bool HasAcceleratorAt(int index) =0;
//
// Set the keyboard accelerator for the specified |command_id|. |key_code| can
// be any virtual key or character value. Returns true on success.
///
/*--cef()--*/
virtual bool SetAccelerator(int command_id,
int key_code,
bool shift_pressed,
bool ctrl_pressed,
bool alt_pressed) =0;
//
// Set the keyboard accelerator at the specified |index|. |key_code| can be
// any virtual key or character value. Returns true on success.
///
/*--cef()--*/
virtual bool SetAcceleratorAt(int index,
int key_code,
bool shift_pressed,
bool ctrl_pressed,
bool alt_pressed) =0;
//
// Remove the keyboard accelerator for the specified |command_id|. Returns
// true on success.
///
/*--cef()--*/
virtual bool RemoveAccelerator(int command_id) =0;
//
// Remove the keyboard accelerator at the specified |index|. Returns true on
// success.
///
/*--cef()--*/
virtual bool RemoveAcceleratorAt(int index) =0;
//
// Retrieves the keyboard accelerator for the specified |command_id|. Returns
// true on success.
///
/*--cef()--*/
virtual bool GetAccelerator(int command_id,
int& key_code,
bool& shift_pressed,
bool& ctrl_pressed,
bool& alt_pressed) =0;
//
// Retrieves the keyboard accelerator for the specified |index|. Returns true
// on success.
///
/*--cef()--*/
virtual bool GetAcceleratorAt(int index,
int& key_code,
bool& shift_pressed,
bool& ctrl_pressed,
bool& alt_pressed) =0;
};
#endif // CEF_INCLUDE_CEF_MENU_MODEL_H_

View File

@@ -51,11 +51,7 @@ class CefResourceBundleHandler : public virtual CefBase {
// Called to retrieve a localized translation for the string specified by
// |message_id|. To provide the translation set |string| to the translation
// string and return true. To use the default translation return false.
//
// WARNING: Be cautious when implementing this method. ID values are auto-
// generated when CEF is built and may change between versions. Existing ID
// values can be discovered by searching for *_strings.h in the
// "obj/global_intermediate" build output directory.
// Supported message IDs are listed in cef_pack_strings.h.
///
/*--cef()--*/
virtual bool GetLocalizedString(int message_id,
@@ -66,12 +62,7 @@ class CefResourceBundleHandler : public virtual CefBase {
// provide the resource data set |data| and |data_size| to the data pointer
// and size respectively and return true. To use the default resource data
// return false. The resource data will not be copied and must remain resident
// in memory.
//
// WARNING: Be cautious when implementing this method. ID values are auto-
// generated when CEF is built and may change between versions. Existing ID
// values can be discovered by searching for *_resources.h in the
// "obj/global_intermediate" build output directory.
// in memory. Supported resource IDs are listed in cef_pack_resources.h.
///
/*--cef()--*/
virtual bool GetDataResource(int resource_id,

View File

@@ -778,6 +778,165 @@ enum cef_jsdialog_type_t {
JSDIALOGTYPE_PROMPT,
};
///
// Supported menu IDs. Non-English translations can be provided for the
// IDS_MENU_* strings in CefResourceBundleHandler::GetLocalizedString().
///
enum cef_menu_id_t {
// Navigation.
MENU_ID_BACK = 100,
MENU_ID_FORWARD = 101,
MENU_ID_RELOAD = 102,
MENU_ID_RELOAD_NOCACHE = 103,
MENU_ID_STOPLOAD = 104,
// Editing.
MENU_ID_UNDO = 110,
MENU_ID_REDO = 111,
MENU_ID_CUT = 112,
MENU_ID_COPY = 113,
MENU_ID_PASTE = 114,
MENU_ID_DELETE = 115,
MENU_ID_SELECT_ALL = 116,
// Miscellaneous.
MENU_ID_FIND = 130,
MENU_ID_PRINT = 131,
MENU_ID_VIEW_SOURCE = 132,
// All user-defined menu IDs should come between MENU_ID_USER_FIRST and
// MENU_ID_USER_LAST to avoid overlapping the Chromium and CEF ID ranges
// defined in the tools/gritsettings/resource_ids file.
MENU_ID_USER_FIRST = 26500,
MENU_ID_USER_LAST = 28500,
};
///
// Supported event bit flags.
///
enum cef_event_flags_t {
EVENTFLAG_NONE = 0,
EVENTFLAG_CAPS_LOCK_DOWN = 1 << 0,
EVENTFLAG_SHIFT_DOWN = 1 << 1,
EVENTFLAG_CONTROL_DOWN = 1 << 2,
EVENTFLAG_ALT_DOWN = 1 << 3,
EVENTFLAG_LEFT_MOUSE_BUTTON = 1 << 4,
EVENTFLAG_MIDDLE_MOUSE_BUTTON = 1 << 5,
EVENTFLAG_RIGHT_MOUSE_BUTTON = 1 << 6,
// Mac OS-X command key.
EVENTFLAG_COMMAND_DOWN = 1 << 7,
// Windows extended key (see WM_KEYDOWN doc).
EVENTFLAG_EXTENDED = 1 << 8,
};
///
// Supported menu item types.
///
enum cef_menu_item_type_t {
MENUITEMTYPE_NONE,
MENUITEMTYPE_COMMAND,
MENUITEMTYPE_CHECK,
MENUITEMTYPE_RADIO,
MENUITEMTYPE_SEPARATOR,
MENUITEMTYPE_SUBMENU,
};
///
// Supported context menu type flags.
///
enum cef_context_menu_type_flags_t {
///
// No node is selected.
///
CM_TYPEFLAG_NONE = 0,
///
// The top page is selected.
///
CM_TYPEFLAG_PAGE = 1 << 0,
///
// A subframe page is selected.
///
CM_TYPEFLAG_FRAME = 1 << 1,
///
// A link is selected.
///
CM_TYPEFLAG_LINK = 1 << 2,
///
// A media node is selected.
///
CM_TYPEFLAG_MEDIA = 1 << 3,
///
// There is a textual or mixed selection that is selected.
///
CM_TYPEFLAG_SELECTION = 1 << 4,
///
// An editable element is selected.
///
CM_TYPEFLAG_EDITABLE = 1 << 5,
};
///
// Supported context menu media types.
///
enum cef_context_menu_media_type_t {
///
// No special node is in context.
///
CM_MEDIATYPE_NONE,
///
// An image node is selected.
///
CM_MEDIATYPE_IMAGE,
///
// A video node is selected.
///
CM_MEDIATYPE_VIDEO,
///
// An audio node is selected.
///
CM_MEDIATYPE_AUDIO,
///
// A file node is selected.
///
CM_MEDIATYPE_FILE,
///
// A plugin node is selected.
///
CM_MEDIATYPE_PLUGIN,
};
///
// Supported context menu media state bit flags.
///
enum cef_context_menu_media_state_flags_t {
CM_MEDIAFLAG_NONE = 0,
CM_MEDIAFLAG_ERROR = 1 << 0,
CM_MEDIAFLAG_PAUSED = 1 << 1,
CM_MEDIAFLAG_MUTED = 1 << 2,
CM_MEDIAFLAG_LOOP = 1 << 3,
CM_MEDIAFLAG_CAN_SAVE = 1 << 4,
CM_MEDIAFLAG_HAS_AUDIO = 1 << 5,
CM_MEDIAFLAG_HAS_VIDEO = 1 << 6,
CM_MEDIAFLAG_CONTROL_ROOT_ELEMENT = 1 << 7,
CM_MEDIAFLAG_CAN_PRINT = 1 << 8,
CM_MEDIAFLAG_CAN_ROTATE = 1 << 9,
};
///
// Supported context menu edit state bit flags.
///
enum cef_context_menu_edit_state_flags_t {
CM_EDITFLAG_NONE = 0,
CM_EDITFLAG_CAN_UNDO = 1 << 0,
CM_EDITFLAG_CAN_REDO = 1 << 1,
CM_EDITFLAG_CAN_CUT = 1 << 2,
CM_EDITFLAG_CAN_COPY = 1 << 3,
CM_EDITFLAG_CAN_PASTE = 1 << 4,
CM_EDITFLAG_CAN_DELETE = 1 << 5,
CM_EDITFLAG_CAN_SELECT_ALL = 1 << 6,
CM_EDITFLAG_CAN_TRANSLATE = 1 << 7,
};
///
// Supported XML encoding types. The parser supports ASCII, ISO-8859-1, and
// UTF16 (LE and BE) by default. All other types must be translated to UTF8