More STC fixes and tweaks. (Try Ctrl-KP_plus and Ctrl-KP_minus for a
really COOL feature that's no longer broken on MSW) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7223 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -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
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user