X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4701dc09838c3da46a8bc2836265a7dffee541ee..d2ae3af890800b7844df1673e6c9ae0e63b3dd68:/interface/wx/stc/stc.h diff --git a/interface/wx/stc/stc.h b/interface/wx/stc/stc.h index 38cb6b0eab..4856c21485 100644 --- a/interface/wx/stc/stc.h +++ b/interface/wx/stc/stc.h @@ -3,9 +3,12 @@ // Purpose: interface of wxStyledTextEvent // Author: wxWidgets team // RCS-ID: $Id$ -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// +/// Represents an invalid position. +#define wxSTC_INVALID_POSITION -1 + /** @class wxStyledTextEvent @@ -14,7 +17,7 @@ @todo list styled text ctrl events. @library{wxbase} - @category{events} + @category{events,stc} */ class wxStyledTextEvent : public wxCommandEvent { @@ -263,7 +266,7 @@ public: wxStyledTextCtrl is a 1 to 1 mapping of "raw" scintilla interface, whose documentation can be found in the Scintilla website (http://www.scintilla.org/). - @beginEventTable{wxStyledTextEvent} + @beginEventEmissionTable{wxStyledTextEvent} @event{EVT_STC_CHANGE(id, fn)} TOWRITE @event{EVT_STC_STYLENEEDED(id, fn)} @@ -316,6 +319,14 @@ public: TOWRITE @event{EVT_STC_AUTOCOMP_SELECTION(id, fn)} TOWRITE + @event{EVT_STC_INDICATOR_CLICK(id, fn)} + TOWRITE + @event{EVT_STC_INDICATOR_RELEASE(id, fn)} + TOWRITE + @event{EVT_STC_AUTOCOMP_CANCELLED(id, fn)} + TOWRITE + @event{EVT_STC_AUTOCOMP_CHAR_DELETED(id, fn)} + TOWRITE @endEventTable @library{wxbase} @@ -331,10 +342,10 @@ public: */ wxStyledTextCtrl::wxStyledTextCtrl(wxWindow* parent, wxWindowID id = wxID_ANY, - const wxPoint pos = wxDefaultPosition, - const wxSize size = wxDefaultSize, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, - const wxString name = "stcwindow"); + const wxString& name = wxSTCNameStr); /** Extend life of document. @@ -352,14 +363,9 @@ public: void AddText(const wxString& text); /** - The following methods are nearly equivallent 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. + Add raw text to the document at current position. */ - void AddTextRaw(const char* text); + void AddTextRaw(const char* text, int length=-1); /** Enlarge the document to a particular size of text bytes. @@ -374,7 +380,7 @@ public: /** 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); /** Is there an auto-completion list visible? @@ -545,7 +551,7 @@ public: void BraceHighlight(int pos1, int pos2); /** - Find the position of a matching brace or INVALID_POSITION if no match. + Find the position of a matching brace or wxSTC_INVALID_POSITION if no match. */ int BraceMatch(int pos); @@ -597,7 +603,7 @@ public: /** Will a paste succeed? */ - bool CanPaste(); + virtual bool CanPaste() const; /** Are there any redoable actions in the undo history? @@ -934,12 +940,12 @@ public: /** */ - wxString GetCurLine(int* OUTPUT); + wxString GetCurLine(int* linePos = NULL); /** */ - wxCharBuffer GetCurLineRaw(int* OUTPUT); + wxCharBuffer GetCurLineRaw(int* linePos = NULL); /** END of generated section @@ -1022,7 +1028,7 @@ public: /** Are the indentation guides visible? */ - bool GetIndentationGuides(); + int GetIndentationGuides() const; /** Find the last child line of a header line. @@ -1040,7 +1046,7 @@ public: int GetLayoutCache() const; /** - Returns the number of characters in the document. + Returns the number of bytes in the document. */ int GetLength() const; @@ -1081,13 +1087,13 @@ public: /** Retrieve the position of the end of the selection at the given line - (INVALID_POSITION if no selection on this line). + (wxSTC_INVALID_POSITION if no selection on this line). */ int GetLineSelEndPosition(int line); /** Retrieve the position of the start of the selection at the given line - (INVALID_POSITION if no selection on this line). + (wxSTC_INVALID_POSITION if no selection on this line). */ int GetLineSelStartPosition(int line); @@ -1375,17 +1381,17 @@ public: int GetWrapMode() const; /** - Retrive the start indent for wrapped lines. + Retrieve the start indent for wrapped lines. */ int GetWrapStartIndent() const; /** - Retrive the display mode of visual flags for wrapped lines. + Retrieve the display mode of visual flags for wrapped lines. */ int GetWrapVisualFlags() const; /** - Retrive the location of visual flags for wrapped lines. + Retrieve the location of visual flags for wrapped lines. */ int GetWrapVisualFlagsLocation() const; @@ -1568,7 +1574,7 @@ public: int LineFromPosition(int pos) const; /** - How many characters are on a line, not including end of line characters? + How many characters are on a line, including end of line characters? */ int LineLength(int line) const; @@ -1626,7 +1632,7 @@ public: /** Load the contents of filename into the editor */ - bool LoadFile(const wxString& filename); + bool LoadFile(const wxString& file, int fileType = wxTEXT_TYPE_ANY); /** Transform the selection to lower case. @@ -1801,7 +1807,7 @@ public: /** Find the position from a point within the window but return - INVALID_POSITION if not close to text. + wxSTC_INVALID_POSITION if not close to text. */ int PositionFromPointClose(int x, int y); @@ -1847,7 +1853,7 @@ public: /** Write the contents of the editor to filename */ - bool SaveFile(const wxString& filename); + bool SaveFile(const wxString& file = wxEmptyString, int fileType = wxTEXT_TYPE_ANY); /** Scroll enough to make the given column visible @@ -1903,7 +1909,7 @@ public: /** Send a message to Scintilla */ - long SendMsg(int msg, long wp = 0, long lp = 0); + wxIntPtr SendMsg(int msg, wxUIntPtr wp = 0, wxIntPtr lp = 0) const; /** Set the selection anchor to a position. The anchor is the opposite @@ -2080,7 +2086,7 @@ public: /** Show or hide indentation guides. */ - void SetIndentationGuides(bool show); + void SetIndentationGuides(int indentView); /** Set up the key words used by the lexer. @@ -2234,19 +2240,19 @@ public: void SetSelAlpha(int alpha); /** - 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 SetSelBackground(bool useSetting, const wxColour& back); /** - 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 SetSelForeground(bool useSetting, const wxColour& fore); /** Select a range of text. */ - void SetSelection(int start, int end); + virtual void SetSelection(long from, long to); /** Sets the position that ends the selection - this becomes the currentPosition. @@ -2254,9 +2260,8 @@ public: void SetSelectionEnd(int pos); /** - Set the selection mode to stream (SC_SEL_STREAM) or rectangular - (SC_SEL_RECTANGLE) or - by lines (SC_SEL_LINES). + Set the selection mode to stream (wxSTC_SEL_STREAM) or rectangular + (wxSTC_SEL_RECTANGLE/wxSTC_SEL_THIN) or by lines (wxSTC_SEL_LINES). */ void SetSelectionMode(int mode); @@ -2398,9 +2403,20 @@ public: void SetWhitespaceForeground(bool useSetting, const wxColour& fore); + /** + Set the size of the dots used to mark space characters. + */ + void SetWhitespaceSize(int size); + + /** + Get the size of the dots used to mark space characters. + */ + int GetWhitespaceSize() const; + + /** 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 SetWordChars(const wxString& characters); @@ -2431,7 +2447,7 @@ public: void SetXCaretPolicy(int caretPolicy, int caretSlop); /** - Get and Set the xOffset (ie, horizonal scroll position). + Get and Set the xOffset (ie, horizontal scroll position). */ void SetXOffset(int newOffset); @@ -2780,5 +2796,367 @@ public: Make the displayed text smaller by decreasing the sizes by 1 point. */ void ZoomOut(); + + + /** + Sets how wrapped sublines are placed. Default is fixed. + */ + void SetWrapIndentMode(int mode); + + /** + Retrieve how wrapped sublines are placed. Default is fixed. + */ + int GetWrapIndentMode() const; + + /** + Scroll so that a display line is at the top of the display. + */ + void SetFirstVisibleLine(int lineDisplay); + + + + /** + Copy the selection, if selection empty copy the line with the caret + */ + void CopyAllowLine(); + + /** + Compact the document buffer and return a read-only pointer to the + characters in the document. + */ + const char* GetCharacterPointer(); + + /** + Always interpret keyboard input as Unicode + */ + void SetKeysUnicode(bool keysUnicode); + + /** + Are keys always interpreted as Unicode? + */ + bool GetKeysUnicode() const; + + /** + Set the alpha fill colour of the given indicator. + */ + void IndicatorSetAlpha(int indicator, int alpha); + + /** + Get the alpha fill colour of the given indicator. + */ + int IndicatorGetAlpha(int indicator) const; + + /** + Set extra ascent for each line + */ + void SetExtraAscent(int extraAscent); + + /** + Get extra ascent for each line + */ + int GetExtraAscent() const; + + /** + Set extra descent for each line + */ + void SetExtraDescent(int extraDescent); + + /** + Get extra descent for each line + */ + int GetExtraDescent() const; + + /** + Which symbol was defined for markerNumber with MarkerDefine + */ + int GetMarkerSymbolDefined(int markerNumber); + + /** + Set the text in the text margin for a line + */ + void MarginSetText(int line, const wxString& text); + + /** + Get the text in the text margin for a line + */ + wxString MarginGetText(int line) const; + + /** + Set the style number for the text margin for a line + */ + void MarginSetStyle(int line, int style); + + /** + Get the style number for the text margin for a line + */ + int MarginGetStyle(int line) const; + + /** + Set the style in the text margin for a line + */ + void MarginSetStyles(int line, const wxString& styles); + + /** + Get the styles in the text margin for a line + */ + wxString MarginGetStyles(int line) const; + + /** + Clear the margin text on all lines + */ + void MarginTextClearAll(); + + /** + Get the start of the range of style numbers used for margin text + */ + void MarginSetStyleOffset(int style); + + /** + Get the start of the range of style numbers used for margin text + */ + int MarginGetStyleOffset() const; + + /** + Set the annotation text for a line + */ + void AnnotationSetText(int line, const wxString& text); + + /** + Get the annotation text for a line + */ + wxString AnnotationGetText(int line) const; + + /** + Set the style number for the annotations for a line + */ + void AnnotationSetStyle(int line, int style); + + /** + Get the style number for the annotations for a line + */ + int AnnotationGetStyle(int line) const; + + /** + Set the annotation styles for a line + */ + void AnnotationSetStyles(int line, const wxString& styles); + + /** + Get the annotation styles for a line + */ + wxString AnnotationGetStyles(int line) const; + + /** + Get the number of annotation lines for a line + */ + int AnnotationGetLines(int line) const; + + /** + Clear the annotations from all lines + */ + void AnnotationClearAll(); + + /** + Set the visibility for the annotations for a view + */ + void AnnotationSetVisible(int visible); + + /** + Get the visibility for the annotations for a view + */ + int AnnotationGetVisible() const; + + /** + Get the start of the range of style numbers used for annotations + */ + void AnnotationSetStyleOffset(int style); + + /** + Get the start of the range of style numbers used for annotations + */ + int AnnotationGetStyleOffset() const; + + /** + Add a container action to the undo stack + */ + void AddUndoAction(int token, int flags); + + /** + Find the position of a character from a point within the window. + */ + int CharPositionFromPoint(int x, int y); + + /** + Find the position of a character from a point within the window. + Return wxSTC_INVALID_POSITION if not close to text. + */ + int CharPositionFromPointClose(int x, int y); + + /** + Set whether multiple selections can be made + */ + void SetMultipleSelection(bool multipleSelection); + + /** + Whether multiple selections can be made + */ + bool GetMultipleSelection() const; + + /** + Set whether typing can be performed into multiple selections + */ + void SetAdditionalSelectionTyping(bool additionalSelectionTyping); + + /** + Whether typing can be performed into multiple selections + */ + bool GetAdditionalSelectionTyping() const; + + /** + Set whether additional carets will blink + */ + void SetAdditionalCaretsBlink(bool additionalCaretsBlink); + + /** + Whether additional carets will blink + */ + bool GetAdditionalCaretsBlink() const; + + /** + Set whether additional carets are visible + */ + void SetAdditionalCaretsVisible(bool additionalCaretsBlink); + + /** + Whether additional carets are visible + */ + bool GetAdditionalCaretsVisible() const; + + /** + How many selections are there? + */ + int GetSelections() const; + + /** + Clear selections to a single empty stream selection + */ + void ClearSelections(); + + /** + Add a selection + */ + int AddSelection(int caret, int anchor); + + /** + Set the main selection + */ + void SetMainSelection(int selection); + + /** + Which selection is the main selection + */ + int GetMainSelection() const; + + void SetSelectionNCaret(int selection, int pos); + int GetSelectionNCaret(int selection) const; + void SetSelectionNAnchor(int selection, int posAnchor); + int GetSelectionNAnchor(int selection) const; + void SetSelectionNCaretVirtualSpace(int selection, int space); + int GetSelectionNCaretVirtualSpace(int selection) const; + void SetSelectionNAnchorVirtualSpace(int selection, int space); + int GetSelectionNAnchorVirtualSpace(int selection) const; + + /** + Sets the position that starts the selection - this becomes the anchor. + */ + void SetSelectionNStart(int selection, int pos); + + /** + Returns the position at the start of the selection. + */ + int GetSelectionNStart(int selection) const; + + /** + Sets the position that ends the selection - this becomes the currentPosition. + */ + void SetSelectionNEnd(int selection, int pos); + + /** + Returns the position at the end of the selection. + */ + int GetSelectionNEnd(int selection) const; + + void SetRectangularSelectionCaret(int pos); + int GetRectangularSelectionCaret() const; + void SetRectangularSelectionAnchor(int posAnchor); + int GetRectangularSelectionAnchor() const; + void SetRectangularSelectionCaretVirtualSpace(int space); + int GetRectangularSelectionCaretVirtualSpace() const; + void SetRectangularSelectionAnchorVirtualSpace(int space); + int GetRectangularSelectionAnchorVirtualSpace() const; + void SetVirtualSpaceOptions(int virtualSpaceOptions); + int GetVirtualSpaceOptions() const; + + /** + Select the modifier key to use for mouse-based rectangular selection. + */ + void SetRectangularSelectionModifier(int modifier); + + /** + Get the modifier key used for rectangular selection. + */ + int GetRectangularSelectionModifier() const; + + /** + Set the foreground colour of additional selections. Must have + previously called SetSelFore with non-zero first argument for this to + have an effect. + */ + void SetAdditionalSelForeground(const wxColour& fore); + + /** + Set the background colour of additional selections. Must have + previously called SetSelBack with non-zero first argument for this to + have an effect. + */ + void SetAdditionalSelBackground(const wxColour& back); + + /** + Set the alpha of the selection. + */ + void SetAdditionalSelAlpha(int alpha); + + /** + Get the alpha of the selection. + */ + int GetAdditionalSelAlpha() const; + + /** + Set the foreground colour of additional carets. + */ + void SetAdditionalCaretForeground(const wxColour& fore); + + /** + Get the foreground colour of additional carets. + */ + wxColour GetAdditionalCaretForeground() const; + + /** + Set the main selection to the next selection. + */ + void RotateSelection(); + + /** + Swap that caret and anchor of the main selection. + */ + void SwapMainAnchorCaret(); + + /** + Get Scintilla library version information. + + @since 2.9.2 + @see wxVersionInfo + */ + static wxVersionInfo GetLibraryVersionInfo(); };