Table of Contents

CadPluginMenuItem

from OpenCAD2D.Plugins import CadPluginMenuItem

class CadPluginMenuItem(System.Object) ยท CadPluginMenuItem in the .NET reference

An item of a menu a plugin adds to, as the presenter's CadExtensionMenuItem is for an extension: a line that runs a callback, a submenu, or a separator, ticked or not, on or off.

Constructors

__init__

.NET

def __init__(
    self,
    text: str,
    run: System.Action[CadPluginContext],
    isEnabled: bool = ...,
    isChecked: bool | None = ...,
) -> None

Makes an item that runs a callback.

def __init__(
    self,
    text: str,
    items: System.Collections.Generic.IReadOnlyList[CadPluginMenuItem],
    isEnabled: bool = ...,
    isChecked: bool | None = ...,
) -> None

Makes an item that opens a submenu.

Properties and fields

IsChecked

.NET

@property
def IsChecked(self) -> bool | None

Gets the tick: null for none, true for a ticked item, false for a tick box not ticked.

IsEnabled

.NET

@property
def IsEnabled(self) -> bool

Gets whether the item can be chosen.

IsSeparator

.NET

@property
def IsSeparator(self) -> bool

Gets whether the item is a separator line.

Items

.NET

@property
def Items(self) -> System.Collections.Generic.IReadOnlyList[CadPluginMenuItem]

Gets the items of a submenu; empty for the others.

Run

.NET

@property
def Run(self) -> System.Action[CadPluginContext] | None

Gets the callback; null for a submenu and a separator.

Text

.NET

@property
def Text(self) -> str

Gets the text; empty for a separator.

Methods

Separator

.NET

@staticmethod
def Separator() -> CadPluginMenuItem

Makes a separator line.