diff --git a/contrib/include/wx/stc/stc.h b/contrib/include/wx/stc/stc.h index 08bdbbde15..04b4ec00b0 100644 --- a/contrib/include/wx/stc/stc.h +++ b/contrib/include/wx/stc/stc.h @@ -466,6 +466,7 @@ private: void OnMouseLeftUp(wxMouseEvent& evt); void OnMouseRightUp(wxMouseEvent& evt); void OnChar(wxKeyEvent& evt); + void OnKeyDown(wxKeyEvent& evt); void OnLoseFocus(wxFocusEvent& evt); void OnGainFocus(wxFocusEvent& evt); void OnSysColourChanged(wxSysColourChangedEvent& evt); @@ -481,6 +482,7 @@ private: private: DECLARE_EVENT_TABLE() + DECLARE_CLASS(wxStyledTextCtrl) ScintillaWX* m_swx; wxStopWatch m_stopWatch; @@ -497,7 +499,7 @@ private: class wxStyledTextEvent : public wxCommandEvent { public: - wxStyledTextEvent(wxEventType commandType, int id); + wxStyledTextEvent(wxEventType commandType=0, int id=0); ~wxStyledTextEvent() {} void SetPosition(int pos) { m_position = pos; } @@ -536,7 +538,10 @@ public: void CopyObject(wxObject& obj) const; +#ifndef SWIG private: + DECLARE_DYNAMIC_CLASS(wxStyledTextEvent) + int m_position; int m_key; int m_modifiers; @@ -554,7 +559,7 @@ private: int m_message; // wxEVT_STC_MACRORECORD int m_wParam; int m_lParam; - +#endif }; @@ -588,7 +593,9 @@ typedef void (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&); #define EVT_STC_DOUBLECLICK(id, fn) { wxEVT_STC_DOUBLECLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL }, #define EVT_STC_MODIFIED(id, fn) { wxEVT_STC_MODIFIED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL }, #define EVT_STC_CMDKEY(id, fn) { wxEVT_STC_CMDKEY, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL }, -#define EVT_STC_UNKNOWNCMDKEY(id, fn) { wxEVT_STC_UNKNOWNCMDKEY, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL }, +#define EVT_STC_MACRORECORD(id, fn) { wxEVT_STC_MACRORECORD, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL }, +#define EVT_STC_MARGINCLICK(id, fn) { wxEVT_STC_MARGINCLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL }, +#define EVT_STC_NEEDSHOWN(id, fn) { wxEVT_STC_NEEDSHOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL }, #endif diff --git a/contrib/src/stc/stc.cpp b/contrib/src/stc/stc.cpp index b426c1339e..cb5172f111 100644 --- a/contrib/src/stc/stc.cpp +++ b/contrib/src/stc/stc.cpp @@ -75,6 +75,7 @@ BEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl) EVT_LEFT_UP (wxStyledTextCtrl::OnMouseLeftUp) EVT_RIGHT_UP (wxStyledTextCtrl::OnMouseRightUp) EVT_CHAR (wxStyledTextCtrl::OnChar) + EVT_KEY_DOWN (wxStyledTextCtrl::OnKeyDown) EVT_KILL_FOCUS (wxStyledTextCtrl::OnLoseFocus) EVT_SET_FOCUS (wxStyledTextCtrl::OnGainFocus) EVT_SYS_COLOUR_CHANGED (wxStyledTextCtrl::OnSysColourChanged) @@ -82,6 +83,10 @@ BEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl) EVT_MENU_RANGE (-1, -1, wxStyledTextCtrl::OnMenu) END_EVENT_TABLE() + +IMPLEMENT_CLASS(wxStyledTextCtrl, wxControl) +IMPLEMENT_DYNAMIC_CLASS(wxStyledTextEvent, wxCommandEvent) + //---------------------------------------------------------------------- // Constructor and Destructor @@ -1325,20 +1330,23 @@ void wxStyledTextCtrl::OnMouseRightUp(wxMouseEvent& evt) { } void wxStyledTextCtrl::OnChar(wxKeyEvent& evt) { - int processed = 0; long key = evt.KeyCode(); if ((key > WXK_ESCAPE) && (key != WXK_DELETE) && (key < 255) && !evt.ControlDown() && !evt.AltDown()) { m_swx->DoAddChar(key); - processed = true; } else { - key = toupper(key); - processed = m_swx->DoKeyDown(key, evt.ShiftDown(), - evt.ControlDown(), evt.AltDown()); + evt.Skip(); } +} + +void wxStyledTextCtrl::OnKeyDown(wxKeyEvent& evt) { + long key = evt.KeyCode(); + key = toupper(key); + int processed = m_swx->DoKeyDown(key, evt.ShiftDown(), + evt.ControlDown(), evt.AltDown()); if (! processed) evt.Skip(); } @@ -1369,6 +1377,7 @@ void wxStyledTextCtrl::OnMenu(wxCommandEvent& evt) { //---------------------------------------------------------------------- // Turn notifications from Scintilla into events + void wxStyledTextCtrl::NotifyChange() { wxStyledTextEvent evt(wxEVT_STC_CHANGE, GetId()); GetEventHandler()->ProcessEvent(evt); diff --git a/include/wx/stc/stc.h b/include/wx/stc/stc.h index 08bdbbde15..04b4ec00b0 100644 --- a/include/wx/stc/stc.h +++ b/include/wx/stc/stc.h @@ -466,6 +466,7 @@ private: void OnMouseLeftUp(wxMouseEvent& evt); void OnMouseRightUp(wxMouseEvent& evt); void OnChar(wxKeyEvent& evt); + void OnKeyDown(wxKeyEvent& evt); void OnLoseFocus(wxFocusEvent& evt); void OnGainFocus(wxFocusEvent& evt); void OnSysColourChanged(wxSysColourChangedEvent& evt); @@ -481,6 +482,7 @@ private: private: DECLARE_EVENT_TABLE() + DECLARE_CLASS(wxStyledTextCtrl) ScintillaWX* m_swx; wxStopWatch m_stopWatch; @@ -497,7 +499,7 @@ private: class wxStyledTextEvent : public wxCommandEvent { public: - wxStyledTextEvent(wxEventType commandType, int id); + wxStyledTextEvent(wxEventType commandType=0, int id=0); ~wxStyledTextEvent() {} void SetPosition(int pos) { m_position = pos; } @@ -536,7 +538,10 @@ public: void CopyObject(wxObject& obj) const; +#ifndef SWIG private: + DECLARE_DYNAMIC_CLASS(wxStyledTextEvent) + int m_position; int m_key; int m_modifiers; @@ -554,7 +559,7 @@ private: int m_message; // wxEVT_STC_MACRORECORD int m_wParam; int m_lParam; - +#endif }; @@ -588,7 +593,9 @@ typedef void (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&); #define EVT_STC_DOUBLECLICK(id, fn) { wxEVT_STC_DOUBLECLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL }, #define EVT_STC_MODIFIED(id, fn) { wxEVT_STC_MODIFIED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL }, #define EVT_STC_CMDKEY(id, fn) { wxEVT_STC_CMDKEY, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL }, -#define EVT_STC_UNKNOWNCMDKEY(id, fn) { wxEVT_STC_UNKNOWNCMDKEY, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL }, +#define EVT_STC_MACRORECORD(id, fn) { wxEVT_STC_MACRORECORD, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL }, +#define EVT_STC_MARGINCLICK(id, fn) { wxEVT_STC_MARGINCLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL }, +#define EVT_STC_NEEDSHOWN(id, fn) { wxEVT_STC_NEEDSHOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL }, #endif diff --git a/src/stc/stc.cpp b/src/stc/stc.cpp index b426c1339e..cb5172f111 100644 --- a/src/stc/stc.cpp +++ b/src/stc/stc.cpp @@ -75,6 +75,7 @@ BEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl) EVT_LEFT_UP (wxStyledTextCtrl::OnMouseLeftUp) EVT_RIGHT_UP (wxStyledTextCtrl::OnMouseRightUp) EVT_CHAR (wxStyledTextCtrl::OnChar) + EVT_KEY_DOWN (wxStyledTextCtrl::OnKeyDown) EVT_KILL_FOCUS (wxStyledTextCtrl::OnLoseFocus) EVT_SET_FOCUS (wxStyledTextCtrl::OnGainFocus) EVT_SYS_COLOUR_CHANGED (wxStyledTextCtrl::OnSysColourChanged) @@ -82,6 +83,10 @@ BEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl) EVT_MENU_RANGE (-1, -1, wxStyledTextCtrl::OnMenu) END_EVENT_TABLE() + +IMPLEMENT_CLASS(wxStyledTextCtrl, wxControl) +IMPLEMENT_DYNAMIC_CLASS(wxStyledTextEvent, wxCommandEvent) + //---------------------------------------------------------------------- // Constructor and Destructor @@ -1325,20 +1330,23 @@ void wxStyledTextCtrl::OnMouseRightUp(wxMouseEvent& evt) { } void wxStyledTextCtrl::OnChar(wxKeyEvent& evt) { - int processed = 0; long key = evt.KeyCode(); if ((key > WXK_ESCAPE) && (key != WXK_DELETE) && (key < 255) && !evt.ControlDown() && !evt.AltDown()) { m_swx->DoAddChar(key); - processed = true; } else { - key = toupper(key); - processed = m_swx->DoKeyDown(key, evt.ShiftDown(), - evt.ControlDown(), evt.AltDown()); + evt.Skip(); } +} + +void wxStyledTextCtrl::OnKeyDown(wxKeyEvent& evt) { + long key = evt.KeyCode(); + key = toupper(key); + int processed = m_swx->DoKeyDown(key, evt.ShiftDown(), + evt.ControlDown(), evt.AltDown()); if (! processed) evt.Skip(); } @@ -1369,6 +1377,7 @@ void wxStyledTextCtrl::OnMenu(wxCommandEvent& evt) { //---------------------------------------------------------------------- // Turn notifications from Scintilla into events + void wxStyledTextCtrl::NotifyChange() { wxStyledTextEvent evt(wxEVT_STC_CHANGE, GetId()); GetEventHandler()->ProcessEvent(evt);