Package org.cef.callback
Interface CefMenuModel
-
public interface CefMenuModelSupports 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 classCefMenuModel.MenuIdstatic classCefMenuModel.MenuItemTypeSupported menu item types.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanaddCheckItem(int command_id, java.lang.String label)Add a check item to the menu.booleanaddItem(int command_id, java.lang.String label)Add an item to the menu.booleanaddRadioItem(int command_id, java.lang.String label, int group_id)Add a radio item to the menu.booleanaddSeparator()Add a separator to the menu.CefMenuModeladdSubMenu(int command_id, java.lang.String label)Add a sub-menu to the menu.booleanclear()Clears the menu.booleangetAccelerator(int command_id, IntRef key_code, BoolRef shift_pressed, BoolRef ctrl_pressed, BoolRef alt_pressed)Retrieves the keyboard accelerator for the specified |command_id|.booleangetAcceleratorAt(int index, IntRef key_code, BoolRef shift_pressed, BoolRef ctrl_pressed, BoolRef alt_pressed)Retrieves the keyboard accelerator for the specified |index|.intgetCommandIdAt(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.intgetCount()Returns the number of items in this menu.intgetGroupId(int command_id)Returns the group id for the specified |command_id| or -1 if invalid.intgetGroupIdAt(int index)Returns the group id at the specified |index| or -1 if invalid.intgetIndexOf(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.StringgetLabel(int command_id)Returns the label for the specified |command_id| or empty if not found.java.lang.StringgetLabelAt(int index)Returns the label at the specified |index| or empty if not found due to invalid range or the index being a separator.CefMenuModelgetSubMenu(int command_id)Returns the submenu for the specified |command_id| or empty if invalid.CefMenuModelgetSubMenuAt(int index)Returns the submenu at the specified |index| or empty if invalid.CefMenuModel.MenuItemTypegetType(int command_id)Returns the item type for the specified |command_id|.CefMenuModel.MenuItemTypegetTypeAt(int index)Returns the item type at the specified |index|.booleanhasAccelerator(int command_id)Returns true if the specified |command_id| has a keyboard accelerator assigned.booleanhasAcceleratorAt(int index)Returns true if the specified |index| has a keyboard accelerator assigned.booleaninsertCheckItemAt(int index, int command_id, java.lang.String label)Insert a check item in the menu at the specified |index|.booleaninsertItemAt(int index, int command_id, java.lang.String label)Insert an item in the menu at the specified |index|.booleaninsertRadioItemAt(int index, int command_id, java.lang.String label, int group_id)Insert a radio item in the menu at the specified |index|.booleaninsertSeparatorAt(int index)Insert a separator in the menu at the specified |index|.CefMenuModelinsertSubMenuAt(int index, int command_id, java.lang.String label)Insert a sub-menu in the menu at the specified |index|.booleanisChecked(int command_id)Returns true if the specified |command_id| is checked.booleanisCheckedAt(int index)Returns true if the specified |index| is checked.booleanisEnabled(int command_id)Returns true if the specified |command_id| is enabled.booleanisEnabledAt(int index)Returns true if the specified |index| is enabled.booleanisVisible(int command_id)Returns true if the specified |command_id| is visible.booleanisVisibleAt(int index)Returns true if the specified |index| is visible.booleanremove(int command_id)Removes the item with the specified |command_id|.booleanremoveAccelerator(int command_id)Remove the keyboard accelerator for the specified |command_id|.booleanremoveAcceleratorAt(int index)Remove the keyboard accelerator at the specified |index|.booleanremoveAt(int index)Removes the item at the specified |index|.booleansetAccelerator(int command_id, int key_code, boolean shift_pressed, boolean ctrl_pressed, boolean alt_pressed)Set the keyboard accelerator for the specified |command_id|.booleansetAcceleratorAt(int index, int key_code, boolean shift_pressed, boolean ctrl_pressed, boolean alt_pressed)Set the keyboard accelerator at the specified |index|.booleansetChecked(int command_id, boolean checked)Check the specified |command_id|.booleansetCheckedAt(int index, boolean checked)Check the specified |index|.booleansetCommandIdAt(int index, int command_id)Sets the command id at the specified |index|.booleansetEnabled(int command_id, boolean enabled)Change the enabled status of the specified |command_id|.booleansetEnabledAt(int index, boolean enabled)Change the enabled status at the specified |index|.booleansetGroupId(int command_id, int group_id)Sets the group id for the specified |command_id|.booleansetGroupIdAt(int index, int group_id)Sets the group id at the specified |index|.booleansetLabel(int command_id, java.lang.String label)Sets the label for the specified |command_id|.booleansetLabelAt(int index, java.lang.String label)Set the label at the specified |index|.booleansetVisible(int command_id, boolean visible)Change the visibility of the specified |command_id|.booleansetVisibleAt(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.
-
-