Added DnD related events to wxSTC

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12156 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2001-10-23 22:12:50 +00:00
parent 4f14bcd874
commit a29a241fd6
16 changed files with 689 additions and 137 deletions

View File

@@ -28,6 +28,7 @@
<FONT color=#a020f0>#include </FONT><FONT color=#ff00ff>&lt;wx/wx.h&gt;</FONT>
<FONT color=#a020f0>#include </FONT><FONT color=#ff00ff>&lt;wx/dnd.h&gt;</FONT>
<FONT color=#0000ff>//----------------------------------------------------------------------</FONT>
<FONT color=#0000ff>// BEGIN generated section. The following code is automatically generated</FONT>
@@ -78,6 +79,7 @@
<FONT color=#a020f0>#define wxSTC_MARK_CIRCLEPLUSCONNECTED </FONT><FONT color=#ff00ff>19</FONT>
<FONT color=#a020f0>#define wxSTC_MARK_CIRCLEMINUS </FONT><FONT color=#ff00ff>20</FONT>
<FONT color=#a020f0>#define wxSTC_MARK_CIRCLEMINUSCONNECTED </FONT><FONT color=#ff00ff>21</FONT>
<FONT color=#a020f0>#define wxSTC_MARK_CHARACTER </FONT><FONT color=#ff00ff>10000</FONT>
<FONT color=#0000ff>// Markers used for outlining column</FONT>
<FONT color=#a020f0>#define wxSTC_MARKNUM_FOLDEREND </FONT><FONT color=#ff00ff>25</FONT>
@@ -89,12 +91,16 @@
<FONT color=#a020f0>#define wxSTC_MARKNUM_FOLDEROPEN </FONT><FONT color=#ff00ff>31</FONT>
<FONT color=#a020f0>#define wxSTC_MARGIN_SYMBOL </FONT><FONT color=#ff00ff>0</FONT>
<FONT color=#a020f0>#define wxSTC_MARGIN_NUMBER </FONT><FONT color=#ff00ff>1</FONT>
<FONT color=#0000ff>// Styles in range 32..37 are predefined for parts of the UI and are not used as normal styles.</FONT>
<FONT color=#0000ff>// Styles 38 and 39 are for future use.</FONT>
<FONT color=#a020f0>#define wxSTC_STYLE_DEFAULT </FONT><FONT color=#ff00ff>32</FONT>
<FONT color=#a020f0>#define wxSTC_STYLE_LINENUMBER </FONT><FONT color=#ff00ff>33</FONT>
<FONT color=#a020f0>#define wxSTC_STYLE_BRACELIGHT </FONT><FONT color=#ff00ff>34</FONT>
<FONT color=#a020f0>#define wxSTC_STYLE_BRACEBAD </FONT><FONT color=#ff00ff>35</FONT>
<FONT color=#a020f0>#define wxSTC_STYLE_CONTROLCHAR </FONT><FONT color=#ff00ff>36</FONT>
<FONT color=#a020f0>#define wxSTC_STYLE_INDENTGUIDE </FONT><FONT color=#ff00ff>37</FONT>
<FONT color=#a020f0>#define wxSTC_STYLE_LASTPREDEFINED </FONT><FONT color=#ff00ff>39</FONT>
<FONT color=#a020f0>#define wxSTC_STYLE_MAX </FONT><FONT color=#ff00ff>127</FONT>
<FONT color=#0000ff>// Character set identifiers are used in StyleSetCharacterSet.</FONT>
@@ -301,6 +307,7 @@
<FONT color=#a020f0>#define wxSTC_LEX_EIFFEL </FONT><FONT color=#ff00ff>23</FONT>
<FONT color=#a020f0>#define wxSTC_LEX_EIFFELKW </FONT><FONT color=#ff00ff>24</FONT>
<FONT color=#a020f0>#define wxSTC_LEX_TCL </FONT><FONT color=#ff00ff>25</FONT>
<FONT color=#a020f0>#define wxSTC_LEX_NNCRONTAB </FONT><FONT color=#ff00ff>26</FONT>
<FONT color=#0000ff>// When a lexer specifies its language as SCLEX_AUTOMATIC it receives a</FONT>
<FONT color=#0000ff>// value assigned in sequence from SCLEX_AUTOMATIC+1.</FONT>
@@ -340,6 +347,8 @@
<FONT color=#a020f0>#define wxSTC_C_REGEX </FONT><FONT color=#ff00ff>14</FONT>
<FONT color=#a020f0>#define wxSTC_C_COMMENTLINEDOC </FONT><FONT color=#ff00ff>15</FONT>
<FONT color=#a020f0>#define wxSTC_C_WORD2 </FONT><FONT color=#ff00ff>16</FONT>
<FONT color=#a020f0>#define wxSTC_C_COMMENTDOCKEYWORD </FONT><FONT color=#ff00ff>17</FONT>
<FONT color=#a020f0>#define wxSTC_C_COMMENTDOCKEYWORDERROR </FONT><FONT color=#ff00ff>18</FONT>
<FONT color=#0000ff>// Lexical states for SCLEX_HTML, SCLEX_XML</FONT>
<FONT color=#a020f0>#define wxSTC_H_DEFAULT </FONT><FONT color=#ff00ff>0</FONT>
@@ -371,7 +380,17 @@
<FONT color=#a020f0>#define wxSTC_H_XCCOMMENT </FONT><FONT color=#ff00ff>20</FONT>
<FONT color=#0000ff>// SGML</FONT>
<FONT color=#a020f0>#define wxSTC_H_SGML </FONT><FONT color=#ff00ff>21</FONT>
<FONT color=#a020f0>#define wxSTC_H_SGML_DEFAULT </FONT><FONT color=#ff00ff>21</FONT>
<FONT color=#a020f0>#define wxSTC_H_SGML_COMMAND </FONT><FONT color=#ff00ff>22</FONT>
<FONT color=#a020f0>#define wxSTC_H_SGML_1ST_PARAM </FONT><FONT color=#ff00ff>23</FONT>
<FONT color=#a020f0>#define wxSTC_H_SGML_DOUBLESTRING </FONT><FONT color=#ff00ff>24</FONT>
<FONT color=#a020f0>#define wxSTC_H_SGML_SIMPLESTRING </FONT><FONT color=#ff00ff>25</FONT>
<FONT color=#a020f0>#define wxSTC_H_SGML_ERROR </FONT><FONT color=#ff00ff>26</FONT>
<FONT color=#a020f0>#define wxSTC_H_SGML_SPECIAL </FONT><FONT color=#ff00ff>27</FONT>
<FONT color=#a020f0>#define wxSTC_H_SGML_ENTITY </FONT><FONT color=#ff00ff>28</FONT>
<FONT color=#a020f0>#define wxSTC_H_SGML_COMMENT </FONT><FONT color=#ff00ff>29</FONT>
<FONT color=#a020f0>#define wxSTC_H_SGML_1ST_PARAM_COMMENT </FONT><FONT color=#ff00ff>30</FONT>
<FONT color=#a020f0>#define wxSTC_H_SGML_BLOCK_DEFAULT </FONT><FONT color=#ff00ff>31</FONT>
<FONT color=#0000ff>// Embedded Javascript</FONT>
<FONT color=#a020f0>#define wxSTC_HJ_START </FONT><FONT color=#ff00ff>40</FONT>
@@ -610,6 +629,19 @@
<FONT color=#a020f0>#define wxSTC_EIFFEL_IDENTIFIER </FONT><FONT color=#ff00ff>7</FONT>
<FONT color=#a020f0>#define wxSTC_EIFFEL_STRINGEOL </FONT><FONT color=#ff00ff>8</FONT>
<FONT color=#0000ff>// Lexical states for the SCLEX_NNCRONTAB (nnCron crontab Lexer)</FONT>
<FONT color=#a020f0>#define wxSTC_NNCRONTAB_DEFAULT </FONT><FONT color=#ff00ff>0</FONT>
<FONT color=#a020f0>#define wxSTC_NNCRONTAB_COMMENT </FONT><FONT color=#ff00ff>1</FONT>
<FONT color=#a020f0>#define wxSTC_NNCRONTAB_TASK </FONT><FONT color=#ff00ff>2</FONT>
<FONT color=#a020f0>#define wxSTC_NNCRONTAB_SECTION </FONT><FONT color=#ff00ff>3</FONT>
<FONT color=#a020f0>#define wxSTC_NNCRONTAB_KEYWORD </FONT><FONT color=#ff00ff>4</FONT>
<FONT color=#a020f0>#define wxSTC_NNCRONTAB_MODIFIER </FONT><FONT color=#ff00ff>5</FONT>
<FONT color=#a020f0>#define wxSTC_NNCRONTAB_ASTERISK </FONT><FONT color=#ff00ff>6</FONT>
<FONT color=#a020f0>#define wxSTC_NNCRONTAB_NUMBER </FONT><FONT color=#ff00ff>7</FONT>
<FONT color=#a020f0>#define wxSTC_NNCRONTAB_STRING </FONT><FONT color=#ff00ff>8</FONT>
<FONT color=#a020f0>#define wxSTC_NNCRONTAB_ENVIRONMENT </FONT><FONT color=#ff00ff>9</FONT>
<FONT color=#a020f0>#define wxSTC_NNCRONTAB_IDENTIFIER </FONT><FONT color=#ff00ff>10</FONT>
<FONT color=#0000ff>// END of generated section</FONT>
<FONT color=#0000ff>//----------------------------------------------------------------------</FONT>
<FONT color=#0000ff>// Others</FONT>
@@ -637,6 +669,8 @@
<B><FONT color=#2e8b57>const</FONT></B> wxPoint&amp; pos = wxDefaultPosition,
<B><FONT color=#2e8b57>const</FONT></B> wxSize&amp; size = wxDefaultSize, <B><FONT color=#2e8b57>long</FONT></B> style = <FONT color=#ff00ff>0</FONT>,
<B><FONT color=#2e8b57>const</FONT></B> <B><FONT color=#2e8b57>char</FONT></B>* name = <FONT color=#ff00ff>&quot;styledtext&quot;</FONT>);
%pragma(python) addtomethod = <FONT color=#ff00ff>&quot;__init__:self._setOORInfo(self)&quot;</FONT>
<FONT color=#a020f0>#else</FONT>
wxStyledTextCtrl(wxWindow *parent, wxWindowID id,
<B><FONT color=#2e8b57>const</FONT></B> wxPoint&amp; pos = wxDefaultPosition,
@@ -740,7 +774,11 @@
<FONT color=#0000ff>// Retrieve the text of the line containing the caret.</FONT>
<FONT color=#0000ff>// Returns the index of the caret on the line.</FONT>
wxString GetCurLine(<B><FONT color=#2e8b57>int</FONT></B>* OUTPUT=<FONT color=#ff00ff>NULL</FONT>);
<FONT color=#a020f0> #ifdef SWIG</FONT>
wxString GetCurLine(<B><FONT color=#2e8b57>int</FONT></B>* OUTPUT);
<FONT color=#a020f0>#else</FONT>
wxString GetCurLine(<B><FONT color=#2e8b57>int</FONT></B>* linePos=<FONT color=#ff00ff>NULL</FONT>);
<FONT color=#a020f0>#endif</FONT>
<FONT color=#0000ff>// Retrieve the position of the last correctly styled character.</FONT>
<B><FONT color=#2e8b57>int</FONT></B> GetEndStyled();
@@ -1223,10 +1261,12 @@
<B><FONT color=#2e8b57>int</FONT></B> GetTargetEnd();
<FONT color=#0000ff>// Replace the target text with the argument text.</FONT>
<FONT color=#0000ff>// Text is counted so it can contain nulls.</FONT>
<FONT color=#0000ff>// Returns the length of the replacement text.</FONT>
<B><FONT color=#2e8b57>int</FONT></B> ReplaceTarget(<B><FONT color=#2e8b57>const</FONT></B> wxString&amp; text);
<FONT color=#0000ff>// Replace the target text with the argument text after \d processing.</FONT>
<FONT color=#0000ff>// Text is counted so it can contain nulls.</FONT>
<FONT color=#0000ff>// Looks for \d where d is between 1 and 9 and replaces these with the strings</FONT>
<FONT color=#0000ff>// matched in the last search operation which were surrounded by \( and \).</FONT>
<FONT color=#0000ff>// Returns the length of the replacement text including any change</FONT>
@@ -1234,7 +1274,7 @@
<B><FONT color=#2e8b57>int</FONT></B> ReplaceTargetRE(<B><FONT color=#2e8b57>const</FONT></B> wxString&amp; text);
<FONT color=#0000ff>// Search for a counted string in the target and set the target to the found</FONT>
<FONT color=#0000ff>// range.</FONT>
<FONT color=#0000ff>// range. Text is counted so it can contain nulls.</FONT>
<FONT color=#0000ff>// Returns length of range or -1 for failure in which case target is not moved.</FONT>
<B><FONT color=#2e8b57>int</FONT></B> SearchInTarget(<B><FONT color=#2e8b57>const</FONT></B> wxString&amp; text);
@@ -1423,10 +1463,10 @@
<B><FONT color=#2e8b57>int</FONT></B> GetModEventMask();
<FONT color=#0000ff>// Change internal focus flag</FONT>
<B><FONT color=#2e8b57>void</FONT></B> SetFocus(<B><FONT color=#2e8b57>bool</FONT></B> focus);
<B><FONT color=#2e8b57>void</FONT></B> SetSTCFocus(<B><FONT color=#2e8b57>bool</FONT></B> focus);
<FONT color=#0000ff>// Get internal focus flag</FONT>
<B><FONT color=#2e8b57>bool</FONT></B> GetFocus();
<B><FONT color=#2e8b57>bool</FONT></B> GetSTCFocus();
<FONT color=#0000ff>// Change error status - 0 = OK</FONT>
<B><FONT color=#2e8b57>void</FONT></B> SetStatus(<B><FONT color=#2e8b57>int</FONT></B> statusCode);
@@ -1588,6 +1628,7 @@
<B><FONT color=#2e8b57>void</FONT></B> NotifyChange();
<B><FONT color=#2e8b57>void</FONT></B> NotifyParent(SCNotification* scn);
<B><FONT color=#804040>private</FONT></B>:
DECLARE_EVENT_TABLE()
DECLARE_CLASS(wxStyledTextCtrl)
@@ -1595,6 +1636,7 @@
ScintillaWX* m_swx;
wxStopWatch m_stopWatch;
<B><FONT color=#2e8b57>bool</FONT></B> m_lastKeyDownConsumed;
<B><FONT color=#804040>friend</FONT></B> <B><FONT color=#2e8b57>class</FONT></B> ScintillaWX;
<B><FONT color=#804040>friend</FONT></B> <B><FONT color=#2e8b57>class</FONT></B> Platform;
@@ -1608,23 +1650,26 @@
wxStyledTextEvent(wxEventType commandType=<FONT color=#ff00ff>0</FONT>, <B><FONT color=#2e8b57>int</FONT></B> id=<FONT color=#ff00ff>0</FONT>);
~wxStyledTextEvent() {}
<B><FONT color=#2e8b57>void</FONT></B> SetPosition(<B><FONT color=#2e8b57>int</FONT></B> pos) { m_position = pos; }
<B><FONT color=#2e8b57>void</FONT></B> SetKey(<B><FONT color=#2e8b57>int</FONT></B> k) { m_key = k; }
<B><FONT color=#2e8b57>void</FONT></B> SetModifiers(<B><FONT color=#2e8b57>int</FONT></B> m) { m_modifiers = m; }
<B><FONT color=#2e8b57>void</FONT></B> SetModificationType(<B><FONT color=#2e8b57>int</FONT></B> t) { m_modificationType = t; }
<B><FONT color=#2e8b57>void</FONT></B> SetText(<B><FONT color=#2e8b57>const</FONT></B> <B><FONT color=#2e8b57>char</FONT></B>* t) { m_text = t; }
<B><FONT color=#2e8b57>void</FONT></B> SetLength(<B><FONT color=#2e8b57>int</FONT></B> len) { m_length = len; }
<B><FONT color=#2e8b57>void</FONT></B> SetLinesAdded(<B><FONT color=#2e8b57>int</FONT></B> num) { m_linesAdded = num; }
<B><FONT color=#2e8b57>void</FONT></B> SetLine(<B><FONT color=#2e8b57>int</FONT></B> val) { m_line = val; }
<B><FONT color=#2e8b57>void</FONT></B> SetFoldLevelNow(<B><FONT color=#2e8b57>int</FONT></B> val) { m_foldLevelNow = val; }
<B><FONT color=#2e8b57>void</FONT></B> SetFoldLevelPrev(<B><FONT color=#2e8b57>int</FONT></B> val) { m_foldLevelPrev = val; }
<B><FONT color=#2e8b57>void</FONT></B> SetMargin(<B><FONT color=#2e8b57>int</FONT></B> val) { m_margin = val; }
<B><FONT color=#2e8b57>void</FONT></B> SetMessage(<B><FONT color=#2e8b57>int</FONT></B> val) { m_message = val; }
<B><FONT color=#2e8b57>void</FONT></B> SetWParam(<B><FONT color=#2e8b57>int</FONT></B> val) { m_wParam = val; }
<B><FONT color=#2e8b57>void</FONT></B> SetLParam(<B><FONT color=#2e8b57>int</FONT></B> val) { m_lParam = val; }
<B><FONT color=#2e8b57>void</FONT></B> SetListType(<B><FONT color=#2e8b57>int</FONT></B> val) { m_listType = val; }
<B><FONT color=#2e8b57>void</FONT></B> SetX(<B><FONT color=#2e8b57>int</FONT></B> val) { m_x = val; }
<B><FONT color=#2e8b57>void</FONT></B> SetY(<B><FONT color=#2e8b57>int</FONT></B> val) { m_y = val; }
<B><FONT color=#2e8b57>void</FONT></B> SetPosition(<B><FONT color=#2e8b57>int</FONT></B> pos) { m_position = pos; }
<B><FONT color=#2e8b57>void</FONT></B> SetKey(<B><FONT color=#2e8b57>int</FONT></B> k) { m_key = k; }
<B><FONT color=#2e8b57>void</FONT></B> SetModifiers(<B><FONT color=#2e8b57>int</FONT></B> m) { m_modifiers = m; }
<B><FONT color=#2e8b57>void</FONT></B> SetModificationType(<B><FONT color=#2e8b57>int</FONT></B> t) { m_modificationType = t; }
<B><FONT color=#2e8b57>void</FONT></B> SetText(<B><FONT color=#2e8b57>const</FONT></B> <B><FONT color=#2e8b57>char</FONT></B>* t) { m_text = t; }
<B><FONT color=#2e8b57>void</FONT></B> SetLength(<B><FONT color=#2e8b57>int</FONT></B> len) { m_length = len; }
<B><FONT color=#2e8b57>void</FONT></B> SetLinesAdded(<B><FONT color=#2e8b57>int</FONT></B> num) { m_linesAdded = num; }
<B><FONT color=#2e8b57>void</FONT></B> SetLine(<B><FONT color=#2e8b57>int</FONT></B> val) { m_line = val; }
<B><FONT color=#2e8b57>void</FONT></B> SetFoldLevelNow(<B><FONT color=#2e8b57>int</FONT></B> val) { m_foldLevelNow = val; }
<B><FONT color=#2e8b57>void</FONT></B> SetFoldLevelPrev(<B><FONT color=#2e8b57>int</FONT></B> val) { m_foldLevelPrev = val; }
<B><FONT color=#2e8b57>void</FONT></B> SetMargin(<B><FONT color=#2e8b57>int</FONT></B> val) { m_margin = val; }
<B><FONT color=#2e8b57>void</FONT></B> SetMessage(<B><FONT color=#2e8b57>int</FONT></B> val) { m_message = val; }
<B><FONT color=#2e8b57>void</FONT></B> SetWParam(<B><FONT color=#2e8b57>int</FONT></B> val) { m_wParam = val; }
<B><FONT color=#2e8b57>void</FONT></B> SetLParam(<B><FONT color=#2e8b57>int</FONT></B> val) { m_lParam = val; }
<B><FONT color=#2e8b57>void</FONT></B> SetListType(<B><FONT color=#2e8b57>int</FONT></B> val) { m_listType = val; }
<B><FONT color=#2e8b57>void</FONT></B> SetX(<B><FONT color=#2e8b57>int</FONT></B> val) { m_x = val; }
<B><FONT color=#2e8b57>void</FONT></B> SetY(<B><FONT color=#2e8b57>int</FONT></B> val) { m_y = val; }
<B><FONT color=#2e8b57>void</FONT></B> SetDragText(<B><FONT color=#2e8b57>const</FONT></B> wxString&amp; val) { m_dragText = val; }
<B><FONT color=#2e8b57>void</FONT></B> SetDragAllowMove(<B><FONT color=#2e8b57>bool</FONT></B> val) { m_dragAllowMove = val; }
<B><FONT color=#2e8b57>void</FONT></B> SetDragResult(wxDragResult val) { m_dragResult = val; }
<B><FONT color=#2e8b57>int</FONT></B> GetPosition() <B><FONT color=#2e8b57>const</FONT></B> { <B><FONT color=#804040>return</FONT></B> m_position; }
<B><FONT color=#2e8b57>int</FONT></B> GetKey() <B><FONT color=#2e8b57>const</FONT></B> { <B><FONT color=#804040>return</FONT></B> m_key; }
@@ -1643,6 +1688,9 @@
<B><FONT color=#2e8b57>int</FONT></B> GetListType() <B><FONT color=#2e8b57>const</FONT></B> { <B><FONT color=#804040>return</FONT></B> m_listType; }
<B><FONT color=#2e8b57>int</FONT></B> GetX() <B><FONT color=#2e8b57>const</FONT></B> { <B><FONT color=#804040>return</FONT></B> m_x; }
<B><FONT color=#2e8b57>int</FONT></B> GetY() <B><FONT color=#2e8b57>const</FONT></B> { <B><FONT color=#804040>return</FONT></B> m_y; }
wxString GetDragText() { <B><FONT color=#804040>return</FONT></B> m_dragText; }
<B><FONT color=#2e8b57>bool</FONT></B> GetDragAllowMove() { <B><FONT color=#804040>return</FONT></B> m_dragAllowMove; }
wxDragResult GetDragResult() { <B><FONT color=#804040>return</FONT></B> m_dragResult; }
<B><FONT color=#2e8b57>bool</FONT></B> GetShift() <B><FONT color=#2e8b57>const</FONT></B>;
<B><FONT color=#2e8b57>bool</FONT></B> GetControl() <B><FONT color=#2e8b57>const</FONT></B>;
@@ -1675,6 +1723,11 @@
<B><FONT color=#2e8b57>int</FONT></B> m_listType;
<B><FONT color=#2e8b57>int</FONT></B> m_x;
<B><FONT color=#2e8b57>int</FONT></B> m_y;
wxString m_dragText; <FONT color=#0000ff>// wxEVT_STC_START_DRAG, wxEVT_STC_DO_DROP</FONT>
<B><FONT color=#2e8b57>bool</FONT></B> m_dragAllowMove; <FONT color=#0000ff>// wxEVT_STC_START_DRAG</FONT>
wxDragResult m_dragResult; <FONT color=#0000ff>// wxEVT_STC_DRAG_OVER,wxEVT_STC_DO_DROP</FONT>
<FONT color=#a020f0>#endif</FONT>
};
@@ -1699,6 +1752,9 @@ BEGIN_DECLARE_EVENT_TYPES()
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_URIDROPPED, <FONT color=#ff00ff>1666</FONT>)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DWELLSTART, <FONT color=#ff00ff>1667</FONT>)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DWELLEND, <FONT color=#ff00ff>1668</FONT>)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_START_DRAG, <FONT color=#ff00ff>1669</FONT>)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DRAG_OVER, <FONT color=#ff00ff>1670</FONT>)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DO_DROP, <FONT color=#ff00ff>1671</FONT>)
END_DECLARE_EVENT_TYPES()
<FONT color=#a020f0>#else</FONT>
<B><FONT color=#2e8b57>enum</FONT></B> {
@@ -1721,6 +1777,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,
};
<FONT color=#a020f0>#endif</FONT>
@@ -1748,7 +1807,9 @@ END_DECLARE_EVENT_TYPES()
<FONT color=#a020f0>#define EVT_STC_URIDROPPED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_URIDROPPED, id, -</FONT><FONT color=#ff00ff>1</FONT><FONT color=#a020f0>, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) &amp; fn, (wxObject *) </FONT><FONT color=#ff00ff>NULL</FONT><FONT color=#a020f0> ),</FONT>
<FONT color=#a020f0>#define EVT_STC_DWELLSTART(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLSTART, id, -</FONT><FONT color=#ff00ff>1</FONT><FONT color=#a020f0>, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) &amp; fn, (wxObject *) </FONT><FONT color=#ff00ff>NULL</FONT><FONT color=#a020f0> ),</FONT>
<FONT color=#a020f0>#define EVT_STC_DWELLEND(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLEND, id, -</FONT><FONT color=#ff00ff>1</FONT><FONT color=#a020f0>, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) &amp; fn, (wxObject *) </FONT><FONT color=#ff00ff>NULL</FONT><FONT color=#a020f0> ),</FONT>
<FONT color=#a020f0>#define EVT_STC_START_DRAG(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_START_DRAG, id, -</FONT><FONT color=#ff00ff>1</FONT><FONT color=#a020f0>, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) &amp; fn, (wxObject *) </FONT><FONT color=#ff00ff>NULL</FONT><FONT color=#a020f0> ),</FONT>
<FONT color=#a020f0>#define EVT_STC_DRAG_OVER(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DRAG_OVER, id, -</FONT><FONT color=#ff00ff>1</FONT><FONT color=#a020f0>, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) &amp; fn, (wxObject *) </FONT><FONT color=#ff00ff>NULL</FONT><FONT color=#a020f0> ),</FONT>
<FONT color=#a020f0>#define EVT_STC_DO_DROP(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DO_DROP, id, -</FONT><FONT color=#ff00ff>1</FONT><FONT color=#a020f0>, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) &amp; fn, (wxObject *) </FONT><FONT color=#ff00ff>NULL</FONT><FONT color=#a020f0> ),</FONT>
<FONT color=#a020f0>#endif</FONT>

View File

@@ -4,6 +4,9 @@ from wxPython.stc import *
#----------------------------------------------------------------------
debug = 1
demoText = """\
This editor is provided by a class named wxStyledTextCtrl. As
@@ -52,9 +55,48 @@ class MySTC(wxStyledTextCtrl):
wxStyledTextCtrl.__init__(self, parent, ID)
self.log = log
EVT_STC_DO_DROP(self, ID, self.OnDoDrop)
EVT_STC_DRAG_OVER(self, ID, self.OnDragOver)
EVT_STC_START_DRAG(self, ID, self.OnStartDrag)
EVT_STC_MODIFIED(self, ID, self.OnModified)
def OnStartDrag(self, evt):
self.log.write("OnStartDrag: %d, %s\n"
% (evt.GetDragAllowMove(), evt.GetDragText()))
if debug and evt.GetPosition() < 250:
evt.SetDragAllowMove(false) # you can prevent moving of text (only copy)
evt.SetDragText("DRAGGED TEXT") # you can change what is dragged
#evt.SetDragText("") # or prevent the drag with empty text
def OnDragOver(self, evt):
self.log.write("OnDragOver: x,y=(%d, %d) pos: %d DragResult: %d\n"
% (evt.GetX(), evt.GetY(), evt.GetPosition(), evt.GetDragResult()))
if debug and evt.GetPosition() < 250:
evt.SetDragResult(wxDragNone) # prevent dropping at the begining of the buffer
def OnDoDrop(self, evt):
self.log.write("OnDoDrop: x,y=(%d, %d) pos: %d DragResult: %d\n"
"\ttext: %s\n"
% (evt.GetX(), evt.GetY(), evt.GetPosition(), evt.GetDragResult(),
evt.GetDragText()))
if debug and evt.GetPosition() < 500:
evt.SetDragText("DROPPED TEXT") # Can change text if needed
##evt.SetDragResult(wxDragNone) # Can also change the drag operation, but it
# is probably better to do it in OnDragOver so
# there is visual feedback
##evt.SetPosition(25) # Can also change position, but I'm not sure why
# you would want to...
def OnModified(self, evt):
self.log.write("""OnModified
Mod type: %s
@@ -67,6 +109,7 @@ class MySTC(wxStyledTextCtrl):
evt.GetLength(),
evt.GetText() ))
def transModType(self, modType):
st = ""
table = [(wxSTC_MOD_INSERTTEXT, "InsertText"),
@@ -93,6 +136,7 @@ class MySTC(wxStyledTextCtrl):
#----------------------------------------------------------------------
_USE_PANEL = 1
@@ -168,7 +212,7 @@ def runTest(frame, nb, log):
ed.SetStyling(10, wxSTC_INDIC2_MASK | wxSTC_INDIC1_MASK)
# some test stuff...
if 1:
if debug:
print "GetTextLength(): ", ed.GetTextLength(), len(ed.GetText())
print "GetText(): ", repr(ed.GetText())
print

View File

@@ -116,7 +116,7 @@ class PythonSTC(wxStyledTextCtrl):
self.SetCaretForeground("BLUE")
EVT_KEY_UP(self, self.OnKeyPressed)
EVT_KEY_DOWN(self, self.OnKeyPressed)
def OnKeyPressed(self, event):