X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d6582821b61ba8270f712e0f26b2a3d7bf24116f..aa4b7ef978937fe5d93fda9276ecbbee0cd66517:/include/wx/stc/stc.h diff --git a/include/wx/stc/stc.h b/include/wx/stc/stc.h index f4464722e8..64061f23fc 100644 --- a/include/wx/stc/stc.h +++ b/include/wx/stc/stc.h @@ -22,6 +22,14 @@ #include +#include + +//---------------------------------------------------------------------- + +// Should a wxPopupWindow be used for the call tips and autocomplete windows? +#ifndef wxSTC_USE_POPUP +#define wxSTC_USE_POPUP 1 +#endif //---------------------------------------------------------------------- // BEGIN generated section. The following code is automatically generated @@ -35,7 +43,11 @@ #define wxSTC_START 2000 #define wxSTC_OPTIONAL_START 3000 #define wxSTC_LEXER_START 4000 + +// Redoes the next action on the undo history #define wxSTC_CMD_REDO 2011 + +// Select all the text in the document. #define wxSTC_CMD_SELECTALL 2013 #define wxSTC_WS_INVISIBLE 0 #define wxSTC_WS_VISIBLEALWAYS 1 @@ -73,6 +85,10 @@ #define wxSTC_MARK_CIRCLEMINUS 20 #define wxSTC_MARK_CIRCLEMINUSCONNECTED 21 +// Invisible mark that only sets the line background color +#define wxSTC_MARK_BACKGROUND 22 +#define wxSTC_MARK_CHARACTER 10000 + // Markers used for outlining column #define wxSTC_MARKNUM_FOLDEREND 25 #define wxSTC_MARKNUM_FOLDEROPENMID 26 @@ -81,14 +97,19 @@ #define wxSTC_MARKNUM_FOLDERSUB 29 #define wxSTC_MARKNUM_FOLDER 30 #define wxSTC_MARKNUM_FOLDEROPEN 31 +#define wxSTC_MASK_FOLDERS 0xFE000000 #define wxSTC_MARGIN_SYMBOL 0 #define wxSTC_MARGIN_NUMBER 1 + +// Styles in range 32..37 are predefined for parts of the UI and are not used as normal styles. +// Styles 38 and 39 are for future use. #define wxSTC_STYLE_DEFAULT 32 #define wxSTC_STYLE_LINENUMBER 33 #define wxSTC_STYLE_BRACELIGHT 34 #define wxSTC_STYLE_BRACEBAD 35 #define wxSTC_STYLE_CONTROLCHAR 36 #define wxSTC_STYLE_INDENTGUIDE 37 +#define wxSTC_STYLE_LASTPREDEFINED 39 #define wxSTC_STYLE_MAX 127 // Character set identifiers are used in StyleSetCharacterSet. @@ -121,10 +142,10 @@ #define wxSTC_INDIC_TT 2 #define wxSTC_INDIC_DIAGONAL 3 #define wxSTC_INDIC_STRIKE 4 -#define wxSTC_INDIC0_MASK 32 -#define wxSTC_INDIC1_MASK 64 -#define wxSTC_INDIC2_MASK 128 -#define wxSTC_INDICS_MASK 224 +#define wxSTC_INDIC0_MASK 0x20 +#define wxSTC_INDIC1_MASK 0x40 +#define wxSTC_INDIC2_MASK 0x80 +#define wxSTC_INDICS_MASK 0xE0 // PrintColourMode - use same colours as screen. #define wxSTC_PRINT_NORMAL 0 @@ -144,59 +165,168 @@ #define wxSTC_FIND_MATCHCASE 4 #define wxSTC_FIND_WORDSTART 0x00100000 #define wxSTC_FIND_REGEXP 0x00200000 + +// Undo one action in the undo history. #define wxSTC_CMD_UNDO 2176 + +// Cut the selection to the clipboard. #define wxSTC_CMD_CUT 2177 + +// Copy the selection to the clipboard. #define wxSTC_CMD_COPY 2178 + +// Paste the contents of the clipboard into the document replacing the selection. #define wxSTC_CMD_PASTE 2179 #define wxSTC_FOLDLEVELBASE 0x400 #define wxSTC_FOLDLEVELWHITEFLAG 0x1000 #define wxSTC_FOLDLEVELHEADERFLAG 0x2000 #define wxSTC_FOLDLEVELNUMBERMASK 0x0FFF #define wxSTC_TIME_FOREVER 10000000 +#define wxSTC_WRAP_NONE 0 +#define wxSTC_WRAP_WORD 1 +#define wxSTC_CACHE_NONE 0 +#define wxSTC_CACHE_CARET 1 +#define wxSTC_CACHE_PAGE 2 +#define wxSTC_CACHE_DOCUMENT 3 + +// Move caret down one line. #define wxSTC_CMD_LINEDOWN 2300 + +// Move caret down one line extending selection to new caret position. #define wxSTC_CMD_LINEDOWNEXTEND 2301 + +// Move caret up one line. #define wxSTC_CMD_LINEUP 2302 + +// Move caret up one line extending selection to new caret position. #define wxSTC_CMD_LINEUPEXTEND 2303 + +// Move caret left one character. #define wxSTC_CMD_CHARLEFT 2304 + +// Move caret left one character extending selection to new caret position. #define wxSTC_CMD_CHARLEFTEXTEND 2305 + +// Move caret right one character. #define wxSTC_CMD_CHARRIGHT 2306 + +// Move caret right one character extending selection to new caret position. #define wxSTC_CMD_CHARRIGHTEXTEND 2307 + +// Move caret left one word. #define wxSTC_CMD_WORDLEFT 2308 + +// Move caret left one word extending selection to new caret position. #define wxSTC_CMD_WORDLEFTEXTEND 2309 + +// Move caret right one word. #define wxSTC_CMD_WORDRIGHT 2310 + +// Move caret right one word extending selection to new caret position. #define wxSTC_CMD_WORDRIGHTEXTEND 2311 + +// Move caret to first position on line. #define wxSTC_CMD_HOME 2312 + +// Move caret to first position on line extending selection to new caret position. #define wxSTC_CMD_HOMEEXTEND 2313 + +// Move caret to last position on line. #define wxSTC_CMD_LINEEND 2314 + +// Move caret to last position on line extending selection to new caret position. #define wxSTC_CMD_LINEENDEXTEND 2315 + +// Move caret to first position in document. #define wxSTC_CMD_DOCUMENTSTART 2316 + +// Move caret to first position in document extending selection to new caret position. #define wxSTC_CMD_DOCUMENTSTARTEXTEND 2317 + +// Move caret to last position in document. #define wxSTC_CMD_DOCUMENTEND 2318 + +// Move caret to last position in document extending selection to new caret position. #define wxSTC_CMD_DOCUMENTENDEXTEND 2319 + +// Move caret one page up. #define wxSTC_CMD_PAGEUP 2320 + +// Move caret one page up extending selection to new caret position. #define wxSTC_CMD_PAGEUPEXTEND 2321 + +// Move caret one page down. #define wxSTC_CMD_PAGEDOWN 2322 + +// Move caret one page down extending selection to new caret position. #define wxSTC_CMD_PAGEDOWNEXTEND 2323 + +// Switch from insert to overtype mode or the reverse. #define wxSTC_CMD_EDITTOGGLEOVERTYPE 2324 + +// Cancel any modes such as call tip or auto-completion list display. #define wxSTC_CMD_CANCEL 2325 + +// Delete the selection or if no selection, the character before the caret. #define wxSTC_CMD_DELETEBACK 2326 + +// If selection is empty or all on one line replace the selection with a tab +// character. +// If more than one line selected, indent the lines. #define wxSTC_CMD_TAB 2327 + +// Dedent the selected lines. #define wxSTC_CMD_BACKTAB 2328 + +// Insert a new line, may use a CRLF, CR or LF depending on EOL mode. #define wxSTC_CMD_NEWLINE 2329 + +// Insert a Form Feed character. #define wxSTC_CMD_FORMFEED 2330 + +// Move caret to before first visible character on line. +// If already there move to first character on line. #define wxSTC_CMD_VCHOME 2331 + +// Like VCHome but extending selection to new caret position. #define wxSTC_CMD_VCHOMEEXTEND 2332 + +// Magnify the displayed text by increasing the sizes by 1 point. #define wxSTC_CMD_ZOOMIN 2333 + +// Make the displayed text smaller by decreasing the sizes by 1 point. #define wxSTC_CMD_ZOOMOUT 2334 + +// Delete the word to the left of the caret. #define wxSTC_CMD_DELWORDLEFT 2335 + +// Delete the word to the right of the caret. #define wxSTC_CMD_DELWORDRIGHT 2336 + +// Cut the line containing the caret. #define wxSTC_CMD_LINECUT 2337 + +// Delete the line containing the caret. #define wxSTC_CMD_LINEDELETE 2338 + +// Switch the current line with the previous. #define wxSTC_CMD_LINETRANSPOSE 2339 + +// Transform the selection to lower case. #define wxSTC_CMD_LOWERCASE 2340 + +// Transform the selection to upper case. #define wxSTC_CMD_UPPERCASE 2341 + +// Scroll the document down, keeping the caret visible. #define wxSTC_CMD_LINESCROLLDOWN 2342 + +// Scroll the document up, keeping the caret visible. #define wxSTC_CMD_LINESCROLLUP 2343 + +// Delete the selection or if no selection, the character before the caret. +// Will not delete the chraacter before at the start of a line. +#define wxSTC_CMD_DELETEBACKNOTLINE 2344 #define wxSTC_EDGE_NONE 0 #define wxSTC_EDGE_LINE 1 #define wxSTC_EDGE_BACKGROUND 2 @@ -295,6 +425,13 @@ #define wxSTC_LEX_EIFFEL 23 #define wxSTC_LEX_EIFFELKW 24 #define wxSTC_LEX_TCL 25 +#define wxSTC_LEX_NNCRONTAB 26 +#define wxSTC_LEX_BULLANT 27 +#define wxSTC_LEX_VBSCRIPT 28 +#define wxSTC_LEX_ASP 29 +#define wxSTC_LEX_PHP 30 +#define wxSTC_LEX_BAAN 31 +#define wxSTC_LEX_MATLAB 32 // When a lexer specifies its language as SCLEX_AUTOMATIC it receives a // value assigned in sequence from SCLEX_AUTOMATIC+1. @@ -316,7 +453,7 @@ #define wxSTC_P_COMMENTBLOCK 12 #define wxSTC_P_STRINGEOL 13 -// Lexical states for SCLEX_CPP, SCLEX_VB +// Lexical states for SCLEX_CPP #define wxSTC_C_DEFAULT 0 #define wxSTC_C_COMMENT 1 #define wxSTC_C_COMMENTLINE 2 @@ -334,6 +471,19 @@ #define wxSTC_C_REGEX 14 #define wxSTC_C_COMMENTLINEDOC 15 #define wxSTC_C_WORD2 16 +#define wxSTC_C_COMMENTDOCKEYWORD 17 +#define wxSTC_C_COMMENTDOCKEYWORDERROR 18 + +// Lexical states for SCLEX_VB, SCLEX_VBSCRIPT +#define wxSTC_B_DEFAULT 0 +#define wxSTC_B_COMMENT 1 +#define wxSTC_B_NUMBER 2 +#define wxSTC_B_KEYWORD 3 +#define wxSTC_B_STRING 4 +#define wxSTC_B_PREPROCESSOR 5 +#define wxSTC_B_OPERATOR 6 +#define wxSTC_B_IDENTIFIER 7 +#define wxSTC_B_DATE 8 // Lexical states for SCLEX_HTML, SCLEX_XML #define wxSTC_H_DEFAULT 0 @@ -365,7 +515,17 @@ #define wxSTC_H_XCCOMMENT 20 // SGML -#define wxSTC_H_SGML 21 +#define wxSTC_H_SGML_DEFAULT 21 +#define wxSTC_H_SGML_COMMAND 22 +#define wxSTC_H_SGML_1ST_PARAM 23 +#define wxSTC_H_SGML_DOUBLESTRING 24 +#define wxSTC_H_SGML_SIMPLESTRING 25 +#define wxSTC_H_SGML_ERROR 26 +#define wxSTC_H_SGML_SPECIAL 27 +#define wxSTC_H_SGML_ENTITY 28 +#define wxSTC_H_SGML_COMMENT 29 +#define wxSTC_H_SGML_1ST_PARAM_COMMENT 30 +#define wxSTC_H_SGML_BLOCK_DEFAULT 31 // Embedded Javascript #define wxSTC_HJ_START 40 @@ -512,6 +672,11 @@ #define wxSTC_LUA_OPERATOR 10 #define wxSTC_LUA_IDENTIFIER 11 #define wxSTC_LUA_STRINGEOL 12 +#define wxSTC_LUA_WORD2 13 +#define wxSTC_LUA_WORD3 14 +#define wxSTC_LUA_WORD4 15 +#define wxSTC_LUA_WORD5 16 +#define wxSTC_LUA_WORD6 17 // Lexical states for SCLEX_ERRORLIST #define wxSTC_ERR_DEFAULT 0 @@ -583,6 +748,19 @@ #define wxSTC_ADA_IDENTIFIER 7 #define wxSTC_ADA_STRINGEOL 8 +// Lexical states for SCLEX_BAAN +#define wxSTC_BAAN_DEFAULT 0 +#define wxSTC_BAAN_COMMENT 1 +#define wxSTC_BAAN_COMMENTDOC 2 +#define wxSTC_BAAN_NUMBER 3 +#define wxSTC_BAAN_WORD 4 +#define wxSTC_BAAN_STRING 5 +#define wxSTC_BAAN_PREPROCESSOR 6 +#define wxSTC_BAAN_OPERATOR 7 +#define wxSTC_BAAN_IDENTIFIER 8 +#define wxSTC_BAAN_STRINGEOL 9 +#define wxSTC_BAAN_WORD2 10 + // Lexical states for SCLEX_LISP #define wxSTC_LISP_DEFAULT 0 #define wxSTC_LISP_COMMENT 1 @@ -604,14 +782,30 @@ #define wxSTC_EIFFEL_IDENTIFIER 7 #define wxSTC_EIFFEL_STRINGEOL 8 -// END of generated section -//---------------------------------------------------------------------- -// Others - -#define wxSTC_MASK_FOLDERS ((1 << wxSTC_MARKNUM_FOLDER) | (1 << wxSTC_MARKNUM_FOLDEROPEN)) - - +// Lexical states for the SCLEX_NNCRONTAB (nnCron crontab Lexer) +#define wxSTC_NNCRONTAB_DEFAULT 0 +#define wxSTC_NNCRONTAB_COMMENT 1 +#define wxSTC_NNCRONTAB_TASK 2 +#define wxSTC_NNCRONTAB_SECTION 3 +#define wxSTC_NNCRONTAB_KEYWORD 4 +#define wxSTC_NNCRONTAB_MODIFIER 5 +#define wxSTC_NNCRONTAB_ASTERISK 6 +#define wxSTC_NNCRONTAB_NUMBER 7 +#define wxSTC_NNCRONTAB_STRING 8 +#define wxSTC_NNCRONTAB_ENVIRONMENT 9 +#define wxSTC_NNCRONTAB_IDENTIFIER 10 + +// Lexical states for SCLEX_MATLAB +#define wxSTC_MATLAB_DEFAULT 0 +#define wxSTC_MATLAB_COMMENT 1 +#define wxSTC_MATLAB_COMMAND 2 +#define wxSTC_MATLAB_NUMBER 3 +#define wxSTC_MATLAB_KEYWORD 4 +#define wxSTC_MATLAB_STRING 5 +#define wxSTC_MATLAB_OPERATOR 6 +#define wxSTC_MATLAB_IDENTIFIER 7 +// END of generated section //---------------------------------------------------------------------- class ScintillaWX; // forward declare @@ -630,7 +824,9 @@ public: wxStyledTextCtrl(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, - const char* name = "styledtext"); + const wxString& name = wxPySTCNameStr); + %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" + #else wxStyledTextCtrl(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, @@ -653,7 +849,7 @@ public: void AddText(const wxString& text); // Add array of cells to document - void AddStyledText(const wxString& text); + void AddStyledText(const wxMemoryBuffer& data); // Insert string at a position void InsertText(int pos, const wxString& text); @@ -694,7 +890,7 @@ public: void SetSavePoint(); // Retrieve a buffer of cells. - wxString GetStyledText(int startPos, int endPos); + wxMemoryBuffer GetStyledText(int startPos, int endPos); // Are there any redoable actions in the undo history. bool CanRedo(); @@ -776,11 +972,10 @@ public: int GetTabWidth(); // Set the code page used to interpret the bytes of the document as characters. - // The SC_CP_UTF8 value can be used to enter Unicode mode. void SetCodePage(int codePage); // Set the symbol used for a particular marker number, - // and optionally the for and background colours. + // and optionally the fore and background colours. void MarkerDefine(int markerNumber, int markerSymbol, const wxColour& foreground = wxNullColour, const wxColour& background = wxNullColour); @@ -791,8 +986,8 @@ public: // Set the background colour used for a particular marker number. void MarkerSetBackground(int markerNumber, const wxColour& back); - // Add a marker to a line. - void MarkerAdd(int line, int markerNumber); + // Add a marker to a line, returning an ID which can be used to find or delete the marker. + int MarkerAdd(int line, int markerNumber); // Delete a marker from a line void MarkerDelete(int line, int markerNumber); @@ -866,6 +1061,9 @@ public: // Set a style to be mixed case, or to force upper or lower case. void StyleSetCase(int style, int caseForce); + // Set the character set of the font in a style. + void StyleSetCharacterSet(int style, int characterSet); + // Set the foreground colour of the selection and whether to use this setting. void SetSelForeground(bool useSetting, const wxColour& fore); @@ -939,7 +1137,7 @@ public: // Is the background of the line containing the caret in a different colour? bool GetCaretLineVisible(); - // Display the background of the line containing the caret in a different colour. + // Dsplay the background of the line containing the caret in a different colour. void SetCaretLineVisible(bool show); // Get the colour of the background of the line containing the caret. @@ -948,6 +1146,10 @@ public: // Set the colour of the background of the line containing the caret. void SetCaretLineBack(const wxColour& back); + // Set a style to be changeable or not (read only). + // Experimental feature, currently buggy. + void StyleSetChangeable(int style, bool changeable); + // Display a auto-completion list. // The lenEntered parameter indicates how many characters before // the caret should be used to provide context. @@ -986,7 +1188,8 @@ public: // Retrieve whether auto-completion cancelled by backspacing before start. bool AutoCompGetCancelAtStart(); - // Define a set of character that when typed fills up the selected word. + // Define a set of characters that when typed will cause the autocompletion to + // choose the selected item. void AutoCompSetFillUps(const wxString& characterSet); // Should a single item auto-completion list automatically choose the item. @@ -1010,6 +1213,12 @@ public: // Retrieve whether or not autocompletion is hidden automatically when nothing matches bool AutoCompGetAutoHide(); + // Set whether or not autocompletion deletes any word characters after the inserted text upon completion + void AutoCompSetDropRestOfWord(bool dropRestOfWord); + + // Retrieve whether or not autocompletion deletes any word characters after the inserted text upon completion + bool AutoCompGetDropRestOfWord(); + // Set the number of spaces used for one level of indentation. void SetIndent(int indentSize); @@ -1094,9 +1303,7 @@ public: int GetPrintColourMode(); // Find some text in the document. - int FindText(int minPos, int maxPos, - const wxString& text, - bool caseSensitive, bool wholeWord); + int FindText(int minPos, int maxPos, const wxString& text, int flags=0); // On Windows will draw the document into a display context such as a printer. int FormatRange(bool doDraw, @@ -1221,10 +1428,12 @@ public: int GetTargetEnd(); // Replace the target text with the argument text. + // Text is counted so it can contain nulls. // Returns the length of the replacement text. int ReplaceTarget(const wxString& text); // Replace the target text with the argument text after \d processing. + // Text is counted so it can contain nulls. // Looks for \d where d is between 1 and 9 and replaces these with the strings // matched in the last search operation which were surrounded by \( and \). // Returns the length of the replacement text including any change @@ -1232,7 +1441,7 @@ public: int ReplaceTargetRE(const wxString& text); // Search for a counted string in the target and set the target to the found - // range. + // range. Text is counted so it can contain nulls. // Returns length of range or -1 for failure in which case target is not moved. int SearchInTarget(const wxString& text); @@ -1326,6 +1535,24 @@ public: // Retrieve the time the mouse must sit still to generate a mouse dwell event int GetMouseDwellTime(); + // Get position of start of word + int WordStartPosition(int pos, bool onlyWordCharacters); + + // Get position of end of word + int WordEndPosition(int pos, bool onlyWordCharacters); + + // Sets whether text is word wrapped + void SetWrapMode(int mode); + + // Retrieve whether text is word wrapped + int GetWrapMode(); + + // Sets the degree of caching of layout information + void SetLayoutCache(int mode); + + // Retrieve the degree of caching of layout information + int GetLayoutCache(); + // Move the caret inside current view if it's not there already void MoveCaretInsideView(); @@ -1444,6 +1671,13 @@ public: // Get cursor type int GetCursor(); + // Change the way control characters are displayed: + // If symbol is < 32, keep the drawn way, else, use the given character + void SetControlCharSymbol(int symbol); + + // Get the way control characters are displayed + int GetControlCharSymbol(); + // Move to the previous change in capitalistion void WordPartLeft(); @@ -1465,6 +1699,10 @@ public: // Delete forwards from the current position to the end of the line void DelLineRight(); + // Get and Set the xOffset (ie, horizonal scroll position) + void SetXOffset(int newOffset); + int GetXOffset(); + // Start notifying the container of all key presses and commands. void StartRecord(); @@ -1558,6 +1796,19 @@ public: // Send a message to Scintilla long SendMsg(int msg, long wp=0, long lp=0); + + // Set the vertical scrollbar to use instead of the ont that's built-in. + void SetVScrollBar(wxScrollBar* bar) { m_vScrollBar = bar; } + + + // Set the horizontal scrollbar to use instead of the ont that's built-in. + void SetHScrollBar(wxScrollBar* bar) { m_hScrollBar = bar; } + + // Can be used to prevent the EVT_CHAR handler from adding the char + bool GetLastKeydownProcessed() { return m_lastKeyDownConsumed; } + void SetLastKeydownProcessed(bool val) { m_lastKeyDownConsumed = val; } + + //---------------------------------------------------------------------- @@ -1566,10 +1817,12 @@ private: // Event handlers void OnPaint(wxPaintEvent& evt); void OnScrollWin(wxScrollWinEvent& evt); + void OnScroll(wxScrollEvent& evt); void OnSize(wxSizeEvent& evt); void OnMouseLeftDown(wxMouseEvent& evt); void OnMouseMove(wxMouseEvent& evt); void OnMouseLeftUp(wxMouseEvent& evt); + void OnMouseRightUp(wxMouseEvent& evt); void OnContextMenu(wxContextMenuEvent& evt); void OnMouseWheel(wxMouseEvent& evt); void OnChar(wxKeyEvent& evt); @@ -1586,12 +1839,15 @@ private: void NotifyChange(); void NotifyParent(SCNotification* scn); + private: DECLARE_EVENT_TABLE() DECLARE_CLASS(wxStyledTextCtrl) ScintillaWX* m_swx; wxStopWatch m_stopWatch; + wxScrollBar* m_vScrollBar; + wxScrollBar* m_hScrollBar; bool m_lastKeyDownConsumed; @@ -1602,28 +1858,45 @@ private: //---------------------------------------------------------------------- +// SWIG can't handle "#if" type of conditionals, onlu "#ifdef" +#ifdef SWIG +#define STC_USE_DND 1 +#else +#if wxUSE_DRAG_AND_DROP +#define STC_USE_DND 1 +#endif +#endif + class wxStyledTextEvent : public wxCommandEvent { public: wxStyledTextEvent(wxEventType commandType=0, int id=0); +#ifndef SWIG + wxStyledTextEvent(const wxStyledTextEvent& event); +#endif ~wxStyledTextEvent() {} - void SetPosition(int pos) { m_position = pos; } - void SetKey(int k) { m_key = k; } - void SetModifiers(int m) { m_modifiers = m; } - void SetModificationType(int t) { m_modificationType = t; } - void SetText(const char* t) { m_text = t; } - void SetLength(int len) { m_length = len; } - void SetLinesAdded(int num) { m_linesAdded = num; } - void SetLine(int val) { m_line = val; } - void SetFoldLevelNow(int val) { m_foldLevelNow = val; } - void SetFoldLevelPrev(int val) { m_foldLevelPrev = val; } - void SetMargin(int val) { m_margin = val; } - void SetMessage(int val) { m_message = val; } - void SetWParam(int val) { m_wParam = val; } - void SetLParam(int val) { m_lParam = val; } - void SetListType(int val) { m_listType = val; } - void SetX(int val) { m_x = val; } - void SetY(int val) { m_y = val; } + void SetPosition(int pos) { m_position = pos; } + void SetKey(int k) { m_key = k; } + void SetModifiers(int m) { m_modifiers = m; } + void SetModificationType(int t) { m_modificationType = t; } + void SetText(const wxString& t) { m_text = t; } + void SetLength(int len) { m_length = len; } + void SetLinesAdded(int num) { m_linesAdded = num; } + void SetLine(int val) { m_line = val; } + void SetFoldLevelNow(int val) { m_foldLevelNow = val; } + void SetFoldLevelPrev(int val) { m_foldLevelPrev = val; } + void SetMargin(int val) { m_margin = val; } + void SetMessage(int val) { m_message = val; } + void SetWParam(int val) { m_wParam = val; } + void SetLParam(int val) { m_lParam = val; } + 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; } +#ifdef STC_USE_DND + void SetDragResult(wxDragResult val) { m_dragResult = val; } +#endif int GetPosition() const { return m_position; } int GetKey() const { return m_key; } @@ -1642,12 +1915,17 @@ public: 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; } +#ifdef STC_USE_DND + wxDragResult GetDragResult() { return m_dragResult; } +#endif bool GetShift() const; bool GetControl() const; bool GetAlt() const; - void CopyObject(wxObject& obj) const; + virtual wxEvent* Clone() const { return new wxStyledTextEvent(*this); } #ifndef SWIG private: @@ -1674,6 +1952,13 @@ private: int m_listType; int m_x; int m_y; + + wxString m_dragText; // wxEVT_STC_START_DRAG, wxEVT_STC_DO_DROP + bool m_dragAllowMove; // wxEVT_STC_START_DRAG + +#if wxUSE_DRAG_AND_DROP + wxDragResult m_dragResult; // wxEVT_STC_DRAG_OVER,wxEVT_STC_DO_DROP +#endif #endif }; @@ -1698,6 +1983,9 @@ BEGIN_DECLARE_EVENT_TYPES() DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_URIDROPPED, 1666) DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DWELLSTART, 1667) DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DWELLEND, 1668) + DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_START_DRAG, 1669) + DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DRAG_OVER, 1670) + DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DO_DROP, 1671) END_DECLARE_EVENT_TYPES() #else enum { @@ -1720,6 +2008,9 @@ END_DECLARE_EVENT_TYPES() wxEVT_STC_URIDROPPED, wxEVT_STC_DWELLSTART, wxEVT_STC_DWELLEND, + wxEVT_STC_START_DRAG, + wxEVT_STC_DRAG_OVER, + wxEVT_STC_DO_DROP, }; #endif @@ -1747,11 +2038,45 @@ typedef void (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&); #define EVT_STC_URIDROPPED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_URIDROPPED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ), #define EVT_STC_DWELLSTART(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLSTART, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ), #define EVT_STC_DWELLEND(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLEND, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ), +#define EVT_STC_START_DRAG(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_START_DRAG, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ), +#define EVT_STC_DRAG_OVER(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DRAG_OVER, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ), +#define EVT_STC_DO_DROP(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DO_DROP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ), +#endif +//---------------------------------------------------------------------- +// Utility functions used within wxSTC +#ifndef SWIG + +inline wxString stc2wx(const char* str) { +#if wxUSE_UNICODE + return wxString(str, wxConvUTF8); +#else + return wxString(str); #endif +} + +inline wxString stc2wx(const char* str, size_t len) { +#if wxUSE_UNICODE + return wxString(str, wxConvUTF8, len); +#else + return wxString(str, len); +#endif +} + +#if wxUSE_UNICODE +inline const wxWX2MBbuf wx2stc(const wxString& str) { + return str.mb_str(wxConvUTF8); +} +#else +inline const wxWX2MBbuf wx2stc(const wxString& str) { + return str.mbc_str(); +} +#endif + +#endif + -//---------------------------------------------------------------------- //---------------------------------------------------------------------- #endif