// Created: 13-Jan-2000
// RCS-ID: $Id$
// Copyright: (c) 2000 by Total Control Software
-// Licence: wxWindows license
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
/*
#include "wx/tokenzr.h"
#include "wx/mstream.h"
#include "wx/image.h"
-#include "wx/file.h"
+#include "wx/ffile.h"
#include "ScintillaWX.h"
//----------------------------------------------------------------------
-const wxChar* wxSTCNameStr = wxT("stcwindow");
+const char wxSTCNameStr[] = "stcwindow";
#ifdef MAKELONG
#undef MAKELONG
//----------------------------------------------------------------------
-DEFINE_EVENT_TYPE( wxEVT_STC_CHANGE )
-DEFINE_EVENT_TYPE( wxEVT_STC_STYLENEEDED )
-DEFINE_EVENT_TYPE( wxEVT_STC_CHARADDED )
-DEFINE_EVENT_TYPE( wxEVT_STC_SAVEPOINTREACHED )
-DEFINE_EVENT_TYPE( wxEVT_STC_SAVEPOINTLEFT )
-DEFINE_EVENT_TYPE( wxEVT_STC_ROMODIFYATTEMPT )
-DEFINE_EVENT_TYPE( wxEVT_STC_KEY )
-DEFINE_EVENT_TYPE( wxEVT_STC_DOUBLECLICK )
-DEFINE_EVENT_TYPE( wxEVT_STC_UPDATEUI )
-DEFINE_EVENT_TYPE( wxEVT_STC_MODIFIED )
-DEFINE_EVENT_TYPE( wxEVT_STC_MACRORECORD )
-DEFINE_EVENT_TYPE( wxEVT_STC_MARGINCLICK )
-DEFINE_EVENT_TYPE( wxEVT_STC_NEEDSHOWN )
-DEFINE_EVENT_TYPE( wxEVT_STC_PAINTED )
-DEFINE_EVENT_TYPE( wxEVT_STC_USERLISTSELECTION )
-DEFINE_EVENT_TYPE( wxEVT_STC_URIDROPPED )
-DEFINE_EVENT_TYPE( wxEVT_STC_DWELLSTART )
-DEFINE_EVENT_TYPE( wxEVT_STC_DWELLEND )
-DEFINE_EVENT_TYPE( wxEVT_STC_START_DRAG )
-DEFINE_EVENT_TYPE( wxEVT_STC_DRAG_OVER )
-DEFINE_EVENT_TYPE( wxEVT_STC_DO_DROP )
-DEFINE_EVENT_TYPE( wxEVT_STC_ZOOM )
-DEFINE_EVENT_TYPE( wxEVT_STC_HOTSPOT_CLICK )
-DEFINE_EVENT_TYPE( wxEVT_STC_HOTSPOT_DCLICK )
-DEFINE_EVENT_TYPE( wxEVT_STC_CALLTIP_CLICK )
-DEFINE_EVENT_TYPE( wxEVT_STC_AUTOCOMP_SELECTION )
-DEFINE_EVENT_TYPE( wxEVT_STC_INDICATOR_CLICK )
-DEFINE_EVENT_TYPE( wxEVT_STC_INDICATOR_RELEASE )
+wxDEFINE_EVENT( wxEVT_STC_CHANGE, wxStyledTextEvent );
+wxDEFINE_EVENT( wxEVT_STC_STYLENEEDED, wxStyledTextEvent );
+wxDEFINE_EVENT( wxEVT_STC_CHARADDED, wxStyledTextEvent );
+wxDEFINE_EVENT( wxEVT_STC_SAVEPOINTREACHED, wxStyledTextEvent );
+wxDEFINE_EVENT( wxEVT_STC_SAVEPOINTLEFT, wxStyledTextEvent );
+wxDEFINE_EVENT( wxEVT_STC_ROMODIFYATTEMPT, wxStyledTextEvent );
+wxDEFINE_EVENT( wxEVT_STC_KEY, wxStyledTextEvent );
+wxDEFINE_EVENT( wxEVT_STC_DOUBLECLICK, wxStyledTextEvent );
+wxDEFINE_EVENT( wxEVT_STC_UPDATEUI, wxStyledTextEvent );
+wxDEFINE_EVENT( wxEVT_STC_MODIFIED, wxStyledTextEvent );
+wxDEFINE_EVENT( wxEVT_STC_MACRORECORD, wxStyledTextEvent );
+wxDEFINE_EVENT( wxEVT_STC_MARGINCLICK, wxStyledTextEvent );
+wxDEFINE_EVENT( wxEVT_STC_NEEDSHOWN, wxStyledTextEvent );
+wxDEFINE_EVENT( wxEVT_STC_PAINTED, wxStyledTextEvent );
+wxDEFINE_EVENT( wxEVT_STC_USERLISTSELECTION, wxStyledTextEvent );
+wxDEFINE_EVENT( wxEVT_STC_URIDROPPED, wxStyledTextEvent );
+wxDEFINE_EVENT( wxEVT_STC_DWELLSTART, wxStyledTextEvent );
+wxDEFINE_EVENT( wxEVT_STC_DWELLEND, wxStyledTextEvent );
+wxDEFINE_EVENT( wxEVT_STC_START_DRAG, wxStyledTextEvent );
+wxDEFINE_EVENT( wxEVT_STC_DRAG_OVER, wxStyledTextEvent );
+wxDEFINE_EVENT( wxEVT_STC_DO_DROP, wxStyledTextEvent );
+wxDEFINE_EVENT( wxEVT_STC_ZOOM, wxStyledTextEvent );
+wxDEFINE_EVENT( wxEVT_STC_HOTSPOT_CLICK, wxStyledTextEvent );
+wxDEFINE_EVENT( wxEVT_STC_HOTSPOT_DCLICK, wxStyledTextEvent );
+wxDEFINE_EVENT( wxEVT_STC_CALLTIP_CLICK, wxStyledTextEvent );
+wxDEFINE_EVENT( wxEVT_STC_AUTOCOMP_SELECTION, wxStyledTextEvent );
+wxDEFINE_EVENT( wxEVT_STC_INDICATOR_CLICK, wxStyledTextEvent );
+wxDEFINE_EVENT( wxEVT_STC_INDICATOR_RELEASE, wxStyledTextEvent );
+wxDEFINE_EVENT( wxEVT_STC_AUTOCOMP_CANCELLED, wxStyledTextEvent );
+wxDEFINE_EVENT( wxEVT_STC_AUTOCOMP_CHAR_DELETED, wxStyledTextEvent );
m_swx = new ScintillaWX(this);
m_stopWatch.Start();
m_lastKeyDownConsumed = false;
+ m_lastWheelTimestamp = 0;
m_vScrollBar = NULL;
m_hScrollBar = NULL;
#if wxUSE_UNICODE
//----------------------------------------------------------------------
-long wxStyledTextCtrl::SendMsg(int msg, long wp, long lp) const
+wxIntPtr wxStyledTextCtrl::SendMsg(int msg, wxUIntPtr wp, wxIntPtr lp) const
{
return m_swx->WndProc(msg, wp, lp);
}
// Add text to the document at current position.
void wxStyledTextCtrl::AddText(const wxString& text) {
wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
- SendMsg(2001, strlen(buf), (long)(const char*)buf);
+ SendMsg(2001, strlen(buf), (sptr_t)(const char*)buf);
}
// Add array of cells to document.
void wxStyledTextCtrl::AddStyledText(const wxMemoryBuffer& data) {
- SendMsg(2002, data.GetDataLen(), (long)data.GetData());
+ SendMsg(2002, data.GetDataLen(), (sptr_t)data.GetData());
}
// Insert string at a position.
void wxStyledTextCtrl::InsertText(int pos, const wxString& text)
{
- SendMsg(2003, pos, (long)(const char*)wx2stc(text));
+ SendMsg(2003, pos, (sptr_t)(const char*)wx2stc(text));
}
// Delete all text in the document.
SendMsg(2005, 0, 0);
}
-// Returns the number of characters in the document.
+// Returns the number of bytes in the document.
int wxStyledTextCtrl::GetLength() const
{
return SendMsg(2006, 0, 0);
tr.lpstrText = (char*)buf.GetWriteBuf(len*2+1);
tr.chrg.cpMin = startPos;
tr.chrg.cpMax = endPos;
- len = SendMsg(2015, 0, (long)&tr);
+ len = SendMsg(2015, 0, (sptr_t)&tr);
buf.UngetWriteBuf(len);
return buf;
}
// Are there any redoable actions in the undo history?
-bool wxStyledTextCtrl::CanRedo()
+bool wxStyledTextCtrl::CanRedo() const
{
return SendMsg(2016, 0, 0) != 0;
}
}
// Find the position from a point within the window.
-int wxStyledTextCtrl::PositionFromPoint(wxPoint pt) {
+int wxStyledTextCtrl::PositionFromPoint(wxPoint pt) const {
return SendMsg(2022, pt.x, pt.y);
}
wxMemoryBuffer mbuf(len+1);
char* buf = (char*)mbuf.GetWriteBuf(len+1);
- int pos = SendMsg(2027, len+1, (long)buf);
+ int pos = SendMsg(2027, len+1, (sptr_t)buf);
mbuf.UngetWriteBuf(len);
mbuf.AppendByte(0);
if (linePos) *linePos = pos;
const wxColour& background) {
SendMsg(2040, markerNumber, markerSymbol);
- if (foreground.Ok())
+ if (foreground.IsOk())
MarkerSetForeground(markerNumber, foreground);
- if (background.Ok())
+ if (background.IsOk())
MarkerSetBackground(markerNumber, background);
}
char* buff = new char[len+1];
strm.CopyTo(buff, len);
buff[len] = 0;
- SendMsg(2049, markerNumber, (long)buff);
+ SendMsg(2049, markerNumber, (sptr_t)buff);
delete [] buff;
}
// Set the font of a style.
void wxStyledTextCtrl::StyleSetFaceName(int style, const wxString& fontName)
{
- SendMsg(2056, style, (long)(const char*)wx2stc(fontName));
+ SendMsg(2056, style, (sptr_t)(const char*)wx2stc(fontName));
}
// Set a style to have its end of line filled or not.
long len = SendMsg(msg, style, 0);
wxMemoryBuffer mbuf(len+1);
char* buf = (char*)mbuf.GetWriteBuf(len+1);
- SendMsg(msg, style, (long)buf);
+ SendMsg(msg, style, (sptr_t)buf);
mbuf.UngetWriteBuf(len);
mbuf.AppendByte(0);
return stc2wx(buf);
SendMsg(2409, style, hotspot);
}
-// Set the foreground colour of the selection and whether to use this setting.
+// Set the foreground colour of the main and additional selections and whether to use this setting.
void wxStyledTextCtrl::SetSelForeground(bool useSetting, const wxColour& fore)
{
SendMsg(2067, useSetting, wxColourAsLong(fore));
}
-// Set the background colour of the selection and whether to use this setting.
+// Set the background colour of the main and additional selections and whether to use this setting.
void wxStyledTextCtrl::SetSelBackground(bool useSetting, const wxColour& back)
{
SendMsg(2068, useSetting, wxColourAsLong(back));
// Set the styles for a segment of the document.
void wxStyledTextCtrl::SetStyleBytes(int length, char* styleBytes) {
- SendMsg(2073, length, (long)styleBytes);
+ SendMsg(2073, length, (sptr_t)styleBytes);
}
// Set a style to be visible or not.
}
// Set the set of characters making up words for when moving or selecting by word.
-// First sets deaults like SetCharsDefault.
+// First sets defaults like SetCharsDefault.
void wxStyledTextCtrl::SetWordChars(const wxString& characters)
{
- SendMsg(2077, 0, (long)(const char*)wx2stc(characters));
+ SendMsg(2077, 0, (sptr_t)(const char*)wx2stc(characters));
}
// Start a sequence of actions that is undone and redone as a unit.
SendMsg(2085, useSetting, wxColourAsLong(back));
}
+// Set the size of the dots used to mark space characters.
+void wxStyledTextCtrl::SetWhitespaceSize(int size)
+{
+ SendMsg(2086, size, 0);
+}
+
+// Get the size of the dots used to mark space characters.
+int wxStyledTextCtrl::GetWhitespaceSize() const
+{
+ return SendMsg(2087, 0, 0);
+}
+
// Divide each styling byte into lexical class bits (default: 5) and indicator
// bits (default: 3). If a lexer requires more than 32 lexical states, then this
// is used to expand the possible states.
// the caret should be used to provide context.
void wxStyledTextCtrl::AutoCompShow(int lenEntered, const wxString& itemList)
{
- SendMsg(2100, lenEntered, (long)(const char*)wx2stc(itemList));
+ SendMsg(2100, lenEntered, (sptr_t)(const char*)wx2stc(itemList));
}
// Remove the auto-completion list from the screen.
// Define a set of character that when typed cancel the auto-completion list.
void wxStyledTextCtrl::AutoCompStops(const wxString& characterSet)
{
- SendMsg(2105, 0, (long)(const char*)wx2stc(characterSet));
+ SendMsg(2105, 0, (sptr_t)(const char*)wx2stc(characterSet));
}
// Change the separator character in the string setting up an auto-completion list.
// Select the item in the auto-completion list that starts with a string.
void wxStyledTextCtrl::AutoCompSelect(const wxString& text)
{
- SendMsg(2108, 0, (long)(const char*)wx2stc(text));
+ SendMsg(2108, 0, (sptr_t)(const char*)wx2stc(text));
}
// Should the auto-completion list be cancelled if the user backspaces to a
// choose the selected item.
void wxStyledTextCtrl::AutoCompSetFillUps(const wxString& characterSet)
{
- SendMsg(2112, 0, (long)(const char*)wx2stc(characterSet));
+ SendMsg(2112, 0, (sptr_t)(const char*)wx2stc(characterSet));
}
// Should a single item auto-completion list automatically choose the item.
// Display a list of strings and send notification when user chooses one.
void wxStyledTextCtrl::UserListShow(int listType, const wxString& itemList)
{
- SendMsg(2117, listType, (long)(const char*)wx2stc(itemList));
+ SendMsg(2117, listType, (sptr_t)(const char*)wx2stc(itemList));
}
// Set whether or not autocompletion is hidden automatically when nothing matches.
char* buff = new char[len+1];
strm.CopyTo(buff, len);
buff[len] = 0;
- SendMsg(2405, type, (long)buff);
+ SendMsg(2405, type, (sptr_t)buff);
delete [] buff;
}
wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
ft.lpstrText = (char*)(const char*)buf;
- return SendMsg(2150, flags, (long)&ft);
+ return SendMsg(2150, flags, (sptr_t)&ft);
}
// On Windows, will draw the document into a display context such as a printer.
fr.chrg.cpMin = startPos;
fr.chrg.cpMax = endPos;
- return SendMsg(2151, doDraw, (long)&fr);
+ return SendMsg(2151, doDraw, (sptr_t)&fr);
}
// Retrieve the display line at the top of the display.
}
// Retrieve the contents of a line.
-wxString wxStyledTextCtrl::GetLine(int line) {
+wxString wxStyledTextCtrl::GetLine(int line) const {
int len = LineLength(line);
if (!len) return wxEmptyString;
wxMemoryBuffer mbuf(len+1);
char* buf = (char*)mbuf.GetWriteBuf(len+1);
- SendMsg(2153, line, (long)buf);
+ SendMsg(2153, line, (sptr_t)buf);
mbuf.UngetWriteBuf(len);
mbuf.AppendByte(0);
return stc2wx(buf);
return SendMsg(2159, 0, 0) != 0;
}
-// Select a range of text.
-void wxStyledTextCtrl::SetSelection(int start, int end)
-{
- SendMsg(2160, start, end);
-}
-
// Retrieve the selected text.
wxString wxStyledTextCtrl::GetSelectedText() {
- int start;
- int end;
+ long start;
+ long end;
GetSelection(&start, &end);
int len = end - start;
wxMemoryBuffer mbuf(len+2);
char* buf = (char*)mbuf.GetWriteBuf(len+1);
- SendMsg(2161, 0, (long)buf);
+ SendMsg(2161, 0, (sptr_t)buf);
mbuf.UngetWriteBuf(len);
mbuf.AppendByte(0);
return stc2wx(buf);
tr.lpstrText = buf;
tr.chrg.cpMin = startPos;
tr.chrg.cpMax = endPos;
- SendMsg(2162, 0, (long)&tr);
+ SendMsg(2162, 0, (sptr_t)&tr);
mbuf.UngetWriteBuf(len);
mbuf.AppendByte(0);
return stc2wx(buf);
}
// Retrieve the line containing a position.
-int wxStyledTextCtrl::LineFromPosition(int pos)
+int wxStyledTextCtrl::LineFromPosition(int pos) const
{
return SendMsg(2166, pos, 0);
}
// Retrieve the position at the start of a line.
-int wxStyledTextCtrl::PositionFromLine(int line)
+int wxStyledTextCtrl::PositionFromLine(int line) const
{
return SendMsg(2167, line, 0);
}
// Replace the selected text with the argument text.
void wxStyledTextCtrl::ReplaceSelection(const wxString& text)
{
- SendMsg(2170, 0, (long)(const char*)wx2stc(text));
+ SendMsg(2170, 0, (sptr_t)(const char*)wx2stc(text));
}
// Set to read only or read write.
}
// Will a paste succeed?
-bool wxStyledTextCtrl::CanPaste()
+bool wxStyledTextCtrl::CanPaste() const
{
return SendMsg(2173, 0, 0) != 0;
}
// Are there any undoable actions in the undo history?
-bool wxStyledTextCtrl::CanUndo()
+bool wxStyledTextCtrl::CanUndo() const
{
return SendMsg(2174, 0, 0) != 0;
}
// Replace the contents of the document with the argument text.
void wxStyledTextCtrl::SetText(const wxString& text)
{
- SendMsg(2181, 0, (long)(const char*)wx2stc(text));
+ SendMsg(2181, 0, (sptr_t)(const char*)wx2stc(text));
}
// Retrieve all the text in the document.
-wxString wxStyledTextCtrl::GetText() {
+wxString wxStyledTextCtrl::GetText() const {
int len = GetTextLength();
wxMemoryBuffer mbuf(len+1); // leave room for the null...
char* buf = (char*)mbuf.GetWriteBuf(len+1);
- SendMsg(2182, len+1, (long)buf);
+ SendMsg(2182, len+1, (sptr_t)buf);
mbuf.UngetWriteBuf(len);
mbuf.AppendByte(0);
return stc2wx(buf);
int wxStyledTextCtrl::ReplaceTarget(const wxString& text) {
wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
- return SendMsg(2194, strlen(buf), (long)(const char*)buf);
+ return SendMsg(2194, strlen(buf), (sptr_t)(const char*)buf);
}
// Replace the target text with the argument text after \d processing.
int wxStyledTextCtrl::ReplaceTargetRE(const wxString& text) {
wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
- return SendMsg(2195, strlen(buf), (long)(const char*)buf);
+ return SendMsg(2195, strlen(buf), (sptr_t)(const char*)buf);
}
// Search for a counted string in the target and set the target to the found
int wxStyledTextCtrl::SearchInTarget(const wxString& text) {
wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
- return SendMsg(2197, strlen(buf), (long)(const char*)buf);
+ return SendMsg(2197, strlen(buf), (sptr_t)(const char*)buf);
}
// Set the search flags used by SearchInTarget.
// Show a call tip containing a definition near position pos.
void wxStyledTextCtrl::CallTipShow(int pos, const wxString& definition)
{
- SendMsg(2200, pos, (long)(const char*)wx2stc(definition));
+ SendMsg(2200, pos, (sptr_t)(const char*)wx2stc(definition));
}
// Remove the call tip from the screen.
return SendMsg(2465, 0, 0);
}
+// Sets how wrapped sublines are placed. Default is fixed.
+void wxStyledTextCtrl::SetWrapIndentMode(int mode)
+{
+ SendMsg(2472, mode, 0);
+}
+
+// Retrieve how wrapped sublines are placed. Default is fixed.
+int wxStyledTextCtrl::GetWrapIndentMode() const
+{
+ return SendMsg(2473, 0, 0);
+}
+
// Sets the degree of caching of layout information.
void wxStyledTextCtrl::SetLayoutCache(int mode)
{
// Does not handle tab or control characters.
int wxStyledTextCtrl::TextWidth(int style, const wxString& text)
{
- return SendMsg(2276, style, (long)(const char*)wx2stc(text));
+ return SendMsg(2276, style, (sptr_t)(const char*)wx2stc(text));
}
// Sets the scroll range so that maximum scroll position has
// Append a string to the end of the document without changing the selection.
void wxStyledTextCtrl::AppendText(const wxString& text) {
wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
- SendMsg(2282, strlen(buf), (long)(const char*)buf);
+ SendMsg(2282, strlen(buf), (sptr_t)(const char*)buf);
}
// Is drawing done in two phases with backgrounds drawn before foregrounds?
SendMsg(2284, twoPhase, 0);
}
+// Scroll so that a display line is at the top of the display.
+void wxStyledTextCtrl::SetFirstVisibleLine(int lineDisplay)
+{
+ SendMsg(2613, lineDisplay, 0);
+}
+
// Make the target range start and end be the same as the selection range start and end.
void wxStyledTextCtrl::TargetFromSelection()
{
SendMsg(2401, 0, 0);
}
-// How many characters are on a line, not including end of line characters?
-int wxStyledTextCtrl::LineLength(int line)
+// How many characters are on a line, including end of line characters?
+int wxStyledTextCtrl::LineLength(int line) const
{
return SendMsg(2350, line, 0);
}
// Change the document object used.
void wxStyledTextCtrl::SetDocPointer(void* docPointer) {
- SendMsg(2358, 0, (long)docPointer);
+ SendMsg(2358, 0, (sptr_t)docPointer);
}
// Set which document modification events are sent to the container.
// Does not ensure the selection is visible.
int wxStyledTextCtrl::SearchNext(int flags, const wxString& text)
{
- return SendMsg(2367, flags, (long)(const char*)wx2stc(text));
+ return SendMsg(2367, flags, (sptr_t)(const char*)wx2stc(text));
}
// Find some text starting at the search anchor and moving backwards.
// Does not ensure the selection is visible.
int wxStyledTextCtrl::SearchPrev(int flags, const wxString& text)
{
- return SendMsg(2368, flags, (long)(const char*)wx2stc(text));
+ return SendMsg(2368, flags, (sptr_t)(const char*)wx2stc(text));
}
// Retrieves the number of lines completely visible.
// Extend life of document.
void wxStyledTextCtrl::AddRefDocument(void* docPointer) {
- SendMsg(2376, 0, (long)docPointer);
+ SendMsg(2376, 0, (sptr_t)docPointer);
}
// Release a reference to the document, deleting document if it fades to black.
void wxStyledTextCtrl::ReleaseDocument(void* docPointer) {
- SendMsg(2377, 0, (long)docPointer);
+ SendMsg(2377, 0, (sptr_t)docPointer);
}
// Get which document modification events are sent to the container.
// Copy argument text to the clipboard.
void wxStyledTextCtrl::CopyText(int length, const wxString& text)
{
- SendMsg(2420, length, (long)(const char*)wx2stc(text));
+ SendMsg(2420, length, (sptr_t)(const char*)wx2stc(text));
}
-// Set the selection mode to stream (SC_SEL_STREAM) or rectangular (SC_SEL_RECTANGLE) or
+// Set the selection mode to stream (SC_SEL_STREAM) or rectangular (SC_SEL_RECTANGLE/SC_SEL_THIN) or
// by lines (SC_SEL_LINES).
void wxStyledTextCtrl::SetSelectionMode(int mode)
{
// Should be called after SetWordChars.
void wxStyledTextCtrl::SetWhitespaceChars(const wxString& characters)
{
- SendMsg(2443, 0, (long)(const char*)wx2stc(characters));
+ SendMsg(2443, 0, (sptr_t)(const char*)wx2stc(characters));
}
// Reset the set of characters for whitespace and word characters to the defaults.
return SendMsg(2515, 0, 0);
}
+// Copy the selection, if selection empty copy the line with the caret
+void wxStyledTextCtrl::CopyAllowLine()
+{
+ SendMsg(2519, 0, 0);
+}
+
+// Compact the document buffer and return a read-only pointer to the
+// characters in the document.
+const char* wxStyledTextCtrl::GetCharacterPointer() {
+ return (const char*)SendMsg(2520, 0, 0);
+}
+
+// Always interpret keyboard input as Unicode
+void wxStyledTextCtrl::SetKeysUnicode(bool keysUnicode)
+{
+ SendMsg(2521, keysUnicode, 0);
+}
+
+// Are keys always interpreted as Unicode?
+bool wxStyledTextCtrl::GetKeysUnicode() const
+{
+ return SendMsg(2522, 0, 0) != 0;
+}
+
+// Set the alpha fill colour of the given indicator.
+void wxStyledTextCtrl::IndicatorSetAlpha(int indicator, int alpha)
+{
+ SendMsg(2523, indicator, alpha);
+}
+
+// Get the alpha fill colour of the given indicator.
+int wxStyledTextCtrl::IndicatorGetAlpha(int indicator) const
+{
+ return SendMsg(2524, indicator, 0);
+}
+
+// Set extra ascent for each line
+void wxStyledTextCtrl::SetExtraAscent(int extraAscent)
+{
+ SendMsg(2525, extraAscent, 0);
+}
+
+// Get extra ascent for each line
+int wxStyledTextCtrl::GetExtraAscent() const
+{
+ return SendMsg(2526, 0, 0);
+}
+
+// Set extra descent for each line
+void wxStyledTextCtrl::SetExtraDescent(int extraDescent)
+{
+ SendMsg(2527, extraDescent, 0);
+}
+
+// Get extra descent for each line
+int wxStyledTextCtrl::GetExtraDescent() const
+{
+ return SendMsg(2528, 0, 0);
+}
+
+// Which symbol was defined for markerNumber with MarkerDefine
+int wxStyledTextCtrl::GetMarkerSymbolDefined(int markerNumber)
+{
+ return SendMsg(2529, markerNumber, 0);
+}
+
+// Set the text in the text margin for a line
+void wxStyledTextCtrl::MarginSetText(int line, const wxString& text)
+{
+ SendMsg(2530, line, (sptr_t)(const char*)wx2stc(text));
+}
+
+// Get the text in the text margin for a line
+wxString wxStyledTextCtrl::MarginGetText(int line) const {
+ long msg = 2531;
+ long len = SendMsg(msg, line, 0);
+
+ wxMemoryBuffer mbuf(len+1);
+ char* buf = (char*)mbuf.GetWriteBuf(len+1);
+ SendMsg(msg, line, (sptr_t)buf);
+ mbuf.UngetWriteBuf(len);
+ mbuf.AppendByte(0);
+ return stc2wx(buf);
+}
+
+// Set the style number for the text margin for a line
+void wxStyledTextCtrl::MarginSetStyle(int line, int style)
+{
+ SendMsg(2532, line, style);
+}
+
+// Get the style number for the text margin for a line
+int wxStyledTextCtrl::MarginGetStyle(int line) const
+{
+ return SendMsg(2533, line, 0);
+}
+
+// Set the style in the text margin for a line
+void wxStyledTextCtrl::MarginSetStyles(int line, const wxString& styles)
+{
+ SendMsg(2534, line, (sptr_t)(const char*)wx2stc(styles));
+}
+
+// Get the styles in the text margin for a line
+wxString wxStyledTextCtrl::MarginGetStyles(int line) const {
+ long msg = 2535;
+ long len = SendMsg(msg, line, 0);
+
+ wxMemoryBuffer mbuf(len+1);
+ char* buf = (char*)mbuf.GetWriteBuf(len+1);
+ SendMsg(msg, line, (sptr_t)buf);
+ mbuf.UngetWriteBuf(len);
+ mbuf.AppendByte(0);
+ return stc2wx(buf);
+}
+
+// Clear the margin text on all lines
+void wxStyledTextCtrl::MarginTextClearAll()
+{
+ SendMsg(2536, 0, 0);
+}
+
+// Get the start of the range of style numbers used for margin text
+void wxStyledTextCtrl::MarginSetStyleOffset(int style)
+{
+ SendMsg(2537, style, 0);
+}
+
+// Get the start of the range of style numbers used for margin text
+int wxStyledTextCtrl::MarginGetStyleOffset() const
+{
+ return SendMsg(2538, 0, 0);
+}
+
+// Set the annotation text for a line
+void wxStyledTextCtrl::AnnotationSetText(int line, const wxString& text)
+{
+ SendMsg(2540, line, (sptr_t)(const char*)wx2stc(text));
+}
+
+// Get the annotation text for a line
+wxString wxStyledTextCtrl::AnnotationGetText(int line) const {
+ long msg = 2541;
+ long len = SendMsg(msg, line, 0);
+
+ wxMemoryBuffer mbuf(len+1);
+ char* buf = (char*)mbuf.GetWriteBuf(len+1);
+ SendMsg(msg, line, (sptr_t)buf);
+ mbuf.UngetWriteBuf(len);
+ mbuf.AppendByte(0);
+ return stc2wx(buf);
+}
+
+// Set the style number for the annotations for a line
+void wxStyledTextCtrl::AnnotationSetStyle(int line, int style)
+{
+ SendMsg(2542, line, style);
+}
+
+// Get the style number for the annotations for a line
+int wxStyledTextCtrl::AnnotationGetStyle(int line) const
+{
+ return SendMsg(2543, line, 0);
+}
+
+// Set the annotation styles for a line
+void wxStyledTextCtrl::AnnotationSetStyles(int line, const wxString& styles)
+{
+ SendMsg(2544, line, (sptr_t)(const char*)wx2stc(styles));
+}
+
+// Get the annotation styles for a line
+wxString wxStyledTextCtrl::AnnotationGetStyles(int line) const {
+ long msg = 2545;
+ long len = SendMsg(msg, line, 0);
+
+ wxMemoryBuffer mbuf(len+1);
+ char* buf = (char*)mbuf.GetWriteBuf(len+1);
+ SendMsg(msg, line, (sptr_t)buf);
+ mbuf.UngetWriteBuf(len);
+ mbuf.AppendByte(0);
+ return stc2wx(buf);
+}
+
+// Get the number of annotation lines for a line
+int wxStyledTextCtrl::AnnotationGetLines(int line) const
+{
+ return SendMsg(2546, line, 0);
+}
+
+// Clear the annotations from all lines
+void wxStyledTextCtrl::AnnotationClearAll()
+{
+ SendMsg(2547, 0, 0);
+}
+
+// Set the visibility for the annotations for a view
+void wxStyledTextCtrl::AnnotationSetVisible(int visible)
+{
+ SendMsg(2548, visible, 0);
+}
+
+// Get the visibility for the annotations for a view
+int wxStyledTextCtrl::AnnotationGetVisible() const
+{
+ return SendMsg(2549, 0, 0);
+}
+
+// Get the start of the range of style numbers used for annotations
+void wxStyledTextCtrl::AnnotationSetStyleOffset(int style)
+{
+ SendMsg(2550, style, 0);
+}
+
+// Get the start of the range of style numbers used for annotations
+int wxStyledTextCtrl::AnnotationGetStyleOffset() const
+{
+ return SendMsg(2551, 0, 0);
+}
+
+// Add a container action to the undo stack
+void wxStyledTextCtrl::AddUndoAction(int token, int flags)
+{
+ SendMsg(2560, token, flags);
+}
+
+// Find the position of a character from a point within the window.
+int wxStyledTextCtrl::CharPositionFromPoint(int x, int y)
+{
+ return SendMsg(2561, x, y);
+}
+
+// Find the position of a character from a point within the window.
+// Return INVALID_POSITION if not close to text.
+int wxStyledTextCtrl::CharPositionFromPointClose(int x, int y)
+{
+ return SendMsg(2562, x, y);
+}
+
+// Set whether multiple selections can be made
+void wxStyledTextCtrl::SetMultipleSelection(bool multipleSelection)
+{
+ SendMsg(2563, multipleSelection, 0);
+}
+
+// Whether multiple selections can be made
+bool wxStyledTextCtrl::GetMultipleSelection() const
+{
+ return SendMsg(2564, 0, 0) != 0;
+}
+
+// Set whether typing can be performed into multiple selections
+void wxStyledTextCtrl::SetAdditionalSelectionTyping(bool additionalSelectionTyping)
+{
+ SendMsg(2565, additionalSelectionTyping, 0);
+}
+
+// Whether typing can be performed into multiple selections
+bool wxStyledTextCtrl::GetAdditionalSelectionTyping() const
+{
+ return SendMsg(2566, 0, 0) != 0;
+}
+
+// Set whether additional carets will blink
+void wxStyledTextCtrl::SetAdditionalCaretsBlink(bool additionalCaretsBlink)
+{
+ SendMsg(2567, additionalCaretsBlink, 0);
+}
+
+// Whether additional carets will blink
+bool wxStyledTextCtrl::GetAdditionalCaretsBlink() const
+{
+ return SendMsg(2568, 0, 0) != 0;
+}
+
+// Set whether additional carets are visible
+void wxStyledTextCtrl::SetAdditionalCaretsVisible(bool additionalCaretsBlink)
+{
+ SendMsg(2608, additionalCaretsBlink, 0);
+}
+
+// Whether additional carets are visible
+bool wxStyledTextCtrl::GetAdditionalCaretsVisible() const
+{
+ return SendMsg(2609, 0, 0) != 0;
+}
+
+// How many selections are there?
+int wxStyledTextCtrl::GetSelections() const
+{
+ return SendMsg(2570, 0, 0);
+}
+
+// Clear selections to a single empty stream selection
+void wxStyledTextCtrl::ClearSelections()
+{
+ SendMsg(2571, 0, 0);
+}
+
+// Add a selection
+int wxStyledTextCtrl::AddSelection(int caret, int anchor)
+{
+ return SendMsg(2573, caret, anchor);
+}
+
+// Set the main selection
+void wxStyledTextCtrl::SetMainSelection(int selection)
+{
+ SendMsg(2574, selection, 0);
+}
+
+// Which selection is the main selection
+int wxStyledTextCtrl::GetMainSelection() const
+{
+ return SendMsg(2575, 0, 0);
+}
+void wxStyledTextCtrl::SetSelectionNCaret(int selection, int pos)
+{
+ SendMsg(2576, selection, pos);
+}
+int wxStyledTextCtrl::GetSelectionNCaret(int selection) const
+{
+ return SendMsg(2577, selection, 0);
+}
+void wxStyledTextCtrl::SetSelectionNAnchor(int selection, int posAnchor)
+{
+ SendMsg(2578, selection, posAnchor);
+}
+int wxStyledTextCtrl::GetSelectionNAnchor(int selection) const
+{
+ return SendMsg(2579, selection, 0);
+}
+void wxStyledTextCtrl::SetSelectionNCaretVirtualSpace(int selection, int space)
+{
+ SendMsg(2580, selection, space);
+}
+int wxStyledTextCtrl::GetSelectionNCaretVirtualSpace(int selection) const
+{
+ return SendMsg(2581, selection, 0);
+}
+void wxStyledTextCtrl::SetSelectionNAnchorVirtualSpace(int selection, int space)
+{
+ SendMsg(2582, selection, space);
+}
+int wxStyledTextCtrl::GetSelectionNAnchorVirtualSpace(int selection) const
+{
+ return SendMsg(2583, selection, 0);
+}
+
+// Sets the position that starts the selection - this becomes the anchor.
+void wxStyledTextCtrl::SetSelectionNStart(int selection, int pos)
+{
+ SendMsg(2584, selection, pos);
+}
+
+// Returns the position at the start of the selection.
+int wxStyledTextCtrl::GetSelectionNStart(int selection) const
+{
+ return SendMsg(2585, selection, 0);
+}
+
+// Sets the position that ends the selection - this becomes the currentPosition.
+void wxStyledTextCtrl::SetSelectionNEnd(int selection, int pos)
+{
+ SendMsg(2586, selection, pos);
+}
+
+// Returns the position at the end of the selection.
+int wxStyledTextCtrl::GetSelectionNEnd(int selection) const
+{
+ return SendMsg(2587, selection, 0);
+}
+void wxStyledTextCtrl::SetRectangularSelectionCaret(int pos)
+{
+ SendMsg(2588, pos, 0);
+}
+int wxStyledTextCtrl::GetRectangularSelectionCaret() const
+{
+ return SendMsg(2589, 0, 0);
+}
+void wxStyledTextCtrl::SetRectangularSelectionAnchor(int posAnchor)
+{
+ SendMsg(2590, posAnchor, 0);
+}
+int wxStyledTextCtrl::GetRectangularSelectionAnchor() const
+{
+ return SendMsg(2591, 0, 0);
+}
+void wxStyledTextCtrl::SetRectangularSelectionCaretVirtualSpace(int space)
+{
+ SendMsg(2592, space, 0);
+}
+int wxStyledTextCtrl::GetRectangularSelectionCaretVirtualSpace() const
+{
+ return SendMsg(2593, 0, 0);
+}
+void wxStyledTextCtrl::SetRectangularSelectionAnchorVirtualSpace(int space)
+{
+ SendMsg(2594, space, 0);
+}
+int wxStyledTextCtrl::GetRectangularSelectionAnchorVirtualSpace() const
+{
+ return SendMsg(2595, 0, 0);
+}
+void wxStyledTextCtrl::SetVirtualSpaceOptions(int virtualSpaceOptions)
+{
+ SendMsg(2596, virtualSpaceOptions, 0);
+}
+int wxStyledTextCtrl::GetVirtualSpaceOptions() const
+{
+ return SendMsg(2597, 0, 0);
+}
+
+// On GTK+, allow selecting the modifier key to use for mouse-based
+// rectangular selection. Often the window manager requires Alt+Mouse Drag
+// for moving windows.
+// Valid values are SCMOD_CTRL(default), SCMOD_ALT, or SCMOD_SUPER.
+void wxStyledTextCtrl::SetRectangularSelectionModifier(int modifier)
+{
+ SendMsg(2598, modifier, 0);
+}
+
+// Get the modifier key used for rectangular selection.
+int wxStyledTextCtrl::GetRectangularSelectionModifier() const
+{
+ return SendMsg(2599, 0, 0);
+}
+
+// Set the foreground colour of additional selections.
+// Must have previously called SetSelFore with non-zero first argument for this to have an effect.
+void wxStyledTextCtrl::SetAdditionalSelForeground(const wxColour& fore)
+{
+ SendMsg(2600, wxColourAsLong(fore), 0);
+}
+
+// Set the background colour of additional selections.
+// Must have previously called SetSelBack with non-zero first argument for this to have an effect.
+void wxStyledTextCtrl::SetAdditionalSelBackground(const wxColour& back)
+{
+ SendMsg(2601, wxColourAsLong(back), 0);
+}
+
+// Set the alpha of the selection.
+void wxStyledTextCtrl::SetAdditionalSelAlpha(int alpha)
+{
+ SendMsg(2602, alpha, 0);
+}
+
+// Get the alpha of the selection.
+int wxStyledTextCtrl::GetAdditionalSelAlpha() const
+{
+ return SendMsg(2603, 0, 0);
+}
+
+// Set the foreground colour of additional carets.
+void wxStyledTextCtrl::SetAdditionalCaretForeground(const wxColour& fore)
+{
+ SendMsg(2604, wxColourAsLong(fore), 0);
+}
+
+// Get the foreground colour of additional carets.
+wxColour wxStyledTextCtrl::GetAdditionalCaretForeground() const
+{
+ long c = SendMsg(2605, 0, 0);
+ return wxColourFromLong(c);
+}
+
+// Set the main selection to the next selection.
+void wxStyledTextCtrl::RotateSelection()
+{
+ SendMsg(2606, 0, 0);
+}
+
+// Swap that caret and anchor of the main selection.
+void wxStyledTextCtrl::SwapMainAnchorCaret()
+{
+ SendMsg(2607, 0, 0);
+}
+
// Start notifying the container of all key presses and commands.
void wxStyledTextCtrl::StartRecord()
{
// Set up a value that may be used by a lexer for some optional feature.
void wxStyledTextCtrl::SetProperty(const wxString& key, const wxString& value)
{
- SendMsg(4004, (long)(const char*)wx2stc(key), (long)(const char*)wx2stc(value));
+ SendMsg(4004, (sptr_t)(const char*)wx2stc(key), (sptr_t)(const char*)wx2stc(value));
}
// Set up the key words used by the lexer.
void wxStyledTextCtrl::SetKeyWords(int keywordSet, const wxString& keyWords)
{
- SendMsg(4005, keywordSet, (long)(const char*)wx2stc(keyWords));
+ SendMsg(4005, keywordSet, (sptr_t)(const char*)wx2stc(keyWords));
}
// Set the lexing language of the document based on string name.
void wxStyledTextCtrl::SetLexerLanguage(const wxString& language)
{
- SendMsg(4006, 0, (long)(const char*)wx2stc(language));
+ SendMsg(4006, 0, (sptr_t)(const char*)wx2stc(language));
}
// Retrieve a 'property' value previously set with SetProperty.
wxString wxStyledTextCtrl::GetProperty(const wxString& key) {
- int len = SendMsg(SCI_GETPROPERTY, (long)(const char*)wx2stc(key), 0);
+ int len = SendMsg(SCI_GETPROPERTY, (sptr_t)(const char*)wx2stc(key), 0);
if (!len) return wxEmptyString;
wxMemoryBuffer mbuf(len+1);
char* buf = (char*)mbuf.GetWriteBuf(len+1);
- SendMsg(4008, (long)(const char*)wx2stc(key), (long)buf);
+ SendMsg(4008, (uptr_t)(const char*)wx2stc(key), (sptr_t)buf);
mbuf.UngetWriteBuf(len);
mbuf.AppendByte(0);
return stc2wx(buf);
// Retrieve a 'property' value previously set with SetProperty,
// with '$()' variable replacement on returned buffer.
wxString wxStyledTextCtrl::GetPropertyExpanded(const wxString& key) {
- int len = SendMsg(SCI_GETPROPERTYEXPANDED, (long)(const char*)wx2stc(key), 0);
+ int len = SendMsg(SCI_GETPROPERTYEXPANDED, (uptr_t)(const char*)wx2stc(key), 0);
if (!len) return wxEmptyString;
wxMemoryBuffer mbuf(len+1);
char* buf = (char*)mbuf.GetWriteBuf(len+1);
- SendMsg(4009, (long)(const char*)wx2stc(key), (long)buf);
+ SendMsg(4009, (uptr_t)(const char*)wx2stc(key), (sptr_t)buf);
mbuf.UngetWriteBuf(len);
mbuf.AppendByte(0);
return stc2wx(buf);
// interpreted as an int AFTER any '$()' variable replacement.
int wxStyledTextCtrl::GetPropertyInt(const wxString& key) const
{
- return SendMsg(4010, (long)(const char*)wx2stc(key), 0);
+ return SendMsg(4010, (sptr_t)(const char*)wx2stc(key), 0);
}
// Retrieve the number of bits the current lexer needs for styling.
}
-// Retrieve the start and end positions of the current selection.
-void wxStyledTextCtrl::GetSelection(int* startPos, int* endPos) {
- if (startPos != NULL)
- *startPos = SendMsg(SCI_GETSELECTIONSTART);
- if (endPos != NULL)
- *endPos = SendMsg(SCI_GETSELECTIONEND);
-}
-
-
// Retrieve the point in the window where a position is displayed.
wxPoint wxStyledTextCtrl::PointFromPosition(int pos) {
int x = SendMsg(SCI_POINTXFROMPOSITION, 0, pos);
}
+#if wxUSE_TEXTCTRL
+bool wxStyledTextCtrl::DoSaveFile(const wxString& filename, int fileType)
+{
+ bool ok = wxTextAreaBase::DoSaveFile(filename, fileType);
+#else
bool wxStyledTextCtrl::SaveFile(const wxString& filename)
{
- wxFile file(filename, wxFile::write);
-
- if (!file.IsOpened())
- return false;
-
- bool success = file.Write(GetText(), *wxConvCurrent);
-
- if (success)
+#if wxUSE_FFILE
+ wxFFile file(filename, wxT("w"));
+ bool ok = file.IsOpened() && file.Write(GetValue(), *wxConvCurrent);
+#else
+ bool ok = false;
+#endif // wxUSE_FFILE
+#endif
+ if (ok)
+ {
SetSavePoint();
-
- return success;
+ }
+ return ok;
}
+#if wxUSE_TEXTCTRL
+bool wxStyledTextCtrl::DoLoadFile(const wxString& filename, int fileType)
+{
+ bool ok = wxTextAreaBase::DoLoadFile(filename, fileType);
+#else
bool wxStyledTextCtrl::LoadFile(const wxString& filename)
{
- bool success = false;
- wxFile file(filename, wxFile::read);
-
- if (file.IsOpened())
+#if wxUSE_FFILE
+ wxFFile file(filename);
+ bool ok = file.IsOpened();
+ if (ok)
{
- wxString contents;
- // get the file size (assume it is not huge file...)
- ssize_t len = (ssize_t)file.Length();
-
- if (len > 0)
- {
-#if wxUSE_UNICODE
- wxMemoryBuffer buffer(len+1);
- success = (file.Read(buffer.GetData(), len) == len);
- if (success) {
- ((char*)buffer.GetData())[len] = 0;
- contents = wxString(buffer, *wxConvCurrent, len);
- }
-#else
- wxString buffer;
- success = (file.Read(wxStringBuffer(buffer, len), len) == len);
- contents = buffer;
-#endif
- }
- else
- {
- if (len == 0)
- success = true; // empty file is ok
- else
- success = false; // len == wxInvalidOffset
- }
-
- if (success)
+ wxString text;
+ ok = file.ReadAll(&text, *wxConvCurrent);
+ if (ok)
{
- SetText(contents);
- EmptyUndoBuffer();
- SetSavePoint();
+ SetValue(text);
}
}
-
- return success;
+#else
+ bool ok = false;
+#endif // wxUSE_FFILE
+#endif
+ if (ok)
+ {
+ EmptyUndoBuffer();
+ SetSavePoint();
+ }
+ return ok;
}
-
#if wxUSE_DRAG_AND_DROP
wxDragResult wxStyledTextCtrl::DoDragOver(wxCoord x, wxCoord y, wxDragResult def) {
return m_swx->DoDragOver(x, y, def);
void wxStyledTextCtrl::AddTextRaw(const char* text)
{
- SendMsg(SCI_ADDTEXT, strlen(text), (long)text);
+ SendMsg(SCI_ADDTEXT, strlen(text), (sptr_t)text);
}
void wxStyledTextCtrl::InsertTextRaw(int pos, const char* text)
{
- SendMsg(SCI_INSERTTEXT, pos, (long)text);
+ SendMsg(SCI_INSERTTEXT, pos, (sptr_t)text);
}
wxCharBuffer wxStyledTextCtrl::GetCurLineRaw(int* linePos)
}
wxCharBuffer buf(len);
- int pos = SendMsg(SCI_GETCURLINE, len, (long)buf.data());
+ int pos = SendMsg(SCI_GETCURLINE, len, (sptr_t)buf.data());
if (linePos) *linePos = pos;
return buf;
}
}
wxCharBuffer buf(len);
- SendMsg(SCI_GETLINE, line, (long)buf.data());
+ SendMsg(SCI_GETLINE, line, (sptr_t)buf.data());
return buf;
}
wxCharBuffer wxStyledTextCtrl::GetSelectedTextRaw()
{
- int start;
- int end;
+ long start;
+ long end;
GetSelection(&start, &end);
int len = end - start;
}
wxCharBuffer buf(len);
- SendMsg(SCI_GETSELTEXT, 0, (long)buf.data());
+ SendMsg(SCI_GETSELTEXT, 0, (sptr_t)buf.data());
return buf;
}
tr.lpstrText = buf.data();
tr.chrg.cpMin = startPos;
tr.chrg.cpMax = endPos;
- SendMsg(SCI_GETTEXTRANGE, 0, (long)&tr);
+ SendMsg(SCI_GETTEXTRANGE, 0, (sptr_t)&tr);
return buf;
}
void wxStyledTextCtrl::SetTextRaw(const char* text)
{
- SendMsg(SCI_SETTEXT, 0, (long)text);
+ SendMsg(SCI_SETTEXT, 0, (sptr_t)text);
}
wxCharBuffer wxStyledTextCtrl::GetTextRaw()
{
- int len = GetTextLength();
- wxCharBuffer buf(len);
- SendMsg(SCI_GETTEXT, len, (long)buf.data());
+ int len = GetTextLength();
+ wxCharBuffer buf(len); // adds 1 for NUL automatically
+ SendMsg(SCI_GETTEXT, len + 1, (sptr_t)buf.data());
return buf;
}
void wxStyledTextCtrl::AppendTextRaw(const char* text)
{
- SendMsg(SCI_APPENDTEXT, strlen(text), (long)text);
+ SendMsg(SCI_APPENDTEXT, strlen(text), (sptr_t)text);
}
}
-void wxStyledTextCtrl::OnMouseWheel(wxMouseEvent& evt) {
- m_swx->DoMouseWheel(evt.GetWheelRotation(),
- evt.GetWheelDelta(),
- evt.GetLinesPerAction(),
- evt.ControlDown(),
- evt.IsPageScroll());
+void wxStyledTextCtrl::OnMouseWheel(wxMouseEvent& evt)
+{
+ // prevent having an event queue with wheel events that cannot be processed
+ // reasonably fast (see ticket #9057)
+ if ( m_lastWheelTimestamp <= evt.GetTimestamp() )
+ {
+ m_lastWheelTimestamp = m_stopWatch.Time();
+ m_swx->DoMouseWheel(evt.GetWheelRotation(),
+ evt.GetWheelDelta(),
+ evt.GetLinesPerAction(),
+ evt.ControlDown(),
+ evt.IsPageScroll());
+ m_lastWheelTimestamp = m_stopWatch.Time() - m_lastWheelTimestamp;
+ m_lastWheelTimestamp += evt.GetTimestamp();
+ }
}
evt.SetEventType(wxEVT_STC_INDICATOR_RELEASE);
break;
+ case SCN_AUTOCCANCELLED:
+ evt.SetEventType(wxEVT_STC_AUTOCOMP_CANCELLED);
+ break;
+
+ case SCN_AUTOCCHARDELETED:
+ evt.SetEventType(wxEVT_STC_AUTOCOMP_CHAR_DELETED);
+ break;
+
default:
return;
}
m_listType = 0;
m_x = 0;
m_y = 0;
- m_dragAllowMove = false;
#if wxUSE_DRAG_AND_DROP
+ m_dragFlags = wxDrag_CopyOnly;
m_dragResult = wxDragNone;
#endif
}
m_x = event.m_x;
m_y = event.m_y;
- m_dragText = event.m_dragText;
- m_dragAllowMove =event.m_dragAllowMove;
#if wxUSE_DRAG_AND_DROP
+ m_dragText = event.m_dragText;
+ m_dragFlags = event.m_dragFlags;
m_dragResult = event.m_dragResult;
#endif
}
//----------------------------------------------------------------------
//----------------------------------------------------------------------
+/*static*/ wxVersionInfo wxStyledTextCtrl::GetLibraryVersionInfo()
+{
+ return wxVersionInfo("Scintilla", 2, 3, 0, "Scintilla 2.03");
+}
+
#endif // wxUSE_STC