X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4a65f2c80d04599738e4f3a527c4953ade08d48b..a7c26d107d0c6f191e55d30613f4816e9c2f9386:/src/stc/stc.cpp.in diff --git a/src/stc/stc.cpp.in b/src/stc/stc.cpp.in index fa23c2587b..a54118ff6a 100644 --- a/src/stc/stc.cpp.in +++ b/src/stc/stc.cpp.in @@ -136,11 +136,27 @@ wxStyledTextCtrl::wxStyledTextCtrl(wxWindow *parent, const wxPoint& pos, const wxSize& size, long style, - const wxString& name) : - wxControl(parent, id, pos, size, - style | wxVSCROLL | wxHSCROLL | wxWANTS_CHARS | wxCLIP_CHILDREN, - wxDefaultValidator, name) + const wxString& name) { + m_swx = NULL; + Create(parent, id, pos, size, style, name); +} + + +void wxStyledTextCtrl::Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name) +{ +#ifdef __WXMAC__ + style |= wxVSCROLL | wxHSCROLL; +#endif + wxControl::Create(parent, id, pos, size, + style | wxWANTS_CHARS | wxCLIP_CHILDREN, + wxDefaultValidator, name); + #ifdef LINK_LEXERS Scintilla_LinkLexers(); #endif @@ -336,20 +352,16 @@ bool wxStyledTextCtrl::LoadFile(const wxString& filename) if (file.IsOpened()) { wxString contents; -#if wxUSE_UNICODE - wxMemoryBuffer buffer; -#else - wxString buffer; -#endif off_t len = file.Length(); if (len > 0) { - void *bufptr = buffer.GetWriteBuf(len); - success = (file.Read(bufptr, len) == len); - buffer.UngetWriteBuf(len); -#if #wxUSE_UNICODE +#if wxUSE_UNICODE + wxMemoryBuffer buffer(len); + success = (file.Read(buffer.GetData(), len) == len); contents = wxString(buffer, *wxConvCurrent); #else + wxString buffer; + success = (file.Read(wxStringBuffer(buffer, len), len) == len); contents = buffer; #endif } @@ -368,6 +380,7 @@ bool wxStyledTextCtrl::LoadFile(const wxString& filename) } +#if wxUSE_DRAG_AND_DROP wxDragResult wxStyledTextCtrl::DoDragOver(wxCoord x, wxCoord y, wxDragResult def) { return m_swx->DoDragOver(x, y, def); } @@ -376,7 +389,16 @@ wxDragResult wxStyledTextCtrl::DoDragOver(wxCoord x, wxCoord y, wxDragResult def bool wxStyledTextCtrl::DoDropText(long x, long y, const wxString& data) { return m_swx->DoDropText(x, y, data); } +#endif + +void wxStyledTextCtrl::SetUseAntiAliasing(bool useAA) { + m_swx->SetUseAntiAliasing(useAA); +} + +bool wxStyledTextCtrl::GetUseAntiAliasing() { + return m_swx->GetUseAntiAliasing(); +} //---------------------------------------------------------------------- // Event handlers @@ -404,8 +426,10 @@ void wxStyledTextCtrl::OnScroll(wxScrollEvent& evt) { } void wxStyledTextCtrl::OnSize(wxSizeEvent& WXUNUSED(evt)) { - wxSize sz = GetClientSize(); - m_swx->DoSize(sz.x, sz.y); + if (m_swx) { + wxSize sz = GetClientSize(); + m_swx->DoSize(sz.x, sz.y); + } } void wxStyledTextCtrl::OnMouseLeftDown(wxMouseEvent& evt) { @@ -494,13 +518,15 @@ void wxStyledTextCtrl::OnKeyDown(wxKeyEvent& evt) { } -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(); } @@ -525,6 +551,11 @@ void wxStyledTextCtrl::OnListBox(wxCommandEvent& WXUNUSED(evt)) { } +void wxStyledTextCtrl::OnIdle(wxIdleEvent& evt) { + m_swx->DoOnIdle(evt); +} + + //---------------------------------------------------------------------- // Turn notifications from Scintilla into events