KiCad PCB EDA Suite
Loading...
Searching...
No Matches
SCINTILLA_TRICKS Class Reference

Add cut/copy/paste, dark theme, autocomplete and brace highlighting to a wxStyleTextCtrl instance. More...

#include <scintilla_tricks.h>

Inheritance diagram for SCINTILLA_TRICKS:

Public Member Functions

 SCINTILLA_TRICKS (wxStyledTextCtrl *aScintilla, const wxString &aBraces, bool aSingleLine, std::function< void(wxKeyEvent &)> onAcceptHandler=[](wxKeyEvent &aEvent) { }, std::function< void(wxStyledTextEvent &)> onCharAddedHandler=[](wxStyledTextEvent &) { })
 
wxStyledTextCtrl * Scintilla () const
 
void DoTextVarAutocomplete (const std::function< void(const wxString &xRef, wxArrayString *tokens)> &getTokensFn)
 
void DoAutocomplete (const wxString &aPartial, const wxArrayString &aTokens)
 
void CancelAutocomplete ()
 

Protected Member Functions

void setupStyles ()
 
int firstNonWhitespace (int aLine, int *aWhitespaceCount=nullptr)
 
virtual void onCharHook (wxKeyEvent &aEvent)
 
void onChar (wxStyledTextEvent &aEvent)
 
void onModified (wxStyledTextEvent &aEvent)
 
void onScintillaUpdateUI (wxStyledTextEvent &aEvent)
 
void onThemeChanged (wxSysColourChangedEvent &aEvent)
 

Protected Attributes

wxStyledTextCtrl * m_te
 
wxString m_braces
 
int m_lastCaretPos
 
int m_lastSelStart
 
int m_lastSelEnd
 
bool m_suppressAutocomplete
 
bool m_singleLine
 
std::function< void(wxKeyEvent &aEvent)> m_onAcceptFn
 
std::function< void(wxStyledTextEvent &aEvent)> m_onCharAddedFn
 

Detailed Description

Add cut/copy/paste, dark theme, autocomplete and brace highlighting to a wxStyleTextCtrl instance.

Definition at line 35 of file scintilla_tricks.h.

Constructor & Destructor Documentation

◆ SCINTILLA_TRICKS()

SCINTILLA_TRICKS::SCINTILLA_TRICKS ( wxStyledTextCtrl *  aScintilla,
const wxString &  aBraces,
bool  aSingleLine,
std::function< void(wxKeyEvent &)>  onAcceptHandler = []( wxKeyEvent& aEvent ) { },
std::function< void(wxStyledTextEvent &)>  onCharAddedHandler = []( wxStyledTextEvent& ) { } 
)

Member Function Documentation

◆ CancelAutocomplete()

void SCINTILLA_TRICKS::CancelAutocomplete ( )

◆ DoAutocomplete()

void SCINTILLA_TRICKS::DoAutocomplete ( const wxString &  aPartial,
const wxArrayString &  aTokens 
)

◆ DoTextVarAutocomplete()

void SCINTILLA_TRICKS::DoTextVarAutocomplete ( const std::function< void(const wxString &xRef, wxArrayString *tokens)> &  getTokensFn)

◆ firstNonWhitespace()

int SCINTILLA_TRICKS::firstNonWhitespace ( int  aLine,
int *  aWhitespaceCount = nullptr 
)
protected

Definition at line 488 of file scintilla_tricks.cpp.

References m_te.

Referenced by onCharHook().

◆ onChar()

void SCINTILLA_TRICKS::onChar ( wxStyledTextEvent &  aEvent)
protected

Definition at line 176 of file scintilla_tricks.cpp.

References m_onCharAddedFn.

Referenced by SCINTILLA_TRICKS().

◆ onCharHook()

void SCINTILLA_TRICKS::onCharHook ( wxKeyEvent &  aEvent)
protectedvirtual

◆ onModified()

void SCINTILLA_TRICKS::onModified ( wxStyledTextEvent &  aEvent)
protected

Definition at line 182 of file scintilla_tricks.cpp.

References m_singleLine, m_te, and text.

Referenced by SCINTILLA_TRICKS().

◆ onScintillaUpdateUI()

void SCINTILLA_TRICKS::onScintillaUpdateUI ( wxStyledTextEvent &  aEvent)
protected

Definition at line 516 of file scintilla_tricks.cpp.

References m_braces, m_lastCaretPos, m_lastSelEnd, m_lastSelStart, and m_te.

Referenced by SCINTILLA_TRICKS().

◆ onThemeChanged()

void SCINTILLA_TRICKS::onThemeChanged ( wxSysColourChangedEvent &  aEvent)
protected

Definition at line 90 of file scintilla_tricks.cpp.

References setupStyles().

Referenced by SCINTILLA_TRICKS().

◆ Scintilla()

wxStyledTextCtrl * SCINTILLA_TRICKS::Scintilla ( ) const
inline

◆ setupStyles()

Member Data Documentation

◆ m_braces

wxString SCINTILLA_TRICKS::m_braces
protected

Definition at line 69 of file scintilla_tricks.h.

Referenced by onScintillaUpdateUI(), and SCINTILLA_TRICKS().

◆ m_lastCaretPos

int SCINTILLA_TRICKS::m_lastCaretPos
protected

Definition at line 70 of file scintilla_tricks.h.

Referenced by onScintillaUpdateUI().

◆ m_lastSelEnd

int SCINTILLA_TRICKS::m_lastSelEnd
protected

Definition at line 72 of file scintilla_tricks.h.

Referenced by onScintillaUpdateUI().

◆ m_lastSelStart

int SCINTILLA_TRICKS::m_lastSelStart
protected

Definition at line 71 of file scintilla_tricks.h.

Referenced by onScintillaUpdateUI().

◆ m_onAcceptFn

std::function<void( wxKeyEvent& aEvent )> SCINTILLA_TRICKS::m_onAcceptFn
protected

Definition at line 78 of file scintilla_tricks.h.

Referenced by onCharHook().

◆ m_onCharAddedFn

std::function<void( wxStyledTextEvent& aEvent )> SCINTILLA_TRICKS::m_onCharAddedFn
protected

Definition at line 79 of file scintilla_tricks.h.

Referenced by onChar(), and onCharHook().

◆ m_singleLine

bool SCINTILLA_TRICKS::m_singleLine
protected

Definition at line 74 of file scintilla_tricks.h.

Referenced by onCharHook(), onModified(), SCINTILLA_TRICKS(), and setupStyles().

◆ m_suppressAutocomplete

bool SCINTILLA_TRICKS::m_suppressAutocomplete
protected

Definition at line 73 of file scintilla_tricks.h.

Referenced by DoAutocomplete(), and onCharHook().

◆ m_te


The documentation for this class was generated from the following files: