// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
+#include <ctype.h>
+
#include "ScintillaWX.h"
#include "wx/stc/stc.h"
}
+class wxSTCCallTip : public wxWindow {
+public:
+ wxSTCCallTip(wxWindow* parent, int ID, CallTip* ct)
+ : wxWindow(parent, ID)
+ {
+ m_ct = ct;
+ }
+
+ void OnPaint(wxPaintEvent& evt) {
+ wxPaintDC dc(this);
+ Surface surfaceWindow;
+ surfaceWindow.Init(&dc);
+ m_ct->PaintCT(&surfaceWindow);
+ surfaceWindow.Release();
+ }
+
+ CallTip* m_ct;
+ DECLARE_EVENT_TABLE()
+};
+
+BEGIN_EVENT_TABLE(wxSTCCallTip, wxWindow)
+ EVT_PAINT(wxSTCCallTip::OnPaint)
+END_EVENT_TABLE()
//----------------------------------------------------------------------
// Constructor/Destructor
void ScintillaWX::Initialise() {
//ScintillaBase::Initialise();
- dropTarget.SetScintilla(this);
- stc->SetDropTarget(&dropTarget);
+ dropTarget = new wxSTCDropTarget;
+ dropTarget->SetScintilla(this);
+ stc->SetDropTarget(dropTarget);
}
void ScintillaWX::StartDrag() {
- wxDropSource source;
+ wxDropSource source(wMain.GetID());
wxTextDataObject data(dragChars);
wxDragResult result;
void ScintillaWX::SetMouseCapture(bool on) {
- if (on)
+ if (on && !capturedMouse)
wMain.GetID()->CaptureMouse();
- else
+ else if (!on && capturedMouse)
wMain.GetID()->ReleaseMouse();
capturedMouse = on;
}
void ScintillaWX::Copy() {
if (currentPos != anchor) {
char* text = CopySelectionRange();
- textDO.SetText(text);
wxTheClipboard->Open();
- wxTheClipboard->SetData(&textDO);
+ wxTheClipboard->SetData(new wxTextDataObject(text));
wxTheClipboard->Close();
}
}
}
void ScintillaWX::CreateCallTipWindow(PRectangle) {
- ct.wCallTip = new wxWindow(wDraw.GetID(), -1);
+ ct.wCallTip = new wxSTCCallTip(wDraw.GetID(), -1, &ct);
ct.wDraw = ct.wCallTip;
}
void ScintillaWX::DoAddChar(char ch) {
+ //bool acActiveBeforeCharAdded = ac.Active();
AddChar(ch);
+ //if (acActiveBeforeCharAdded)
+ // AutoCompleteChanged(ch);
}
int ScintillaWX::DoKeyDown(int key, bool shift, bool ctrl, bool alt) {
ContextMenu(pt);
}
+void ScintillaWX::DoOnListBox() {
+ AutoCompleteCompleted();
+}
//----------------------------------------------------------------------
// Redraw all of text area. This paint will not be abandoned.
void ScintillaWX::FullPaint() {
paintState = painting;
- rcPaint = GetTextRectangle();
- wxClientDC dc(wMain.GetID());
- Surface surfaceWindow;
- surfaceWindow.Init(&dc);
- Paint(&surfaceWindow, rcPaint);
- surfaceWindow.Release();
+// rcPaint = GetTextRectangle();
+// wxClientDC dc(wMain.GetID());
+// Surface surfaceWindow;
+// surfaceWindow.Init(&dc);
+// Paint(&surfaceWindow, rcPaint);
+// surfaceWindow.Release();
+ wMain.GetID()->Refresh(FALSE);
paintState = notPainting;
}