Table of Contents

Class NotepadPPGateway

Namespace
Npp.DotNet.Plugin
Assembly
Npp.DotNet.Plugin.dll

Helpers for sending messages defined in NppMsg.

public class NotepadPPGateway : INotepadPPGateway
Inheritance
NotepadPPGateway
Implements
Derived
Inherited Members

Fields

Unused

protected const int Unused = 0

Field Value

int

UnusedW

protected const uint UnusedW = 0

Field Value

uint

Methods

AddToolbarIcon(int, ToolbarIcon)

public void AddToolbarIcon(int funcItemsIndex, ToolbarIcon icon)

Parameters

funcItemsIndex int
icon ToolbarIcon

AddToolbarIcon(int, ToolbarIconDarkMode)

public void AddToolbarIcon(int funcItemsIndex, ToolbarIconDarkMode icon)

Parameters

funcItemsIndex int
icon ToolbarIconDarkMode

AddToolbarIcon(int, Bitmap)

public void AddToolbarIcon(int funcItemsIndex, Bitmap icon)

Parameters

funcItemsIndex int
icon Bitmap

DefaultModificationFlagsChanged()

Returns true if the active SCN_MODIFIED event mask has been changed from NPP_DEFAULT_SC_MOD_MASK.

public bool DefaultModificationFlagsChanged()

Returns

bool

Remarks

Added in 8.7.7

FileNew()

public void FileNew()

GetConfigDirectory()

Figure out default N++ config file path
Path is usually %UserProfile%\AppData\Roaming\Notepad++\plugins\config

public string GetConfigDirectory()

Returns

string

GetCurrentFilePath()

Gets the path of the current document.

public string GetCurrentFilePath()

Returns

string

GetCurrentLine()

Gets the text of the currently active line.

public string GetCurrentLine()

Returns

string

The text of the active line.

GetCurrentWord()

Gets the word currently under the caret.

public string GetCurrentWord()

Returns

string

The word under the caret.

GetFilePath(UIntPtr)

Gets the path of the current document.

public string GetFilePath(UIntPtr bufferId)

Parameters

bufferId UIntPtr

Returns

string

GetNativeLanguage()

Get the name of the active localization file.

public string GetNativeLanguage()

Returns

string

N++ 8.7 and later

The name of the active localization file, without the .xml extension.

Older versions

"english"

GetNppPath()

public string GetNppPath()

Returns

string

The path to the Notepad++ executable.

GetNppVersion()

public (int, int, int) GetNppVersion()

Returns

(int, int, int)

3-int tuple: (major, minor, bugfix)
Thus GetNppVersion() would return (8, 5, 0) for version 8.5.0 and (7, 7, 1) for version 7.7.1

GetOpenFileNames()

public string[] GetOpenFileNames()

Returns

string[]

GetPluginConfigPath()

public string GetPluginConfigPath()

Returns

string

The path to the Config folder for plugins.

GetPluginsHomePath()

public string GetPluginsHomePath()

Returns

string

The path to the top directory of all installed plugins.

GetSessionFilePath()

public string GetSessionFilePath()

Returns

string

IsDarkModeEnabled()

Checks the return value of the NPPM_ISDARKMODEENABLED message.

public bool IsDarkModeEnabled()

Returns

bool

true if NPPM_ISDARKMODEENABLED returns 1, otherwise false.

Remarks

Added in 8.4.1

OpenFile(string)

Open a file for editing in Notepad++, pretty much like using the app's File - Open menu.

public bool OpenFile(string path)

Parameters

path string

The path to the file to open.

Returns

bool

true on success, otherwise false.

SaveCurrentFile()

Open a standard save file dialog to save the current file.

public bool SaveCurrentFile()

Returns

bool

true if the file was saved, otherwise false.

SetCurrentLanguage(LangType)

public void SetCurrentLanguage(LangType language)

Parameters

language LangType

SetModificationFlags(ModificationFlags)

Sends NPPM_ADDSCNMODIFIEDFLAGS with the given flags.

public void SetModificationFlags(ModificationFlags flags)

Parameters

flags ModificationFlags

The additional ModificationFlags to monitor.

Remarks

Added in 8.7.7

SetStatusBarSection(string, StatusBarSection)

The status bar is the bar at the bottom with the document type, EOL type, current position, line, etc.
Set the message for one of the sections of that bar.

public void SetStatusBarSection(string message, StatusBarSection section)

Parameters

message string

Text to display.

section StatusBarSection

A StatusBarSection value.