Table of Contents

Class Utils

Namespace
Npp.DotNet.Plugin
Assembly
Npp.DotNet.Plugin.dll
public static class Utils
Inheritance
Utils
Inherited Members

Methods

CheckMenuItem(int, bool)

Sets the menu state of the plugin command associated with funcId, if any.

public static void CheckMenuItem(int funcId, bool isChecked)

Parameters

funcId int

Index within FuncItems of the menu item to check/uncheck.

isChecked bool

Whether the menu item should be checked or not.

CheckMenuItemToggle(int, ref bool)

If a menu item (in your plugin's drop-down menu) has a checkmark:

  • if it's checked, uncheck it
  • if it's unchecked, check it
public static void CheckMenuItemToggle(int funcId, ref bool isCurrentlyChecked)

Parameters

funcId int

Index within FuncItems of the menu item to check/uncheck.

isCurrentlyChecked bool

Whether the menu item should be checked or not.

GetCurrentScintilla()

Gets the window handle of the currently active Scintilla view.

public static IntPtr GetCurrentScintilla()

Returns

IntPtr

The window handle of either:

  • the main Scintilla view
  • the second Scintilla view

GetGatewayFactory()

public static Func<IScintillaGateway> GetGatewayFactory()

Returns

Func<IScintillaGateway>

MakeSeparator()

Adds a dividing line to the plugin command menu.

public static int MakeSeparator()

Returns

int

The new size of the FuncItems collection; can be used to determine the next available index.

SetCommand(string, PluginFunc)

Initializes a plugin command with no keyboard shortcut.

public static int SetCommand(string commandName, PluginFunc functionPointer)

Parameters

commandName string

Command name to display in the plugin menu.

functionPointer PluginFunc

A delegate of type PluginFunc.

Returns

int

The new size of the FuncItems collection; can be used to determine the next available index.

SetCommand(string, PluginFunc, ShortcutKey)

Initializes a plugin command with an optional keyboard shortcut.

public static int SetCommand(string commandName, PluginFunc functionPointer, ShortcutKey shortcut)

Parameters

commandName string

Command name to display in the plugin menu.

functionPointer PluginFunc

A delegate of type PluginFunc.

shortcut ShortcutKey

A ShortcutKey.

Returns

int

The new size of the FuncItems collection; can be used to determine the next available index.

SetCommand(string, PluginFunc, ShortcutKey, bool)

Initializes a plugin command with an optional keyboard shortcut and initial menu state.

public static int SetCommand(string commandName, PluginFunc functionPointer, ShortcutKey shortcut, bool checkOnInit)

Parameters

commandName string

Command name to display in the plugin menu.

functionPointer PluginFunc

A delegate of type PluginFunc.

shortcut ShortcutKey

A ShortcutKey.

checkOnInit bool

Whether or not this command's menu item should initially be checked.

Returns

int

The new size of the FuncItems collection; can be used to determine the next available index.