Package org.cef.callback
Interface CefMenuModel
-
public interface CefMenuModel
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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
CefMenuModel.MenuId
static class
CefMenuModel.MenuItemType
Supported menu item types.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
addCheckItem(int command_id, java.lang.String label)
Add a check item to the menu.boolean
addItem(int command_id, java.lang.String label)
Add an item to the menu.boolean
addRadioItem(int command_id, java.lang.String label, int group_id)
Add a radio item to the menu.boolean
addSeparator()
Add a separator to the menu.CefMenuModel
addSubMenu(int command_id, java.lang.String label)
Add a sub-menu to the menu.boolean
clear()
Clears the menu.boolean
getAccelerator(int command_id, IntRef key_code, BoolRef shift_pressed, BoolRef ctrl_pressed, BoolRef alt_pressed)
Retrieves the keyboard accelerator for the specified |command_id|.boolean
getAcceleratorAt(int index, IntRef key_code, BoolRef shift_pressed, BoolRef ctrl_pressed, BoolRef alt_pressed)
Retrieves the keyboard accelerator for the specified |index|.int
getCommandIdAt(int index)
Returns the command id at the specified |index| or -1 if not found due to invalid range or the index being a separator.int
getCount()
Returns the number of items in this menu.int
getGroupId(int command_id)
Returns the group id for the specified |command_id| or -1 if invalid.int
getGroupIdAt(int index)
Returns the group id at the specified |index| or -1 if invalid.int
getIndexOf(int command_id)
Returns the index associated with the specified |command_id| or -1 if not found due to the command id not existing in the menu.java.lang.String
getLabel(int command_id)
Returns the label for the specified |command_id| or empty if not found.java.lang.String
getLabelAt(int index)
Returns the label at the specified |index| or empty if not found due to invalid range or the index being a separator.CefMenuModel
getSubMenu(int command_id)
Returns the submenu for the specified |command_id| or empty if invalid.CefMenuModel
getSubMenuAt(int index)
Returns the submenu at the specified |index| or empty if invalid.CefMenuModel.MenuItemType
getType(int command_id)
Returns the item type for the specified |command_id|.CefMenuModel.MenuItemType
getTypeAt(int index)
Returns the item type at the specified |index|.boolean
hasAccelerator(int command_id)
Returns true if the specified |command_id| has a keyboard accelerator assigned.boolean
hasAcceleratorAt(int index)
Returns true if the specified |index| has a keyboard accelerator assigned.boolean
insertCheckItemAt(int index, int command_id, java.lang.String label)
Insert a check item in the menu at the specified |index|.boolean
insertItemAt(int index, int command_id, java.lang.String label)
Insert an item in the menu at the specified |index|.boolean
insertRadioItemAt(int index, int command_id, java.lang.String label, int group_id)
Insert a radio item in the menu at the specified |index|.boolean
insertSeparatorAt(int index)
Insert a separator in the menu at the specified |index|.CefMenuModel
insertSubMenuAt(int index, int command_id, java.lang.String label)
Insert a sub-menu in the menu at the specified |index|.boolean
isChecked(int command_id)
Returns true if the specified |command_id| is checked.boolean
isCheckedAt(int index)
Returns true if the specified |index| is checked.boolean
isEnabled(int command_id)
Returns true if the specified |command_id| is enabled.boolean
isEnabledAt(int index)
Returns true if the specified |index| is enabled.boolean
isVisible(int command_id)
Returns true if the specified |command_id| is visible.boolean
isVisibleAt(int index)
Returns true if the specified |index| is visible.boolean
remove(int command_id)
Removes the item with the specified |command_id|.boolean
removeAccelerator(int command_id)
Remove the keyboard accelerator for the specified |command_id|.boolean
removeAcceleratorAt(int index)
Remove the keyboard accelerator at the specified |index|.boolean
removeAt(int index)
Removes the item at the specified |index|.boolean
setAccelerator(int command_id, int key_code, boolean shift_pressed, boolean ctrl_pressed, boolean alt_pressed)
Set the keyboard accelerator for the specified |command_id|.boolean
setAcceleratorAt(int index, int key_code, boolean shift_pressed, boolean ctrl_pressed, boolean alt_pressed)
Set the keyboard accelerator at the specified |index|.boolean
setChecked(int command_id, boolean checked)
Check the specified |command_id|.boolean
setCheckedAt(int index, boolean checked)
Check the specified |index|.boolean
setCommandIdAt(int index, int command_id)
Sets the command id at the specified |index|.boolean
setEnabled(int command_id, boolean enabled)
Change the enabled status of the specified |command_id|.boolean
setEnabledAt(int index, boolean enabled)
Change the enabled status at the specified |index|.boolean
setGroupId(int command_id, int group_id)
Sets the group id for the specified |command_id|.boolean
setGroupIdAt(int index, int group_id)
Sets the group id at the specified |index|.boolean
setLabel(int command_id, java.lang.String label)
Sets the label for the specified |command_id|.boolean
setLabelAt(int index, java.lang.String label)
Set the label at the specified |index|.boolean
setVisible(int command_id, boolean visible)
Change the visibility of the specified |command_id|.boolean
setVisibleAt(int index, boolean visible)
Change the visibility at the specified |index|.
-
-
-
Method Detail
-
clear
boolean clear()
Clears the menu. Returns true on success.
-
getCount
int getCount()
Returns the number of items in this menu.
-
addSeparator
boolean addSeparator()
Add a separator to the menu. Returns true on success.
-
addItem
boolean addItem(int command_id, java.lang.String label)
Add an item to the menu. Returns true on success.
-
addCheckItem
boolean addCheckItem(int command_id, java.lang.String label)
Add a check item to the menu. Returns true on success.
-
addRadioItem
boolean addRadioItem(int command_id, java.lang.String label, int group_id)
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.
-
addSubMenu
CefMenuModel addSubMenu(int command_id, java.lang.String label)
Add a sub-menu to the menu. The new sub-menu is returned.
-
insertSeparatorAt
boolean insertSeparatorAt(int index)
Insert a separator in the menu at the specified |index|. Returns true on success.
-
insertItemAt
boolean insertItemAt(int index, int command_id, java.lang.String label)
Insert an item in the menu at the specified |index|. Returns true on success.
-
insertCheckItemAt
boolean insertCheckItemAt(int index, int command_id, java.lang.String label)
Insert a check item in the menu at the specified |index|. Returns true on success.
-
insertRadioItemAt
boolean insertRadioItemAt(int index, int command_id, java.lang.String label, int group_id)
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.
-
insertSubMenuAt
CefMenuModel insertSubMenuAt(int index, int command_id, java.lang.String label)
Insert a sub-menu in the menu at the specified |index|. The new sub-menu is returned.
-
remove
boolean remove(int command_id)
Removes the item with the specified |command_id|. Returns true on success.
-
removeAt
boolean removeAt(int index)
Removes the item at the specified |index|. Returns true on success.
-
getIndexOf
int getIndexOf(int command_id)
Returns the index associated with the specified |command_id| or -1 if not found due to the command id not existing in the menu.
-
getCommandIdAt
int getCommandIdAt(int index)
Returns the command id at the specified |index| or -1 if not found due to invalid range or the index being a separator.
-
setCommandIdAt
boolean setCommandIdAt(int index, int command_id)
Sets the command id at the specified |index|. Returns true on success.
-
getLabel
java.lang.String getLabel(int command_id)
Returns the label for the specified |command_id| or empty if not found.
-
getLabelAt
java.lang.String getLabelAt(int index)
Returns the label at the specified |index| or empty if not found due to invalid range or the index being a separator.
-
setLabel
boolean setLabel(int command_id, java.lang.String label)
Sets the label for the specified |command_id|. Returns true on success.
-
setLabelAt
boolean setLabelAt(int index, java.lang.String label)
Set the label at the specified |index|. Returns true on success.
-
getType
CefMenuModel.MenuItemType getType(int command_id)
Returns the item type for the specified |command_id|.
-
getTypeAt
CefMenuModel.MenuItemType getTypeAt(int index)
Returns the item type at the specified |index|.
-
getGroupId
int getGroupId(int command_id)
Returns the group id for the specified |command_id| or -1 if invalid.
-
getGroupIdAt
int getGroupIdAt(int index)
Returns the group id at the specified |index| or -1 if invalid.
-
setGroupId
boolean setGroupId(int command_id, int group_id)
Sets the group id for the specified |command_id|. Returns true on success.
-
setGroupIdAt
boolean setGroupIdAt(int index, int group_id)
Sets the group id at the specified |index|. Returns true on success.
-
getSubMenu
CefMenuModel getSubMenu(int command_id)
Returns the submenu for the specified |command_id| or empty if invalid.
-
getSubMenuAt
CefMenuModel getSubMenuAt(int index)
Returns the submenu at the specified |index| or empty if invalid.
-
isVisible
boolean isVisible(int command_id)
Returns true if the specified |command_id| is visible.
-
isVisibleAt
boolean isVisibleAt(int index)
Returns true if the specified |index| is visible.
-
setVisible
boolean setVisible(int command_id, boolean visible)
Change the visibility of the specified |command_id|. Returns true on success.
-
setVisibleAt
boolean setVisibleAt(int index, boolean visible)
Change the visibility at the specified |index|. Returns true on success.
-
isEnabled
boolean isEnabled(int command_id)
Returns true if the specified |command_id| is enabled.
-
isEnabledAt
boolean isEnabledAt(int index)
Returns true if the specified |index| is enabled.
-
setEnabled
boolean setEnabled(int command_id, boolean enabled)
Change the enabled status of the specified |command_id|. Returns true on success.
-
setEnabledAt
boolean setEnabledAt(int index, boolean enabled)
Change the enabled status at the specified |index|. Returns true on success.
-
isChecked
boolean isChecked(int command_id)
Returns true if the specified |command_id| is checked. Only applies to check and radio items.
-
isCheckedAt
boolean isCheckedAt(int index)
Returns true if the specified |index| is checked. Only applies to check and radio items.
-
setChecked
boolean setChecked(int command_id, boolean checked)
Check the specified |command_id|. Only applies to check and radio items. Returns true on success.
-
setCheckedAt
boolean setCheckedAt(int index, boolean checked)
Check the specified |index|. Only applies to check and radio items. Returns true on success.
-
hasAccelerator
boolean hasAccelerator(int command_id)
Returns true if the specified |command_id| has a keyboard accelerator assigned.
-
hasAcceleratorAt
boolean hasAcceleratorAt(int index)
Returns true if the specified |index| has a keyboard accelerator assigned.
-
setAccelerator
boolean setAccelerator(int command_id, int key_code, boolean shift_pressed, boolean ctrl_pressed, boolean alt_pressed)
Set the keyboard accelerator for the specified |command_id|. |key_code| can be any key or character value. Returns true on success.
-
setAcceleratorAt
boolean setAcceleratorAt(int index, int key_code, boolean shift_pressed, boolean ctrl_pressed, boolean alt_pressed)
Set the keyboard accelerator at the specified |index|. |key_code| can be any key or character value. Returns true on success.
-
removeAccelerator
boolean removeAccelerator(int command_id)
Remove the keyboard accelerator for the specified |command_id|. Returns true on success.
-
removeAcceleratorAt
boolean removeAcceleratorAt(int index)
Remove the keyboard accelerator at the specified |index|. Returns true on success.
-
getAccelerator
boolean getAccelerator(int command_id, IntRef key_code, BoolRef shift_pressed, BoolRef ctrl_pressed, BoolRef alt_pressed)
Retrieves the keyboard accelerator for the specified |command_id|. Returns true on success.
-
-