X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2bfca191bf2261e385594a369da9aa4e4441aa43..3d5930b5ea5cd28d97ca9df147cd48bc51061480:/include/wx/stc/stc.h diff --git a/include/wx/stc/stc.h b/include/wx/stc/stc.h index c766ced458..e701ed9881 100644 --- a/include/wx/stc/stc.h +++ b/include/wx/stc/stc.h @@ -39,6 +39,7 @@ #include "wx/dnd.h" #include "wx/stopwatch.h" +#include "wx/textentry.h" #if wxUSE_TEXTCTRL #include "wx/textctrl.h" #endif // wxUSE_TEXTCTRL @@ -1977,7 +1978,7 @@ class WordList; struct SCNotification; #ifndef SWIG -extern WXDLLIMPEXP_STC const wxChar* wxSTCNameStr; +extern WXDLLIMPEXP_DATA_STC(const char) wxSTCNameStr[]; class WXDLLIMPEXP_FWD_STC wxStyledTextCtrl; class WXDLLIMPEXP_FWD_STC wxStyledTextEvent; #endif @@ -1985,6 +1986,7 @@ class WXDLLIMPEXP_FWD_STC wxStyledTextEvent; //---------------------------------------------------------------------- class WXDLLIMPEXP_STC wxStyledTextCtrl : public wxControl + , public wxTextEntryBase #if wxUSE_TEXTCTRL , public wxTextAreaBase #endif // wxUSE_TEXTCTRL @@ -2069,7 +2071,7 @@ public: wxMemoryBuffer GetStyledText(int startPos, int endPos); // Are there any redoable actions in the undo history? - bool CanRedo(); + bool CanRedo() const; // Retrieve the line number at which a particular marker is located. int MarkerLineFromHandle(int handle); @@ -2613,9 +2615,6 @@ public: // Is the document different from when it was last saved? bool GetModify() const; - // Select a range of text. - void SetSelection(int start, int end); - // Retrieve the selected text. wxString GetSelectedText(); @@ -2644,10 +2643,10 @@ public: void SetReadOnly(bool readOnly); // Will a paste succeed? - bool CanPaste(); + bool CanPaste() const; // Are there any undoable actions in the undo history? - bool CanUndo(); + bool CanUndo() const; // Delete the undo history. void EmptyUndoBuffer(); @@ -2671,7 +2670,7 @@ public: void SetText(const wxString& text); // Retrieve all the text in the document. - wxString GetText(); + wxString GetText() const; // Retrieve the number of characters in the document. int GetTextLength() const; @@ -3545,13 +3544,6 @@ public: void SetMargins(int left, int right); - // Retrieve the start and end positions of the current selection. -#ifdef SWIG - void GetSelection(int* OUTPUT, int* OUTPUT); -#else - void GetSelection(int* startPos, int* endPos); -#endif - // Retrieve the point in the window where a position is displayed. wxPoint PointFromPosition(int pos); @@ -3569,7 +3561,7 @@ public: // NB: this method is not really const as it can modify the control but it // has to be declared as such as it's called from both const and // non-const methods and we can't distinguish between the two - long SendMsg(int msg, long wp=0, long lp=0) const; + wxIntPtr SendMsg(int msg, wxUIntPtr wp=0, wxIntPtr lp=0) const; // Set the vertical scrollbar to use instead of the ont that's built-in. @@ -3653,6 +3645,80 @@ public: #endif + // 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 // --------------------------------------------- @@ -3709,12 +3775,12 @@ public: return true; } - virtual void ShowPosition(long pos) - { - EnsureVisible(LineFromPosition(pos)); - } + virtual void ShowPosition(long pos) { GotoPos(pos); } - using wxWindow::HitTest; + // 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 { @@ -3774,6 +3840,10 @@ protected: 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