26 #include "wx/scrolbar.h"
31#include "wx/textbuf.h"
32#include "wx/dataobj.h"
33#include "wx/clipbrd.h"
37#if !wxUSE_STD_CONTAINERS && !wxUSE_STD_IOSTREAM && !wxUSE_STD_STRING
38 #include "wx/beforestd.h"
40 #include "wx/afterstd.h"
43#include "ScintillaWX.h"
44#include "ExternalLexer.h"
45#include "wx/stc/stc.h"
46#include "wx/stc/private.h"
51 #include "wx/msw/private.h"
57class wxSTCTimer :
public wxTimer {
59 wxSTCTimer(ScintillaWX* swx) {
72#if wxUSE_DRAG_AND_DROP
73bool wxSTCDropTarget::OnDropText(wxCoord x, wxCoord y,
const wxString& data) {
74 return m_swx->DoDropText(x, y, data);
77wxDragResult wxSTCDropTarget::OnEnter(wxCoord x, wxCoord y, wxDragResult def) {
78 return m_swx->DoDragEnter(x, y, def);
81wxDragResult wxSTCDropTarget::OnDragOver(wxCoord x, wxCoord y, wxDragResult def) {
82 return m_swx->DoDragOver(x, y, def);
85void wxSTCDropTarget::OnLeave() {
92#include "wx/popupwin.h"
93#define wxSTCCallTipBase wxPopupWindow
95#define wxSTCCallTipBase wxFrame
98#include "wx/dcbuffer.h"
100class wxSTCCallTip :
public wxSTCCallTipBase {
102 wxSTCCallTip(wxWindow* parent, CallTip* ct, ScintillaWX* swx) :
104 wxSTCCallTipBase(parent, wxBORDER_NONE
108 | wxFRAME_TOOL_WINDOW
112 wxSTCCallTipBase(parent, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize,
114 | wxFRAME_FLOAT_ON_PARENT
121 m_ct(ct), m_swx(swx), m_cx(wxDefaultCoord), m_cy(wxDefaultCoord)
123 SetBackgroundStyle(wxBG_STYLE_CUSTOM);
127#if wxUSE_POPUPWIN && defined(__WXGTK__)
128 wxRect rect = GetRect();
131 GetParent()->Refresh(
false, &rect);
135 bool AcceptsFocus()
const {
return false; }
137 void OnPaint(wxPaintEvent& WXUNUSED(evt))
139 wxAutoBufferedPaintDC dc(
this);
140 Surface* surfaceWindow = Surface::Allocate(0);
141 surfaceWindow->Init(&dc, m_ct->wDraw.GetID());
142 m_ct->PaintCT(surfaceWindow);
143 surfaceWindow->Release();
144 delete surfaceWindow;
147 void OnFocus(wxFocusEvent& event)
149 GetParent()->SetFocus();
153 void OnLeftDown(wxMouseEvent& event)
155 wxPoint pt =
event.GetPosition();
158 m_swx->CallTipClick();
161 virtual void DoSetSize(
int x,
int y,
162 int width,
int height,
163 int sizeFlags = wxSIZE_AUTO)
166 if (x != wxDefaultCoord) {
168 GetParent()->ClientToScreen(&x, NULL);
170 if (y != wxDefaultCoord) {
172 GetParent()->ClientToScreen(NULL, &y);
174 wxSTCCallTipBase::DoSetSize(x, y, width, height, sizeFlags);
179 virtual bool Show(
bool show =
true )
183 bool rv = wxSTCCallTipBase::Show(show);
186 wxTopLevelWindow *frame = wxDynamicCast(
187 wxGetTopLevelParent(GetParent()), wxTopLevelWindow);
195 wxPoint GetMyPosition()
197 return wxPoint(m_cx, m_cy);
204 DECLARE_EVENT_TABLE()
207BEGIN_EVENT_TABLE(wxSTCCallTip, wxSTCCallTipBase)
208 EVT_PAINT(wxSTCCallTip::OnPaint)
209 EVT_SET_FOCUS(wxSTCCallTip::OnFocus)
210 EVT_LEFT_DOWN(wxSTCCallTip::OnLeftDown)
217static wxTextFileType wxConvertEOLMode(
int scintillaMode)
221 switch (scintillaMode) {
223 type = wxTextFileType_Dos;
227 type = wxTextFileType_Mac;
231 type = wxTextFileType_Unix;
235 type = wxTextBuffer::typeDefault;
247ScintillaWX::ScintillaWX(wxStyledTextCtrl* win) {
248 capturedMouse =
false;
263ScintillaWX::~ScintillaWX() {
271void ScintillaWX::Initialise() {
273#if wxUSE_DRAG_AND_DROP
274 dropTarget =
new wxSTCDropTarget;
275 dropTarget->SetScintilla(
this);
276 stc->SetDropTarget(dropTarget);
278 vs.extraFontFlag =
true;
282void ScintillaWX::Finalise() {
283 ScintillaBase::Finalise();
286 DestroySystemCaret();
290void ScintillaWX::StartDrag() {
291#if wxUSE_DRAG_AND_DROP
292 wxString dragText = stc2wx(drag.s, drag.len);
295 wxStyledTextEvent evt(wxEVT_STC_START_DRAG, stc->GetId());
296 evt.SetEventObject(stc);
297 evt.SetDragText(dragText);
298 evt.SetDragFlags(wxDrag_DefaultMove);
299 evt.SetPosition(wxMin(stc->GetSelectionStart(),
300 stc->GetSelectionEnd()));
301 stc->GetEventHandler()->ProcessEvent(evt);
302 dragText = evt.GetDragText();
304 if ( !dragText.empty() ) {
305 wxDropSource source(stc);
306 wxTextDataObject data(dragText);
309 source.SetData(data);
310 dropWentOutside =
true;
311 inDragDrop = ddDragging;
312 result = source.DoDragDrop(evt.GetDragFlags());
313 if (result == wxDragMove && dropWentOutside)
316 SetDragPosition(SelectionPosition(invalidPosition));
322bool ScintillaWX::SetIdle(
bool on) {
323 if (idler.state != on) {
326 stc->Connect(wxID_ANY, wxEVT_IDLE, wxIdleEventHandler(wxStyledTextCtrl::OnIdle));
328 stc->Disconnect(wxID_ANY, wxEVT_IDLE, wxIdleEventHandler(wxStyledTextCtrl::OnIdle));
335void ScintillaWX::SetTicking(
bool on) {
336 wxSTCTimer* steTimer;
337 if (timer.ticking != on) {
340 steTimer =
new wxSTCTimer(
this);
341 steTimer->Start(timer.tickSize);
342 timer.tickerID = steTimer;
344 steTimer = (wxSTCTimer*)timer.tickerID;
350 timer.ticksToWait = caret.period;
354void ScintillaWX::SetMouseCapture(
bool on) {
355 if (mouseDownCaptures) {
356 if (on && !capturedMouse)
358 else if (!on && capturedMouse && stc->HasCapture())
365bool ScintillaWX::HaveMouseCapture() {
366 return capturedMouse;
370void ScintillaWX::ScrollText(
int linesToMove) {
371 int dy = vs.lineHeight * (linesToMove);
372 stc->ScrollWindow(0, dy);
375void ScintillaWX::SetVerticalScrollPos() {
376 if (stc->m_vScrollBar == NULL) {
377 stc->SetScrollPos(wxVERTICAL, topLine);
380 stc->m_vScrollBar->SetThumbPosition(topLine);
384void ScintillaWX::SetHorizontalScrollPos() {
385 if (stc->m_hScrollBar == NULL) {
386 stc->SetScrollPos(wxHORIZONTAL, xOffset);
389 stc->m_hScrollBar->SetThumbPosition(xOffset);
394const int H_SCROLL_STEP = 20;
396bool ScintillaWX::ModifyScrollBars(
int nMax,
int nPage) {
397 bool modified =
false;
400 if (!verticalScrollBarVisible)
404 if (stc->m_vScrollBar == NULL) {
405 int sbMax = stc->GetScrollRange(wxVERTICAL);
406 int sbThumb = stc->GetScrollThumb(wxVERTICAL);
407 int sbPos = stc->GetScrollPos(wxVERTICAL);
408 if (sbMax != vertEnd || sbThumb != nPage) {
409 stc->SetScrollbar(wxVERTICAL, sbPos, nPage, vertEnd+1);
414 int sbMax = stc->m_vScrollBar->GetRange();
415 int sbPage = stc->m_vScrollBar->GetPageSize();
416 int sbPos = stc->m_vScrollBar->GetThumbPosition();
417 if (sbMax != vertEnd || sbPage != nPage) {
418 stc->m_vScrollBar->SetScrollbar(sbPos, nPage, vertEnd+1, nPage);
425 PRectangle rcText = GetTextRectangle();
426 int horizEnd = scrollWidth;
429 if (!horizontalScrollBarVisible || (wrapState != eWrapNone))
431 int pageWidth = rcText.Width();
433 if (stc->m_hScrollBar == NULL) {
434 int sbMax = stc->GetScrollRange(wxHORIZONTAL);
435 int sbThumb = stc->GetScrollThumb(wxHORIZONTAL);
436 int sbPos = stc->GetScrollPos(wxHORIZONTAL);
437 if ((sbMax != horizEnd) || (sbThumb != pageWidth) || (sbPos != 0)) {
438 stc->SetScrollbar(wxHORIZONTAL, sbPos, pageWidth, horizEnd);
440 if (scrollWidth < pageWidth) {
441 HorizontalScrollTo(0);
446 int sbMax = stc->m_hScrollBar->GetRange();
447 int sbThumb = stc->m_hScrollBar->GetPageSize();
448 int sbPos = stc->m_hScrollBar->GetThumbPosition();
449 if ((sbMax != horizEnd) || (sbThumb != pageWidth) || (sbPos != 0)) {
450 stc->m_hScrollBar->SetScrollbar(sbPos, pageWidth, horizEnd, pageWidth);
452 if (scrollWidth < pageWidth) {
453 HorizontalScrollTo(0);
462void ScintillaWX::NotifyChange() {
467void ScintillaWX::NotifyParent(SCNotification scn) {
468 stc->NotifyParent(&scn);
476void ScintillaWX::CancelModes() {
478 AutoCompleteCancel();
480 Editor::CancelModes();
485void ScintillaWX::Copy() {
488 CopySelectionRange(&st);
494void ScintillaWX::Paste() {
495 pdoc->BeginUndoAction();
498 wxTextDataObject data;
499 bool gotData =
false;
501 wxTheClipboard->UsePrimarySelection(
false);
502 if (wxTheClipboard->Open()) {
503 gotData = wxTheClipboard->GetData(data);
504 wxTheClipboard->Close();
507 wxString text = wxTextBuffer::Translate(data.GetText(),
508 wxConvertEOLMode(pdoc->eolMode));
509 wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
513 data.SetText(wxEmptyString);
514 text = wxEmptyString;
516 int len = strlen(buf);
518 if (sel.IsRectangular())
519 PasteRectangular(sel.Last(), buf, len);
521 InsertPaste(SelectionPosition(sel.MainCaret()), buf, len);
525 pdoc->EndUndoAction();
531void ScintillaWX::CopyToClipboard(
const SelectionText& st) {
536 wxTheClipboard->UsePrimarySelection(
false);
537 if (wxTheClipboard->Open()) {
538 wxString text = wxTextBuffer::Translate(stc2wx(st.s, st.len-1));
539 wxTheClipboard->SetData(
new wxTextDataObject(text));
540 wxTheClipboard->Close();
548bool ScintillaWX::CanPaste() {
550 bool canPaste =
false;
553 if (Editor::CanPaste()) {
554 wxTheClipboard->UsePrimarySelection(
false);
555 didOpen = !wxTheClipboard->IsOpened();
557 wxTheClipboard->Open();
559 if (wxTheClipboard->IsOpened()) {
560 canPaste = wxTheClipboard->IsSupported(wxUSE_UNICODE ? wxDF_UNICODETEXT : wxDF_TEXT);
562 wxTheClipboard->Close();
571void ScintillaWX::CreateCallTipWindow(PRectangle) {
572 if (! ct.wCallTip.Created() ) {
573 ct.wCallTip =
new wxSTCCallTip(stc, &ct,
this);
574 ct.wDraw = ct.wCallTip;
579void ScintillaWX::AddToPopUp(
const char *label,
int cmd,
bool enabled) {
581 ((wxMenu*)popup.GetID())->AppendSeparator();
583 ((wxMenu*)popup.GetID())->Append(cmd, wxGetTranslation(stc2wx(label)));
586 ((wxMenu*)popup.GetID())->Enable(cmd, enabled);
593void ScintillaWX::ClaimSelection() {
598 CopySelectionRange(&st);
599 wxTheClipboard->UsePrimarySelection(
true);
600 if (wxTheClipboard->Open()) {
601 wxString text = stc2wx(st.s, st.len);
602 wxTheClipboard->SetData(
new wxTextDataObject(text));
603 wxTheClipboard->Close();
605 wxTheClipboard->UsePrimarySelection(
false);
611void ScintillaWX::UpdateSystemCaret() {
614 if (HasCaretSizeChanged()) {
615 DestroySystemCaret();
618 Point pos = PointMainCaret();
619 ::SetCaretPos(pos.
x, pos.
y);
625bool ScintillaWX::HasCaretSizeChanged() {
627 if ( (vs.caretWidth && (sysCaretWidth != vs.caretWidth))
628 || (vs.lineHeight && (sysCaretHeight != vs.lineHeight)) ) {
635bool ScintillaWX::CreateSystemCaret() {
637 sysCaretWidth = vs.caretWidth;
638 if (0 == sysCaretWidth) {
641 sysCaretHeight = vs.lineHeight;
642 int bitmapSize = (((sysCaretWidth + 15) & ~15) >> 3) * sysCaretHeight;
643 char *
bits =
new char[bitmapSize];
644 memset(
bits, 0, bitmapSize);
645 sysCaretBitmap = ::CreateBitmap(sysCaretWidth, sysCaretHeight, 1,
646 1,
reinterpret_cast<BYTE *
>(
bits));
648 BOOL retval = ::CreateCaret(GetHwndOf(stc), sysCaretBitmap,
649 sysCaretWidth, sysCaretHeight);
650 ::ShowCaret(GetHwndOf(stc));
657bool ScintillaWX::DestroySystemCaret() {
659 ::HideCaret(GetHwndOf(stc));
660 BOOL retval = ::DestroyCaret();
661 if (sysCaretBitmap) {
662 ::DeleteObject(sysCaretBitmap);
675sptr_t ScintillaWX::DefWndProc(
unsigned int , uptr_t , sptr_t ) {
679sptr_t ScintillaWX::WndProc(
unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
683 case SCI_CALLTIPSHOW: {
688 Point pt = LocationFromPosition(wParam);
689 char* defn =
reinterpret_cast<char *
>(lParam);
690 AutoCompleteCancel();
691 pt.
y += vs.lineHeight;
692 int ctStyle = ct.UseStyleCallTip() ? STYLE_CALLTIP : STYLE_DEFAULT;
693 if (ct.UseStyleCallTip())
695 ct.SetForeBack(vs.styles[STYLE_CALLTIP].fore, vs.styles[STYLE_CALLTIP].back);
697 int caretMain = sel.MainCaret();
698 PRectangle rc = ct.CallTipStart(caretMain, pt,
700 vs.styles[ctStyle].fontName,
701 vs.styles[ctStyle].sizeZoomed,
703 vs.styles[ctStyle].characterSet,
707 PRectangle rcClient = GetClientRectangle();
708 if (rc.bottom > rcClient.bottom) {
710 int offset = int(vs.lineHeight * 1.25) + rc.Height();
712 int offset = vs.lineHeight + rc.Height();
718 CreateCallTipWindow(rc);
719 ct.wCallTip.SetPositionRelative(rc, wMain);
726 case SCI_LOADLEXERLIBRARY:
727 LexerManager::GetInstance()->Load((
const char*)lParam);
732 return ScintillaBase::WndProc(iMessage, wParam, lParam);
742void ScintillaWX::DoPaint(wxDC* dc, wxRect rect) {
744 paintState = painting;
745 AutoSurface surfaceWindow(dc,
this);
747 rcPaint = PRectangleFromwxRect(rect);
748 PRectangle rcClient = GetClientRectangle();
749 paintingAllText = rcPaint.Contains(rcClient);
751 ClipChildren(*dc, rcPaint);
752 Paint(surfaceWindow, rcPaint);
753 surfaceWindow->Release();
756 if (paintState == paintAbandoned) {
762#if defined(__WXOSX__)
769 paintState = notPainting;
774void ScintillaWX::FullPaint() {
780void ScintillaWX::FullPaintDC(wxDC* dc) {
781 paintState = painting;
782 rcPaint = GetClientRectangle();
783 paintingAllText =
true;
784 AutoSurface surfaceWindow(dc,
this);
786 Paint(surfaceWindow, rcPaint);
787 surfaceWindow->Release();
789 paintState = notPainting;
794void ScintillaWX::DoHScroll(
int type,
int pos) {
796 PRectangle rcText = GetTextRectangle();
797 int pageWidth = rcText.Width() * 2 / 3;
798 if (type == wxEVT_SCROLLWIN_LINEUP || type == wxEVT_SCROLL_LINEUP)
799 xPos -= H_SCROLL_STEP;
800 else if (type == wxEVT_SCROLLWIN_LINEDOWN || type == wxEVT_SCROLL_LINEDOWN)
801 xPos += H_SCROLL_STEP;
802 else if (type == wxEVT_SCROLLWIN_PAGEUP || type == wxEVT_SCROLL_PAGEUP)
804 else if (type == wxEVT_SCROLLWIN_PAGEDOWN || type == wxEVT_SCROLL_PAGEDOWN) {
806 if (xPos > scrollWidth - rcText.Width()) {
807 xPos = scrollWidth - rcText.Width();
810 else if (type == wxEVT_SCROLLWIN_TOP || type == wxEVT_SCROLL_TOP)
812 else if (type == wxEVT_SCROLLWIN_BOTTOM || type == wxEVT_SCROLL_BOTTOM)
814 else if (type == wxEVT_SCROLLWIN_THUMBTRACK || type == wxEVT_SCROLL_THUMBTRACK)
817 HorizontalScrollTo(xPos);
820void ScintillaWX::DoVScroll(
int type,
int pos) {
821 int topLineNew = topLine;
822 if (type == wxEVT_SCROLLWIN_LINEUP || type == wxEVT_SCROLL_LINEUP)
824 else if (type == wxEVT_SCROLLWIN_LINEDOWN || type == wxEVT_SCROLL_LINEDOWN)
826 else if (type == wxEVT_SCROLLWIN_PAGEUP || type == wxEVT_SCROLL_PAGEUP)
827 topLineNew -= LinesToScroll();
828 else if (type == wxEVT_SCROLLWIN_PAGEDOWN || type == wxEVT_SCROLL_PAGEDOWN)
829 topLineNew += LinesToScroll();
830 else if (type == wxEVT_SCROLLWIN_TOP || type == wxEVT_SCROLL_TOP)
832 else if (type == wxEVT_SCROLLWIN_BOTTOM || type == wxEVT_SCROLL_BOTTOM)
833 topLineNew = MaxScrollPos();
834 else if (type == wxEVT_SCROLLWIN_THUMBTRACK || type == wxEVT_SCROLL_THUMBTRACK)
837 ScrollTo(topLineNew);
840void ScintillaWX::DoMouseWheel(wxMouseWheelAxis axis,
int rotation,
int delta,
841 int linesPerAction,
int columnsPerAction,
842 bool ctrlDown,
bool isPageScroll) {
843 int topLineNew = topLine;
848 if (axis == wxMOUSE_WHEEL_HORIZONTAL) {
849 wheelHRotation += rotation * (columnsPerAction * vs.spaceWidth);
850 pixels = wheelHRotation / delta;
851 wheelHRotation -= pixels * delta;
854 PRectangle rcText = GetTextRectangle();
855 if (xPos > scrollWidth - rcText.Width()) {
856 xPos = scrollWidth - rcText.Width();
858 HorizontalScrollTo(xPos);
863 KeyCommand(SCI_ZOOMIN);
866 KeyCommand(SCI_ZOOMOUT);
872 wheelVRotation += rotation;
873 lines = wheelVRotation / delta;
874 wheelVRotation -= lines * delta;
877 lines = lines * LinesOnScreen();
879 lines *= linesPerAction;
881 ScrollTo(topLineNew);
887void ScintillaWX::DoSize(
int WXUNUSED(width),
int WXUNUSED(height)) {
891void ScintillaWX::DoLoseFocus(){
893 SetFocusState(
false);
895 DestroySystemCaret();
898void ScintillaWX::DoGainFocus(){
902 DestroySystemCaret();
906void ScintillaWX::DoSysColourChange() {
907 InvalidateStyleData();
910void ScintillaWX::DoLeftButtonDown(
Point pt,
unsigned int curTime,
bool shift,
bool ctrl,
bool alt) {
911 ButtonDown(pt, curTime, shift, ctrl, alt);
914void ScintillaWX::DoLeftButtonUp(
Point pt,
unsigned int curTime,
bool ctrl) {
915 ButtonUp(pt, curTime, ctrl);
918void ScintillaWX::DoLeftButtonMove(
Point pt) {
923void ScintillaWX::DoMiddleButtonUp(
Point pt) {
926 int newPos = PositionFromLocation(pt);
927 MovePositionTo(newPos, Selection::noSel,
true);
929 pdoc->BeginUndoAction();
930 wxTextDataObject data;
931 bool gotData =
false;
932 wxTheClipboard->UsePrimarySelection(
true);
933 if (wxTheClipboard->Open()) {
934 gotData = wxTheClipboard->GetData(data);
935 wxTheClipboard->Close();
937 wxTheClipboard->UsePrimarySelection(
false);
939 wxString text = wxTextBuffer::Translate(data.GetText(),
940 wxConvertEOLMode(pdoc->eolMode));
941 wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
942 int len = strlen(buf);
943 int caretMain = sel.MainCaret();
944 pdoc->InsertString(caretMain, buf, len);
945 SetEmptySelection(caretMain + len);
947 pdoc->EndUndoAction();
951 ShowCaretAtCurrentPosition();
952 EnsureCaretVisible();
955void ScintillaWX::DoMiddleButtonUp(
Point WXUNUSED(pt)) {
960void ScintillaWX::DoAddChar(
int key) {
963 wszChars[0] = (wxChar)key;
965 wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(wszChars);
966 AddCharUTF((
char*)buf.data(), strlen(buf));
973int ScintillaWX::DoKeyDown(
const wxKeyEvent& evt,
bool* consumed)
975 int key = evt.GetKeyCode();
976 if (key == WXK_NONE) {
984 bool shift = evt.ShiftDown(),
985 ctrl = evt.ControlDown(),
988 if (ctrl && key >= 1 && key <= 26 && key != WXK_BACK)
992 case WXK_DOWN: key = SCK_DOWN;
break;
993 case WXK_UP: key = SCK_UP;
break;
994 case WXK_LEFT: key = SCK_LEFT;
break;
995 case WXK_RIGHT: key = SCK_RIGHT;
break;
996 case WXK_HOME: key = SCK_HOME;
break;
997 case WXK_END: key = SCK_END;
break;
998 case WXK_PAGEUP: key = SCK_PRIOR;
break;
999 case WXK_PAGEDOWN: key = SCK_NEXT;
break;
1000 case WXK_NUMPAD_DOWN: key = SCK_DOWN;
break;
1001 case WXK_NUMPAD_UP: key = SCK_UP;
break;
1002 case WXK_NUMPAD_LEFT: key = SCK_LEFT;
break;
1003 case WXK_NUMPAD_RIGHT: key = SCK_RIGHT;
break;
1004 case WXK_NUMPAD_HOME: key = SCK_HOME;
break;
1005 case WXK_NUMPAD_END: key = SCK_END;
break;
1006 case WXK_NUMPAD_PAGEUP: key = SCK_PRIOR;
break;
1007 case WXK_NUMPAD_PAGEDOWN: key = SCK_NEXT;
break;
1008 case WXK_NUMPAD_DELETE: key = SCK_DELETE;
break;
1009 case WXK_NUMPAD_INSERT: key = SCK_INSERT;
break;
1010 case WXK_DELETE: key = SCK_DELETE;
break;
1011 case WXK_INSERT: key = SCK_INSERT;
break;
1012 case WXK_ESCAPE: key = SCK_ESCAPE;
break;
1013 case WXK_BACK: key = SCK_BACK;
break;
1014 case WXK_TAB: key = SCK_TAB;
break;
1015 case WXK_NUMPAD_ENTER:
1016 case WXK_RETURN: key = SCK_RETURN;
break;
1018 case WXK_NUMPAD_ADD: key = SCK_ADD;
break;
1020 case WXK_NUMPAD_SUBTRACT: key = SCK_SUBTRACT;
break;
1022 case WXK_NUMPAD_DIVIDE: key = SCK_DIVIDE;
break;
1023 case WXK_CONTROL: key = 0;
break;
1024 case WXK_ALT: key = 0;
break;
1025 case WXK_SHIFT: key = 0;
break;
1026 case WXK_MENU: key = SCK_MENU;
break;
1030 if ( evt.MetaDown() ) {
1045 int rv = KeyDown(key, shift, ctrl, alt, consumed);
1054void ScintillaWX::DoCommand(
int ID) {
1059void ScintillaWX::DoContextMenu(
Point pt) {
1060 if (displayPopupMenu)
1064void ScintillaWX::DoOnListBox() {
1065 AutoCompleteCompleted();
1069void ScintillaWX::DoOnIdle(wxIdleEvent& evt) {
1079#if wxUSE_DRAG_AND_DROP
1080bool ScintillaWX::DoDropText(
long x,
long y,
const wxString& data) {
1081 SetDragPosition(SelectionPosition(invalidPosition));
1083 wxString text = wxTextBuffer::Translate(data,
1084 wxConvertEOLMode(pdoc->eolMode));
1087 wxStyledTextEvent evt(wxEVT_STC_DO_DROP, stc->GetId());
1088 evt.SetEventObject(stc);
1089 evt.SetDragResult(dragResult);
1092 evt.SetPosition(PositionFromLocation(
Point(x,y)));
1093 evt.SetDragText(text);
1094 stc->GetEventHandler()->ProcessEvent(evt);
1096 dragResult = evt.GetDragResult();
1097 if (dragResult == wxDragMove || dragResult == wxDragCopy) {
1098 DropAt(SelectionPosition(evt.GetPosition()),
1099 wx2stc(evt.GetDragText()),
1100 dragResult == wxDragMove,
1108wxDragResult ScintillaWX::DoDragEnter(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), wxDragResult def) {
1114wxDragResult ScintillaWX::DoDragOver(wxCoord x, wxCoord y, wxDragResult def) {
1115 SetDragPosition(SelectionPosition(PositionFromLocation(
Point(x, y))));
1118 wxStyledTextEvent evt(wxEVT_STC_DRAG_OVER, stc->GetId());
1119 evt.SetEventObject(stc);
1120 evt.SetDragResult(def);
1123 evt.SetPosition(PositionFromLocation(
Point(x,y)));
1124 stc->GetEventHandler()->ProcessEvent(evt);
1126 dragResult = evt.GetDragResult();
1131void ScintillaWX::DoDragLeave() {
1132 SetDragPosition(SelectionPosition(invalidPosition));
1137void ScintillaWX::DoScrollToLine(
int line) {
1142void ScintillaWX::DoScrollToColumn(
int column) {
1143 HorizontalScrollTo(column * vs.spaceWidth);
1148void ScintillaWX::ClipChildren(wxDC& WXUNUSED(dc), PRectangle WXUNUSED(rect))
1167void ScintillaWX::SetUseAntiAliasing(
bool useAA) {
1168 vs.extraFontFlag = useAA;
1169 InvalidateStyleRedraw();
1172bool ScintillaWX::GetUseAntiAliasing() {
1173 return vs.extraFontFlag != 0;
if(nReturnType==EIGENVALUES)
This represents a point in 2D space.