+ // implement wxTextEntryBase pure virtual methods
+ // ----------------------------------------------
+
+ virtual void WriteText(const wxString& text) { AddText(text); }
+ virtual wxString GetValue() const { return GetText(); }
+ virtual void Remove(long from, long to)
+ {
+ Replace(from, to, "");
+ }
+ virtual void Replace(long from, long to, const wxString& text)
+ {
+ SetTargetStart(from);
+ SetTargetEnd(to);
+ ReplaceTarget(text);
+ }
+
+ /*
+ These functions are already declared in the generated section.
+
+ virtual void Copy();
+ virtual void Cut();
+ virtual void Paste();
+
+ virtual void Undo();
+ virtual void Redo();
+
+ virtual bool CanUndo() const;
+ virtual bool CanRedo() const;
+
+ */
+
+ virtual void SetInsertionPoint(long pos) { SetCurrentPos(pos); }
+ virtual long GetInsertionPoint() const { return GetCurrentPos(); }
+ virtual long GetLastPosition() const { return GetTextLength(); }
+
+ virtual void SetSelection(long from, long to)
+ {
+ if ( from == -1 && to == -1 )
+ {
+ SelectAll();
+ }
+ else
+ {
+ SetSelectionStart(from);
+ SetSelectionEnd(to);
+ }
+ }
+
+#ifdef SWIG
+ void GetSelection(long* OUTPUT, long* OUTPUT) const;
+#else
+ virtual void GetSelection(long *from, long *to) const
+ {
+ if ( from )
+ *from = GetSelectionStart();
+ if ( to )
+ *to = GetSelectionEnd();
+ }
+
+ // kept for compatibility only
+ void GetSelection(int *from, int *to)
+ {
+ long f, t;
+ GetSelection(&f, &t);
+ if ( from )
+ *from = f;
+ if ( to )
+ *to = t;
+ }
+#endif
+
+ virtual bool IsEditable() const { return !GetReadOnly(); }
+ virtual void SetEditable(bool editable) { SetReadOnly(!editable); }
+
+ // 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 GetNumberOfLines() const { return GetLineCount(); }
+
+ virtual bool IsModified() const { return GetModify(); }
+ virtual void MarkDirty() { wxFAIL_MSG("not implemented"); }
+ virtual void DiscardEdits() { SetSavePoint(); }
+
+ virtual bool SetStyle(long WXUNUSED(start), long WXUNUSED(end),
+ const wxTextAttr& WXUNUSED(style))
+ {
+ wxFAIL_MSG("not implemented");
+
+ return false;
+ }
+
+ virtual bool GetStyle(long WXUNUSED(position), wxTextAttr& WXUNUSED(style))
+ {
+ wxFAIL_MSG("not implemented");
+
+ return false;
+ }
+
+ virtual bool SetDefaultStyle(const wxTextAttr& WXUNUSED(style))
+ {
+ wxFAIL_MSG("not implemented");
+
+ return false;
+ }
+
+ virtual long XYToPosition(long x, long y) const
+ {
+ long pos = PositionFromLine(y);
+ pos += x;
+ return pos;
+ }
+
+ virtual bool PositionToXY(long pos, long *x, long *y) const
+ {
+ if ( x )
+ *x = -1; // TODO
+
+ if ( y )
+ {
+ long l = LineFromPosition(pos);
+ if ( l == -1 )
+ return false;
+ *y = l;
+ }
+
+ return true;
+ }
+
+ virtual void ShowPosition(long pos) { GotoPos(pos); }
+
+ // FIXME-VC6: can't use wxWindow here because of "error C2603: illegal
+ // access declaration: 'wxWindow' is not a direct base of
+ // 'wxStyledTextCtrl'" with VC6
+ using wxControl::HitTest;
+
+ virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const
+ {
+ const long l = PositionFromPoint(pt);
+ if ( l == -1 )
+ return wxTE_HT_BELOW; // we don't really know where it was
+
+ if ( pos )
+ *pos = l;
+
+ return wxTE_HT_ON_TEXT;
+ }
+