LibreOffice: XPopupMenu Interface Reference

LibreOffice LibreOffice 25.8 SDK API Reference

Loading...
Searching...
No Matches
XPopupMenu Interface Referencepublished

controls a pop-up menu. More...

`import "XPopupMenu.idl";`

Inheritance diagram for XPopupMenu:

## Public Member Functions
void | insertSeparator ([in] short nItemPos)
| inserts a separator at the specified position.
void | setDefaultItem ([in] short nItemId)
| sets the menu default item.
short | getDefaultItem ()
| returns the menu default item.
void | checkItem ([in] short nItemId, [in] boolean bCheck)
| sets the state of the item to be checked or unchecked.
boolean | isItemChecked ([in] short nItemId)
| returns whether the item is checked or unchecked.
short | execute ([in] XWindowPeer Parent, [in] Rectangle Position, [in] short Direction)
| executes the popup menu and returns the selected item or `0`, if cancelled.
boolean | isInExecute ()
| queries if the PopupMenu is being.
void | endExecute ()
| ends the execution of the PopupMenu.
void | setAcceleratorKeyEvent ([in] short nItemId, [in] KeyEvent aKeyEvent)
| sets the KeyEvent for the menu item.
KeyEvent | getAcceleratorKeyEvent ([in] short nItemId)
| retrieves the KeyEvent for the menu item.
void | setItemImage ([in] short nItemId, [in] ::com::sun::star::graphic::XGraphic xGraphic, [in] boolean bScale)
| sets the image for the menu item.
::com::sun::star::graphic::XGraphic | getItemImage ([in] short nItemId)
| retrieves the image for the menu item.
Public Member Functions inherited from XMenu
void | addMenuListener ([in] XMenuListener xListener)
| adds the specified menu listener to receive events from this menu.
void | removeMenuListener ([in] XMenuListener xListener)
| removes the specified menu listener so that it no longer receives events from this menu.
void | insertItem ([in] short nItemId, [in] string aText, [in] short nItemStyle, [in] short nItemPos)
| inserts an item into the menu.
void | removeItem ([in] short nItemPos, [in] short nCount)
| removes one or more items from the menu.
void | clear ()
| removes all items from the menu.
short | getItemCount ()
| returns the number of items in the menu.
short | getItemId ([in] short nItemPos)
| returns the ID of the item at the specified position.
short | getItemPos ([in] short nItemId)
| returns the position of the item with the specified ID.
::com::sun::star::awt::MenuItemType | getItemType ([in] short nItemPos)
| retrieves the type of the menu item.
void | enableItem ([in] short nItemId, [in] boolean bEnable)
| enables or disables the menu item.
boolean | isItemEnabled ([in] short nItemId)
| returns the state of the menu item.
void | hideDisabledEntries ([in] boolean bHide)
| specifies whether disabled menu entries should be hidden, or not.
void | enableAutoMnemonics ([in] boolean bEnable)
| specifies whether mnemonics are automatically assigned to menu items, or not.
void | setItemText ([in] short nItemId, [in] string aText)
| sets the text for the menu item.
string | getItemText ([in] short nItemId)
| returns the string for the given item id.
void | setCommand ([in] short nItemId, [in] string aCommand)
| sets the command string for the menu item.
string | getCommand ([in] short nItemId)
| retrieves the command string for the menu item.
void | setHelpCommand ([in] short nItemId, [in] string aCommand)
| sets the help command string for the menu item.
string | getHelpCommand ([in] short nItemId)
| retrieves the help command string for the menu item.
void | setHelpText ([in] short nItemId, [in] string sHelpText)
| sets the help text for the menu item.
string | getHelpText ([in] short nItemId)
| retrieves the help text for the menu item.
void | setTipHelpText ([in] short nItemId, [in] string sTipHelpText)
| sets the tip help text for the menu item.
string | getTipHelpText ([in] short nItemId)
| retrieves the tip help text for the menu item.
boolean | isPopupMenu ()
| checks whether an XMenu is an XPopupMenu.
void | setPopupMenu ([in] short nItemId, [in] XPopupMenu aPopupMenu)
| sets the popup menu for a specified menu item.
XPopupMenu | getPopupMenu ([in] short nItemId)
| returns the popup menu from the menu item.
Public Member Functions inherited from XInterface
any | queryInterface ([in] type aType)
| queries for a new interface to an existing UNO object.
void | acquire ()
| increases the reference counter by one.
void | release ()
| decreases the reference counter by one.

