if (len > 0)
{
#if wxUSE_UNICODE
- wxMemoryBuffer buffer(len);
+ wxMemoryBuffer buffer(len+1);
success = (file.Read(buffer.GetData(), len) == len);
- contents = wxString(buffer, *wxConvCurrent);
+ if (success) {
+ ((char*)buffer.GetData())[len] = 0;
+ contents = wxString(buffer, *wxConvCurrent, len);
+ }
#else
wxString buffer;
success = (file.Read(wxStringBuffer(buffer, len), len) == len);
#endif
+void wxStyledTextCtrl::SetUseAntiAliasing(bool useAA) {
+ m_swx->SetUseAntiAliasing(useAA);
+}
+
+bool wxStyledTextCtrl::GetUseAntiAliasing() {
+ return m_swx->GetUseAntiAliasing();
+}
+
//----------------------------------------------------------------------
// Event handlers
void wxStyledTextCtrl::OnContextMenu(wxContextMenuEvent& evt) {
wxPoint pt = evt.GetPosition();
ScreenToClient(&pt.x, &pt.y);
+ /*
+ Show context menu at event point if it's within the window,
+ or at caret location if not
+ */
+ wxHitTest ht = this->HitTest(pt);
+ if (ht != wxHT_WINDOW_INSIDE) {
+ pt = this->PointFromPosition(this->GetCurrentPos());
+ }
m_swx->DoContextMenu(Point(pt.x, pt.y));
}
// printf("OnChar key:%%d consumed:%%d ctrl:%%d alt:%%d skip:%%d\n",
// key, m_lastKeyDownConsumed, ctrl, alt, skip);
- if ( (key <= WXK_START || key > WXK_NUMPAD_DIVIDE) &&
+ if ( (key <= WXK_START || key > WXK_COMMAND) &&
!m_lastKeyDownConsumed && !skip) {
m_swx->DoAddChar(key);
return;
}
-void wxStyledTextCtrl::OnLoseFocus(wxFocusEvent& WXUNUSED(evt)) {
+void wxStyledTextCtrl::OnLoseFocus(wxFocusEvent& evt) {
m_swx->DoLoseFocus();
+ evt.Skip();
}
-void wxStyledTextCtrl::OnGainFocus(wxFocusEvent& WXUNUSED(evt)) {
+void wxStyledTextCtrl::OnGainFocus(wxFocusEvent& evt) {
m_swx->DoGainFocus();
+ evt.Skip();
}
}
+void wxStyledTextCtrl::OnIdle(wxIdleEvent& evt) {
+ m_swx->DoOnIdle(evt);
+}
+
+
//----------------------------------------------------------------------
// Turn notifications from Scintilla into events