Table of Contents

Class CadPluginHost

Namespace
OpenCAD2D.Plugins
Assembly
OpenCAD2D.Core.dll

What a plugin adds to the window in Initialize(CadPluginHost): ribbon tabs and panels, Properties rows, DRAWINGS buttons and menu items, canvas menu items and object snaps. It is a registrar and not a window: it keeps the descriptions, and the window reads them from Host when a plugin is loaded or unloaded and draws them, so a test reads the same lists headless. The Add methods take additions only while Initialize runs.

public sealed class CadPluginHost
Inheritance
CadPluginHost
Inherited Members

Properties

CanvasMenus

Gets the canvas menu providers added, in the order added.

DrawingsButtons

Gets the DRAWINGS buttons added, in the order added.

DrawingsMenus

Gets the DRAWINGS menu providers added, in the order added.

Folder

Gets the folder the plugin was loaded from, as given and not its shadow copy, where files beside it can be read (Path.Combine(host.Folder, "circle16.png")); the folder of a package the plugin's files were unpacked into; null for a plugin made with FromAssemblies(string, IEnumerable<Assembly>, string) from assemblies that have no location.

IsEmpty

Gets whether nothing was added.

ObjectSnaps

Gets the object snaps added, in the order added.

PluginName

Gets the plugin's name.

PropertyProviders

Gets the Properties providers added, in the order added.

RibbonPanels

Gets the panels added to the Plugins tab, which shows while a plugin has added a panel, in the order added.

RibbonTabs

Gets the tabs added, in the order added.

ShowsCommandButtons

Gets or sets whether the plugin's commands get a button each: true until set. The presenter no longer has a "Command plugins" panel, so the value changes nothing in it; it is kept for plugins written against it.

Methods

AddCanvasMenu(CadCanvasMenuProvider)

Adds items to the right-click menu of the canvas for the objects selected, after the extensions' items and before the presenter's own.

AddDrawingsButton(CadPluginButton)

Adds a button to the DRAWINGS header, left of the extensions' buttons and the presenter's Refresh and Open.

AddDrawingsMenu(CadDrawingsMenuProvider)

Adds items to the right-click menu of a DRAWINGS row, after a separator, asked each time the menu opens.

AddObjectSnap(CadCustomSnap)

Adds an object snap. A keyword another loaded plugin, or an earlier snap of this one, uses leaves the snap out, with a line in Problems.

AddProperties(CadPropertyProvider)

Adds a provider of Properties rows, run after the extensions' for every selection, as AutoCAD's dynamic properties are.

AddRibbonPanel(CadRibbonPanel)

Adds a panel to the Plugins tab, which shows only while a plugin has added a panel.

AddRibbonTab(CadRibbonTab)

Adds a ribbon tab: after the Plugins tab and before Settings, in the order the plugins were loaded. Its panels are read when Initialize returns, so they may be added to it afterwards here. A tab whose id another loaded plugin, or an earlier tab of this one, uses is left out, with a line in Problems.