Class NotepadPPGateway
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
UnusedW
protected const uint UnusedW = 0
Field Value
Methods
AddToolbarIcon(int, ToolbarIcon)
Associates the plugin command identified by funcItemsIndex
with the set of icons defined by the given ToolbarIcon instance.
public void AddToolbarIcon(int funcItemsIndex, ToolbarIcon icon)
Parameters
funcItemsIndex
inticon
ToolbarIcon
AddToolbarIcon(int, ToolbarIconDarkMode)
Associates the plugin command identified by funcItemsIndex
with the set of icons defined by the given ToolbarIconDarkMode instance.
public void AddToolbarIcon(int funcItemsIndex, ToolbarIconDarkMode icon)
Parameters
funcItemsIndex
inticon
ToolbarIconDarkMode
AddToolbarIcon(int, Bitmap)
Associates the given bitmap with the plugin command identified by funcItemsIndex
.
public void AddToolbarIcon(int funcItemsIndex, Bitmap icon)
Parameters
DefaultModificationFlagsChanged()
Returns true if the active SCN_MODIFIED event mask has been changed from NPP_DEFAULT_SC_MOD_MASK.
public bool DefaultModificationFlagsChanged()
Returns
Remarks
Added in 8.7.7
FileNew()
Creates a new buffer by invoking the File - New menu command.
public void FileNew()
GetConfigDirectory()
Figure out default N++ config file path
Path is usually %UserProfile%\AppData\Roaming\Notepad++\plugins\config
public string GetConfigDirectory()
Returns
GetCurrentFilePath()
Gets the path of the current document.
public string GetCurrentFilePath()
Returns
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 document with the given bufferId
.
public string GetFilePath(UIntPtr bufferId)
Parameters
bufferId
UIntPtr
Returns
- string
The full file path of the document, if
bufferId
is valid; otherwise, an empty 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()
Get the full path names of all files currently open in all views.
public string[] GetOpenFileNames()
Returns
- string[]
The combined list of open files in both the PRIMARY_VIEW and the SECOND_VIEW.
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
The path to
session.xml
.
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
stringThe path to the file to open.
Returns
SaveCurrentFile()
Open a standard save file dialog to save the current file.
public bool SaveCurrentFile()
Returns
SetCurrentLanguage(LangType)
Sets the syntax mode of the current buffer to the given programming language
.
public void SetCurrentLanguage(LangType language)
Parameters
language
LangType
SetModificationFlags(ModificationFlags)
Sends NPPM_ADDSCNMODIFIEDFLAGS with the given flags
.
public void SetModificationFlags(ModificationFlags flags)
Parameters
flags
ModificationFlagsThe 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
stringText to display.
section
StatusBarSectionA StatusBarSection value.