#include "wx/control.h"
#include "wx/dnd.h"
#include "wx/stopwatch.h"
+#include "wx/versioninfo.h"
#include "wx/textentry.h"
#if wxUSE_TEXTCTRL
#endif
#endif
-
//----------------------------------------------------------------------
// STC constants generated section {{{
// Returns the current UseAntiAliasing setting.
bool GetUseAntiAliasing();
+ // Clear annotations from the given line.
+ void AnnotationClearLine(int line);
+
- // The following methods are nearly equivallent to their similarly named
+ // The following methods are nearly equivalent to their similarly named
// cousins above. The difference is that these methods bypass wxString
// and always use a char* even if used in a unicode build of wxWidgets.
// In that case the character data will be utf-8 encoded since that is
// what is used internally by Scintilla in unicode builds.
// Add text to the document at current position.
- void AddTextRaw(const char* text);
+ void AddTextRaw(const char* text, int length=-1);
// Insert string at a position.
void InsertTextRaw(int pos, const char* text);
wxCharBuffer GetTextRaw();
// Append a string to the end of the document without changing the selection.
- void AppendTextRaw(const char* text);
+ void AppendTextRaw(const char* text, int length=-1);
#ifdef SWIG
%%pythoncode "_stc_utf8_methods.py"
// implement wxTextEntryBase pure virtual methods
// ----------------------------------------------
- virtual void WriteText(const wxString& text) { AddText(text); }
+ virtual void WriteText(const wxString& text)
+ {
+ ReplaceSelection(text);
+ }
+
virtual void Remove(long from, long to)
{
Replace(from, to, "");
}
}
+ virtual void SelectNone()
+ {
+ ClearSelections();
+ }
+
#ifdef SWIG
void GetSelection(long* OUTPUT, long* OUTPUT) const;
#else
// implement wxTextAreaBase pure virtual methods
// ---------------------------------------------
- virtual int GetLineLength(long n) const { return GetLine(n).length(); }
- virtual wxString GetLineText(long n) const { return GetLine(n); }
+ virtual int GetLineLength(long lineNo) const { return static_cast<int>(GetLineText(lineNo).length()); }
+ virtual wxString GetLineText(long lineNo) const
+ {
+ wxString text = GetLine(static_cast<int>(lineNo));
+ size_t lastNewLine = text.find_last_not_of(wxS("\r\n"));
+
+ if ( lastNewLine != wxString::npos )
+ text.erase(lastNewLine + 1); // remove trailing cr+lf
+ else
+ text.clear();
+ return text;
+ }
virtual int GetNumberOfLines() const { return GetLineCount(); }
virtual bool IsModified() const { return GetModify(); }
virtual bool PositionToXY(long pos, long *x, long *y) const
{
+ long l = LineFromPosition(pos);
+ if ( l == -1 )
+ return false;
+
if ( x )
- *x = -1; // TODO
+ *x = pos - PositionFromLine(l);
if ( y )
- {
- long l = LineFromPosition(pos);
- if ( l == -1 )
- return false;
*y = l;
- }
return true;
}
return wxTextAreaBase::HitTest(pt, col, row);
}
+ static wxVersionInfo GetLibraryVersionInfo();
+
protected:
+ virtual void DoSetValue(const wxString& value, int flags);
virtual wxString DoGetValue() const { return GetText(); }
virtual wxWindow *GetEditableWindow() { return this; }
bool m_lastKeyDownConsumed;
- // the timestamp that consists of the last wheel event
- // added to the time taken to process that event.
- long m_lastWheelTimestamp;
-
friend class ScintillaWX;
friend class Platform;
#endif // !SWIG
void SetListType(int val) { m_listType = val; }
void SetX(int val) { m_x = val; }
void SetY(int val) { m_y = val; }
- void SetDragText(const wxString& val) { m_dragText = val; }
- void SetDragAllowMove(bool val) { m_dragAllowMove = val; }
+ void SetToken(int val) { m_token = val; }
+ void SetAnnotationLinesAdded(int val) { m_annotationLinesAdded = val; }
+ void SetUpdated(int val) { m_updated = val; }
#ifdef STC_USE_DND
+ void SetDragText(const wxString& val) { m_dragText = val; }
+ void SetDragFlags(int flags) { m_dragFlags = flags; }
void SetDragResult(wxDragResult val) { m_dragResult = val; }
+
+ // This method is kept mainly for backwards compatibility, use
+ // SetDragFlags() in the new code.
+ void SetDragAllowMove(bool allow)
+ {
+ if ( allow )
+ m_dragFlags |= wxDrag_AllowMove;
+ else
+ m_dragFlags &= ~(wxDrag_AllowMove | wxDrag_DefaultMove);
+ }
#endif
int GetPosition() const { return m_position; }
int GetListType() const { return m_listType; }
int GetX() const { return m_x; }
int GetY() const { return m_y; }
- wxString GetDragText() { return m_dragText; }
- bool GetDragAllowMove() { return m_dragAllowMove; }
+ int GetToken() const { return m_token; }
+ int GetAnnotationsLinesAdded() const { return m_annotationLinesAdded; }
+ int GetUpdated() const { return m_updated; }
+
#ifdef STC_USE_DND
+ wxString GetDragText() { return m_dragText; }
+ int GetDragFlags() { return m_dragFlags; }
wxDragResult GetDragResult() { return m_dragResult; }
+
+ bool GetDragAllowMove() { return (GetDragFlags() & wxDrag_AllowMove) != 0; }
#endif
bool GetShift() const;
int m_x;
int m_y;
- wxString m_dragText; // wxEVT_STC_START_DRAG, wxEVT_STC_DO_DROP
- bool m_dragAllowMove; // wxEVT_STC_START_DRAG
+ int m_token; // wxEVT_STC__MODIFIED with SC_MOD_CONTAINER
+ int m_annotationLinesAdded; // wxEVT_STC_MODIFIED with SC_MOD_CHANGEANNOTATION
+ int m_updated; // wxEVT_STC_UPDATEUI
+
#if wxUSE_DRAG_AND_DROP
- wxDragResult m_dragResult; // wxEVT_STC_DRAG_OVER,wxEVT_STC_DO_DROP
+ wxString m_dragText; // wxEVT_STC_START_DRAG, wxEVT_STC_DO_DROP
+ int m_dragFlags; // wxEVT_STC_START_DRAG
+ wxDragResult m_dragResult; // wxEVT_STC_DRAG_OVER,wxEVT_STC_DO_DROP
#endif
#endif
};
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_INDICATOR_RELEASE, wxStyledTextEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_AUTOCOMP_CANCELLED, wxStyledTextEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_AUTOCOMP_CHAR_DELETED, wxStyledTextEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_HOTSPOT_RELEASE_CLICK, wxStyledTextEvent );
#else
enum {
wxEVT_STC_CHANGE,
wxEVT_STC_INDICATOR_CLICK,
wxEVT_STC_INDICATOR_RELEASE,
wxEVT_STC_AUTOCOMP_CANCELLED,
- wxEVT_STC_AUTOCOMP_CHAR_DELETED
+ wxEVT_STC_AUTOCOMP_CHAR_DELETED,
+ wxEVT_STC_HOTSPOT_RELEASE_CLICK
};
#endif
#define EVT_STC_INDICATOR_RELEASE(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_INDICATOR_RELEASE, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
#define EVT_STC_AUTOCOMP_CANCELLED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_CANCELLED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
#define EVT_STC_AUTOCOMP_CHAR_DELETED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_CHAR_DELETED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
+#define EVT_STC_HOTSPOT_RELEASE_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_HOTSPOT_RELEASE_CLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
#endif