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)
+{
+ wxControl::Create(parent, id, pos, size,
+ style | wxWANTS_CHARS | wxCLIP_CHILDREN,
+ wxDefaultValidator, name);
+
#ifdef LINK_LEXERS
Scintilla_LinkLexers();
#endif
if (!file.IsOpened())
return FALSE;
- bool success = file.Write(GetText());
+ bool success = file.Write(GetText(), *wxConvCurrent);
if (success)
SetSavePoint();
{
wxString contents;
off_t len = file.Length();
-
if (len > 0)
{
- wxChar *buf = contents.GetWriteBuf(len);
- success = (file.Read(buf, len) == len);
- contents.UngetWriteBuf();
+#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
}
else
success = true; // empty file is ok
}
+#if wxUSE_DRAG_AND_DROP
+wxDragResult wxStyledTextCtrl::DoDragOver(wxCoord x, wxCoord y, wxDragResult def) {
+ return m_swx->DoDragOver(x, y, def);
+}
+
+
+bool wxStyledTextCtrl::DoDropText(long x, long y, const wxString& data) {
+ return m_swx->DoDropText(x, y, data);
+}
+#endif
+
+
//----------------------------------------------------------------------
// Event handlers
-void wxStyledTextCtrl::OnPaint(wxPaintEvent& evt) {
+void wxStyledTextCtrl::OnPaint(wxPaintEvent& WXUNUSED(evt)) {
wxPaintDC dc(this);
m_swx->DoPaint(&dc, GetUpdateRegion().GetBox());
}
}
}
-void wxStyledTextCtrl::OnSize(wxSizeEvent& evt) {
- wxSize sz = GetClientSize();
- m_swx->DoSize(sz.x, sz.y);
+void wxStyledTextCtrl::OnSize(wxSizeEvent& WXUNUSED(evt)) {
+ if (m_swx) {
+ wxSize sz = GetClientSize();
+ m_swx->DoSize(sz.x, sz.y);
+ }
}
void wxStyledTextCtrl::OnMouseLeftDown(wxMouseEvent& evt) {
int key = evt.GetKeyCode();
bool shift = evt.ShiftDown(),
ctrl = evt.ControlDown(),
- alt = evt.AltDown();
+ alt = evt.AltDown(),
+ meta = evt.MetaDown();
- int processed = m_swx->DoKeyDown(key, shift, ctrl, alt, &m_lastKeyDownConsumed);
+ int processed = m_swx->DoKeyDown(key, shift, ctrl, alt, meta, &m_lastKeyDownConsumed);
// printf("KeyDn key:%%d shift:%%d ctrl:%%d alt:%%d processed:%%d consumed:%%d\n",
// key, shift, ctrl, alt, processed, m_lastKeyDownConsumed);
}
-void wxStyledTextCtrl::OnLoseFocus(wxFocusEvent& evt) {
+void wxStyledTextCtrl::OnLoseFocus(wxFocusEvent& WXUNUSED(evt)) {
m_swx->DoLoseFocus();
}
-void wxStyledTextCtrl::OnGainFocus(wxFocusEvent& evt) {
+void wxStyledTextCtrl::OnGainFocus(wxFocusEvent& WXUNUSED(evt)) {
m_swx->DoGainFocus();
}
-void wxStyledTextCtrl::OnSysColourChanged(wxSysColourChangedEvent& evt) {
+void wxStyledTextCtrl::OnSysColourChanged(wxSysColourChangedEvent& WXUNUSED(evt)) {
m_swx->DoSysColourChange();
}
-void wxStyledTextCtrl::OnEraseBackground(wxEraseEvent& evt) {
+void wxStyledTextCtrl::OnEraseBackground(wxEraseEvent& WXUNUSED(evt)) {
// do nothing to help avoid flashing
}
}
-void wxStyledTextCtrl::OnListBox(wxCommandEvent& evt) {
+void wxStyledTextCtrl::OnListBox(wxCommandEvent& WXUNUSED(evt)) {
m_swx->DoOnListBox();
}