long style,
const wxString& name) :
wxControl(parent, id, pos, size,
- style | wxVSCROLL | wxHSCROLL | wxWANTS_CHARS,
+ style | wxVSCROLL | wxHSCROLL | wxWANTS_CHARS | wxCLIP_CHILDREN,
wxDefaultValidator, name)
{
m_swx = new ScintillaWX(this);
}
+#ifdef MAKELONG
+#undef MAKELONG
+#endif
+
#define MAKELONG(a, b) ((a) | ((b) << 16))
}
+// Scroll enough to make the given line visible
+void wxStyledTextCtrl::ScrollToLine(int line) {
+ m_swx->DoScrollToLine(line);
+}
+
+
+// Scroll enough to make the given column visible
+void wxStyledTextCtrl::ScrollToColumn(int column) {
+ m_swx->DoScrollToColumn(column);
+}
+
//----------------------------------------------------------------------
// Event handlers
m_swx->DoContextMenu(Point(pt.x, pt.y));
}
+
void wxStyledTextCtrl::OnChar(wxKeyEvent& evt) {
long key = evt.KeyCode();
- if ((key > WXK_ESCAPE) &&
- (key != WXK_DELETE) && (key < 255) &&
- !evt.ControlDown() && !evt.AltDown()) {
-
- m_swx->DoAddChar(key);
- }
- else {
- evt.Skip();
+ switch (key) {
+ // Special handling for charcters that must be typed with AltGr down on
+ // foreign keyboards. (Comes to us as Ctrl+Alt, and so would get
+ // filtered out by the default case below.)
+ //
+ // There should be a better way to do this...
+ //
+ case '\\':
+ case '|':
+ case '@':
+ case '#':
+ case '¬':
+ case '[':
+ case ']':
+ case '{':
+ case '}':
+ case '?':
+ m_swx->DoAddChar(key);
+ break;
+
+ default:
+ if ((key > WXK_ESCAPE) && (key != WXK_DELETE) && (key < 255) &&
+ !evt.ControlDown() && !evt.AltDown()) {
+
+ m_swx->DoAddChar(key);
+ }
+ else {
+ evt.Skip();
+ }
}
}
evt.Skip();
}
+
void wxStyledTextCtrl::OnLoseFocus(wxFocusEvent& evt) {
m_swx->DoLoseFocus();
}