ooodev.adapter.awt.menu_partial module
- class ooodev.adapter.awt.menu_partial.MenuPartial(component, interface=com.sun.star.awt.XMenu)[source]
Bases:
objectPartial class for XMenu.
- Parameters:
component (XMenu) –
interface (UnoInterface | None) –
- __init__(component, interface=com.sun.star.awt.XMenu)[source]
Constructor
- Parameters:
component (XMenu) – UNO Component that implements
com.sun.star.awt.XMenuinterface.interface (UnoInterface, optional) – The interface to be validated. Defaults to
XMenu.
- Return type:
None
- add_menu_listener(listener)[source]
adds the specified menu listener to receive events from this menu.
- Return type:
None- Parameters:
listener (com.sun.star.awt.XMenuListener) –
- enable_auto_mnemonics(enable)[source]
Specifies whether mnemonics are automatically assigned to menu items, or not.
- Return type:
None- Parameters:
enable (bool) –
- enable_item(menu_id, enable=False)[source]
Enables or disables the menu item.
- Parameters:
menu_id (int) – The ID of the menu item.
enable (bool, optional) – The state of the menu item. Defaults to
False.
- Return type:
None
- get_command(menu_id)[source]
Gets the command string for the menu item.
- Return type:
str- Parameters:
menu_id (int) –
- get_help_command(menu_id)[source]
Gets the help command string for the menu item.
- Return type:
str- Parameters:
menu_id (int) –
- get_help_text(menu_id)[source]
Gets the help text for the menu item.
- Return type:
str- Parameters:
menu_id (int) –
- get_item_id(item_pos)[source]
Gets the ID of the item at the specified position.
- Return type:
int- Parameters:
item_pos (int) –
- get_item_pos(menu_id)[source]
Gets the position of the item with the specified ID.
- Return type:
int- Parameters:
menu_id (int) –
- get_item_text(menu_id)[source]
returns the string for the given item id.
- Return type:
str- Parameters:
menu_id (int) –
- get_item_type(item_pos)[source]
Gets the type of the menu item.
- Parameters:
item_pos (int) – The position of the menu item.
- Returns:
The type of the menu item.
- Return type:
MenuItemType
Hint
MenuItemTypeis an enum and can be imported fromooo.dyn.awt.menu_item_type.
- get_popup_menu(menu_id)[source]
Gets the popup menu from the menu item.
- Return type:
XPopupMenu- Parameters:
menu_id (int) –
- get_tip_help_text(item_id)[source]
retrieves the tip help text for the menu item.
- Return type:
str- Parameters:
item_id (int) –
- hide_disabled_entries(hide=True)[source]
Specifies whether disabled menu entries should be hidden, or not.
- Parameters:
hide (bool, optional) –
Trueto hide disabled entries,Falseto show them. Defaults toTrue.- Return type:
None
- insert_item(menu_id, text, item_style, item_pos)[source]
Inserts an item into the menu.
The item is appended if the position is greater than or equal to
get_item_count()or if it is negative.- Parameters:
menu_id (int) – The ID of the menu item.
text (str) – The text for the menu item.
item_style (int | MenuItemStyleKind) – The style of the menu item.
MenuItemStyleKindis a flag enum.item_pos (int) – The position of the menu item.
- Return type:
None
Hint
MenuItemStyleKindis an enum and can be imported fromooodev.utils.kind.menu_item_style_kind.
- is_item_enabled(menu_id)[source]
Gets the state of the menu item.
- Return type:
bool- Parameters:
menu_id (int) –
- remove_item(item_pos, count)[source]
Removes one or more items from the menu.
- Return type:
None- Parameters:
item_pos (int) –
count (int) –
- remove_menu_listener(listener)[source]
Removes the specified menu listener so that it no longer receives events from this menu.
- Return type:
None- Parameters:
listener (com.sun.star.awt.XMenuListener) –
- set_command(menu_id, command)[source]
Sets the command string for the menu item.
- Return type:
None- Parameters:
menu_id (int) –
command (str) –
- set_help_command(menu_id, command)[source]
Sets the help command string for the menu item.
- Return type:
None- Parameters:
menu_id (int) –
command (str) –
- set_help_text(menu_id, text)[source]
Sets the help text for the menu item.
- Return type:
None- Parameters:
menu_id (int) –
text (str) –
- set_item_text(menu_id, text)[source]
Sets the text for the menu item.
- Return type:
None- Parameters:
menu_id (int) –
text (str) –