## Detailed Description

controls a pop-up menu.

## Member Function Documentation

## ◆ checkItem()

void checkItem | ( | [in] short | nItemId,
|  | [in] boolean | bCheck )

sets the state of the item to be checked or unchecked.

Parameters

  nItemId | specifies the menu item identifier.
  bCheck | specifies if the item is checked (TRUE) or unchecked (FALSE).

## ◆ endExecute()

void endExecute | ( |  | ) |

ends the execution of the PopupMenu.

com::sun::star::awt::XPopupMenu::execute() will then return 0.

See also
  com::sun::star::awt::XPopupMenu::execute()

## ◆ execute()

short execute | ( | [in] XWindowPeer | Parent,
|  | [in] Rectangle | Position,
|  | [in] short | Direction )

executes the popup menu and returns the selected item or `0`, if cancelled.

Parameters

  Parent | the parent window.
  Position | a Rectangle representing the coordinates system where the popup menu should be executed.
  Direction | the direction in which a popup menu will grow, as specified by one of the PopupMenuDirection constants.

Returns
  returns the selected item or `0`, if cancelled.

## ◆ getAcceleratorKeyEvent()

KeyEvent getAcceleratorKeyEvent | ( | [in] short | nItemId | ) |

retrieves the KeyEvent for the menu item.

The KeyEvent is only used as a container to transport the shortcut information, so that in this case com::sun::star::lang::EventObject::Source is NULL.

Parameters

  nItemId | specifies the menu item identifier for which the KeyEvent should be retrieved.

Returns
  the KeyEvent struct assigned to the requested menu item.

## ◆ getDefaultItem()

short getDefaultItem | ( |  | ) |

returns the menu default item.

Returns
  the ID of the default item.

## ◆ getItemImage()

::com::sun::star::graphic::XGraphic getItemImage | ( | [in] short | nItemId | ) |

retrieves the image for the menu item.

Parameters

  nItemId | specifies the menu item identifier for which the image should be retrieved.

Returns
  a XGraphic reference to the current image for the requested menu item.

## ◆ insertSeparator()

void insertSeparator | ( | [in] short | nItemPos | ) |

inserts a separator at the specified position.

Parameters

  nItemPos | specifies the position where the menu separator will be inserted.

## ◆ isInExecute()

boolean isInExecute | ( |  | ) |

queries if the PopupMenu is being.

Returns TRUE only if the PopupMenu is being executed as a result of invoking XPopupMenu::execute(); that is, for a PopupMenu activated by a MenuBar item, this methods returns FALSE.

Returns
  TRUE if the PopupMenu is being executed, FALSE otherwise.

See also
  XPopupMenu::execute()

## ◆ isItemChecked()

boolean isItemChecked | ( | [in] short | nItemId | ) |

returns whether the item is checked or unchecked.

Parameters

  nItemId | specifies the menu item identifier.

Returns
  TRUE if the item is checked, FALSE otherwise.

## ◆ setAcceleratorKeyEvent()

void setAcceleratorKeyEvent | ( | [in] short | nItemId,
|  | [in] KeyEvent | aKeyEvent )

sets the KeyEvent for the menu item.

The KeyEvent is only used as a container to transport the shortcut information, this methods only draws the text corresponding to this keyboard shortcut. The client code is responsible for listening to keyboard events (typically done via XUserInputInterception), and dispatch the respective command.

Parameters

  nItemId | specifies the menu item identifier for which the KeyEvent should be set.
  aKeyEvent | specifies the KeyEvent for the menu item.

## ◆ setDefaultItem()

void setDefaultItem | ( | [in] short | nItemId | ) |

sets the menu default item.

Parameters

  nItemId | specifies the menu item identifier.

## ◆ setItemImage()

void setItemImage | ( | [in] short | nItemId,
|  | [in] ::com::sun::star::graphic::XGraphic | xGraphic,
|  | [in] boolean | bScale )

sets the image for the menu item.

Parameters

  nItemId | specifies the menu item identifier for which the image should be set.
  xGraphic | specifies the image for the menu item.
  bScale | if TRUE, the image will be scaled to the standard size used internally by the implementation.

The documentation for this interface was generated from the following file:

- com/sun/star/awt/XPopupMenu.idl