|
Display a menu in the menubar of a document (form document to be done)
After use, the menu will not be saved neither in the application settings,
nor in the document. The menu setting does not affect the modified status of the
document.
The menu will be displayed, as usual, when its header in the menubar is clicked.
When one of its items is selected, there are 3 alternative options:
- a UNO command (like ".uno:About") is triggered
- a user script is run receiving a standard argument defined in this service
- one of above combined with a toggle of the status of the item
The menu is described from top to bottom.
Each menu item receives a numeric and a string identifier.
Each menu item may be decorated with a tooltip and/or an icon.
The AddItem(), AddCheckBox() and AddRadioButton() methods, when
coompared with their equivalents in the SF_PopupMenu service,
receive 2 additional arguments: Command and Script.
The various document services receive 2 additional methods:
CreateMenu(), returning a Menu service instance
RemoveMenu()
Very short example:
menu = doc.CreateMenu("My menu", Before := "Help")
menu.AddItem("First Item", Command := "About")
menu.AddItem('2nd Item", Script := "... URI notation ...")
menu.Dispose() ' Once set the menu object may ve erased, listeners stay tuned
Later in the lifecycle of the document, one may run:
doc.RemoveMenu("My menu") ' doc.RemoveMenu("File") works as well !!!
All the functionalities are available both in Basic and Python user scripts.
Change-Id: Iabd157573693e9648fcb06d36c90af9a22b17a6c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126309
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
The SFWidgets library is intended to host the Toolbar,
ToolbarControl (both future) and PopupMenu services.
A popup menu is usually triggered by a mouse action
(typically a right-click) on a dialog, a form, or one of their controls.
In these cases the menu will be displayed below the clicked area.
When triggered by other events, including in the normal flow
of a user script, the script should provide the coordinates
of the topleft edge of the menu versus the actual component.
The menu is described from top to bottom with next methods:
AddItem()
AddCheckBox()
AddRadioButton()
Example:
.AddCheckBox("View>Toolbars>Dialog")
.AddCheckBox("View>Toolbars>Find", Status := True)
.AddCheckBox("View>Status Bar", Status := True)
.AddItem("View>Full Screen", Name := "FULLSCREEN")
The SubmenuCharacter (Default = ">") is modifiable.
Each menu item receives a numeric and a string identifier.
The execute() method returns the item selected by the user.
The service is available both from Basic and Python user scripts.
The commit includes the review of build files to include
the new library and the new modules.
Change-Id: I2940be25313cc8fff7b337766edd348b04a20584
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123654
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|