ContextMenuOptionsProvider interface
This page talks about ContextMenuOptionsProvider interface
This page talks about ContextMenuOptionsProvider interface
The interface defines a single method, isOptionEnabled
, which takes a label as an argument and returns a boolean indicating whether the option with the given label is enabled or not.
This interface is used by the ContextMenu
class to determine whether an option in the context menu should be enabled or disabled. When adding an option to the context menu, the ContextMenu
class checks if the selected widget is an instance of ContextMenuOptionsProvider
. If it is, the ContextMenu
class calls the isOptionEnabled
method on the selected widget to determine whether the option should be enabled or not.
In the textWidget class, There is an implementation of the isOptionEnabled
method that returns different values depending on the label of the option. For example, if the label is "Shadow", this method returns the value of the hasShadow
method. This allows you to control which options in the context menu are enabled or disabled based on the state of your widget.
Example: