ooodev.adapter.awt.popup_menu_comp module

class ooodev.adapter.awt.popup_menu_comp.PopupMenuComp(component)[source]

Bases: ComponentProp, PopupMenuPartial, MenuEvents

Class for managing PopupMenu Component.

Events for this component are managed by the MenuEvents class.

Event Callbacks are passed the following positional arguments:
  • src: The source of the event.

  • event: The event arguments. The event_data attribute contains com.sun.star.awt.MenuEvent.

  • menu: The popup menu component that triggered the event.

Example

def on_menu_Highlighted(src: Any, event: EventArgs,  menu: PopupMenuComp) -> None:
    print("Menu Highlighted")
    me = cast("MenuEvent", event.event_data)
    print("MenuId", me.MenuId)
Parameters:

component (XPopupMenu) –

__init__(component)[source]

Constructor

Parameters:

component (UnoControlDialog) – UNO Component that supports com.sun.star.awt.PopupMenu` service.

Return type:

None

add_event_item_activated(cb)[source]

Adds a callback for the item activated event for all menu items in the current instance.

Parameters:

cb (Callable[[Any, EventArgs, PopupMenuComp], None]) – Callback function.

Return type:

None

add_event_item_deactivated(cb)[source]

Adds a callback for the item deactivated event for all menu items in the current instance.

Parameters:

cb (Callable[[Any, EventArgs, PopupMenuComp], None]) – Callback function.

Return type:

None

add_event_item_highlighted(cb)[source]

Adds a callback for the item highlighted event for all menu items in the current instance.

Parameters:

cb (Callable[[Any, EventArgs, PopupMenuComp], None]) – Callback function.

Return type:

None

add_event_item_selected(cb)[source]

Adds a callback for the item selected event for all menu items in the current instance.

Parameters:

cb (Callable[[Any, EventArgs, PopupMenuComp], None]) – Callback function.

Return type:

None

add_event_menu_events_disposing(cb)[source]

Adds a callback for the menu events disposing event for all menu items in the current instance.

Parameters:

cb (Callable[[Any, EventArgs, PopupMenuComp], None]) – Callback function.

Return type:

None

classmethod from_lo(lo_inst=None)[source]

Creates the instance from the Lo.

Parameters:

lo_inst (LoInst, optional) – LoInst, Defaults to Lo.current_lo.

Returns:

The instance.

Return type:

PopupMenuComp

get_popup_menu(menu_id)[source]

Gets the popup menu from the menu item.

Return type:

Optional[Self]

Parameters:

menu_id (int) –

remove_event_item_activated(cb)[source]

Removes a callback for the item activated event for all menu items in the current instance.

Parameters:

cb (Callable[[Any, EventArgs, PopupMenuComp], None]) – Callback function.

Return type:

None

remove_event_item_deactivated(cb)[source]

Removes a callback for the item deactivated event for all menu items in the current instance.

Parameters:

cb (Callable[[Any, EventArgs, PopupMenuComp], None]) – Callback function.

Return type:

None

remove_event_item_highlighted(cb)[source]

Removes a callback for the item highlighted event for all menu items in the current instance.

Parameters:

cb (Callable[[Any, EventArgs, PopupMenuComp], None]) – Callback function.

Return type:

None

remove_event_item_selected(cb)[source]

Removes a callback for the item selected event for all menu items in the current instance.

Parameters:

cb (Callable[[Any, EventArgs, PopupMenuComp], None]) – Callback function.

Return type:

None

remove_event_menu_events_disposing(cb)[source]

Removes a callback for the menu events disposing event for all menu items in the current instance.

Parameters:

cb (Callable[[Any, EventArgs, PopupMenuComp], None]) – Callback function.

Return type:

None

subscribe_all_item_activated(cb)[source]

Adds a callbacks for the item activated event for all menu and submenus items.

Parameters:

cb (Callable[[Any, EventArgs, PopupMenuComp], None]) – Callback function.

Return type:

None

subscribe_all_item_deactivated(cb)[source]

Adds a callbacks for the item deactivated event for all menu and submenus items.

Parameters:

cb (Callable[[Any, EventArgs, PopupMenuComp], None]) – Callback function.

Return type:

None

subscribe_all_item_highlighted(cb)[source]

Adds a callbacks for the item highlighted event for all menu and submenus items.

Parameters:

cb (Callable[[Any, EventArgs, PopupMenuComp], None]) – Callback function.

Return type:

None

subscribe_all_item_selected(cb)[source]

Adds a callbacks for the item selected event for all menu and submenus items.

Parameters:

cb (Callable[[Any, EventArgs, PopupMenuComp], None]) – Callback function.

Return type:

None

unsubscribe_all_item_activated(cb)[source]

Remove callbacks for the item selected event for all menu and submenus items.

Parameters:

cb (Callable[[Any, EventArgs, PopupMenuComp], None]) – Callback function.

Return type:

None

unsubscribe_all_item_deactivated(cb)[source]

Remove callbacks for the item deactivated event for all menu and submenus items.

Parameters:

cb (Callable[[Any, EventArgs, PopupMenuComp], None]) – Callback function.

Return type:

None

unsubscribe_all_item_highlighted(cb)[source]

Remove callbacks for the item highlighted event for all menu and submenus items.

Parameters:

cb (Callable[[Any, EventArgs, PopupMenuComp], None]) – Callback function.

Return type:

None

unsubscribe_all_item_selected(cb)[source]

Remove callbacks for the item selected event for all menu and submenus items.

Parameters:

cb (Callable[[Any, EventArgs, PopupMenuComp], None]) – Callback function.

Return type:

None

property component: com.sun.star.awt.PopupMenu

PopupMenu Component

Return type:

PopupMenu