1 ////////////////////////////////////////////////////////////////////////////
2 // Name: ScintillaWX.cxx
3 // Purpose: A wxWindows implementation of Scintilla. A class derived
4 // from ScintillaBase that uses the "wx platform" defined in
5 // PlatformWX.cxx This class is one end of a bridge between
6 // the wx world and the Scintilla world. It needs a peer
7 // object of type wxStyledTextCtrl to function.
11 // Created: 13-Jan-2000
13 // Copyright: (c) 2000 by Total Control Software
14 // Licence: wxWindows license
15 /////////////////////////////////////////////////////////////////////////////
18 #include "ScintillaWX.h"
19 #include "wx/stc/stc.h"
22 //----------------------------------------------------------------------
25 class wxSTCTimer
: public wxTimer
{
27 wxSTCTimer(ScintillaWX
* swx
) {
40 #if wxUSE_DRAG_AND_DROP
41 bool wxSTCDropTarget
::OnDropText(wxCoord x
, wxCoord y
, const wxString
& data
) {
42 return swx
->DoDropText(x
, y
, data
);
45 wxDragResult wxSTCDropTarget
::OnEnter(wxCoord x
, wxCoord y
, wxDragResult def
) {
46 return swx
->DoDragEnter(x
, y
, def
);
49 wxDragResult wxSTCDropTarget
::OnDragOver(wxCoord x
, wxCoord y
, wxDragResult def
) {
50 return swx
->DoDragOver(x
, y
, def
);
53 void wxSTCDropTarget
::OnLeave() {
60 #undef wxSTC_USE_POPUP
61 #define wxSTC_USE_POPUP 0
64 #if wxUSE_POPUPWIN && wxSTC_USE_POPUP
65 #include <wx/popupwin.h>
66 #define wxSTCCallTipBase wxPopupWindow
67 #define param2 wxBORDER_NONE // popup's 2nd param is flags
69 #define wxSTCCallTipBase wxWindow
70 #define param2 -1 // wxWindow's 2nd param is ID
73 class wxSTCCallTip
: public wxSTCCallTipBase
{
75 wxSTCCallTip(wxWindow
* parent
, CallTip
* ct
, ScintillaWX
* swx
)
76 : wxSTCCallTipBase(parent
, param2
),
84 bool AcceptsFocus() const { return FALSE
; }
86 void OnPaint(wxPaintEvent
& evt
) {
88 Surface
* surfaceWindow
= Surface
::Allocate();
89 surfaceWindow
->Init(&dc
, m_ct
->wDraw
.GetID());
90 m_ct
->PaintCT(surfaceWindow
);
91 surfaceWindow
->Release();
95 void OnFocus(wxFocusEvent
& event
) {
96 GetParent()->SetFocus();
100 void OnLeftDown(wxMouseEvent
& event
) {
101 wxPoint pt
= event
.GetPosition();
104 m_swx
->CallTipClick();
107 #if wxUSE_POPUPWIN && wxSTC_USE_POPUP
108 virtual void DoSetSize(int x
, int y
,
109 int width
, int height
,
110 int sizeFlags
= wxSIZE_AUTO
) {
112 GetParent()->ClientToScreen(&x
, NULL
);
114 GetParent()->ClientToScreen(NULL
, &y
);
115 wxSTCCallTipBase
::DoSetSize(x
, y
, width
, height
, sizeFlags
);
122 DECLARE_EVENT_TABLE()
125 BEGIN_EVENT_TABLE(wxSTCCallTip
, wxSTCCallTipBase
)
126 EVT_PAINT(wxSTCCallTip
::OnPaint
)
127 EVT_SET_FOCUS(wxSTCCallTip
::OnFocus
)
128 EVT_LEFT_DOWN(wxSTCCallTip
::OnLeftDown
)
132 //----------------------------------------------------------------------
133 // Constructor/Destructor
136 ScintillaWX
::ScintillaWX(wxStyledTextCtrl
* win
) {
137 capturedMouse
= false;
145 ScintillaWX
::~ScintillaWX() {
149 //----------------------------------------------------------------------
150 // base class virtuals
153 void ScintillaWX
::Initialise() {
154 //ScintillaBase::Initialise();
155 #if wxUSE_DRAG_AND_DROP
156 dropTarget
= new wxSTCDropTarget
;
157 dropTarget
->SetScintilla(this);
158 stc
->SetDropTarget(dropTarget
);
163 void ScintillaWX
::Finalise() {
164 ScintillaBase
::Finalise();
168 void ScintillaWX
::StartDrag() {
169 #if wxUSE_DRAG_AND_DROP
170 wxString dragText
= stc2wx(drag
.s
, drag
.len
);
172 // Send an event to allow the drag text to be changed
173 wxStyledTextEvent
evt(wxEVT_STC_START_DRAG
, stc
->GetId());
174 evt
.SetEventObject(stc
);
175 evt
.SetDragText(dragText
);
176 evt
.SetDragAllowMove(TRUE
);
177 evt
.SetPosition(wxMin(stc
->GetSelectionStart(),
178 stc
->GetSelectionEnd()));
179 stc
->GetEventHandler()->ProcessEvent(evt
);
180 dragText
= evt
.GetDragText();
182 if (dragText
.Length()) {
183 wxDropSource
source(stc
);
184 wxTextDataObject
data(dragText
);
187 source
.SetData(data
);
188 dropWentOutside
= TRUE
;
189 result
= source
.DoDragDrop(evt
.GetDragAllowMove());
190 if (result
== wxDragMove
&& dropWentOutside
)
193 SetDragPosition(invalidPosition
);
199 void ScintillaWX
::SetTicking(bool on
) {
200 wxSTCTimer
* steTimer
;
201 if (timer
.ticking
!= on
) {
204 steTimer
= new wxSTCTimer(this);
205 steTimer
->Start(timer
.tickSize
);
206 timer
.tickerID
= steTimer
;
208 steTimer
= (wxSTCTimer
*)timer
.tickerID
;
214 timer
.ticksToWait
= caret
.period
;
218 void ScintillaWX
::SetMouseCapture(bool on
) {
219 if (on
&& !capturedMouse
)
221 else if (!on
&& capturedMouse
&& stc
->HasCapture())
227 bool ScintillaWX
::HaveMouseCapture() {
228 return capturedMouse
;
232 void ScintillaWX
::ScrollText(int linesToMove
) {
233 int dy
= vs
.lineHeight
* (linesToMove
);
234 stc
->ScrollWindow(0, dy
);
238 void ScintillaWX
::SetVerticalScrollPos() {
239 if (stc
->m_vScrollBar
== NULL
) { // Use built-in scrollbar
240 stc
->SetScrollPos(wxVERTICAL
, topLine
);
242 else { // otherwise use the one that's been given to us
243 stc
->m_vScrollBar
->SetThumbPosition(topLine
);
247 void ScintillaWX
::SetHorizontalScrollPos() {
248 if (stc
->m_hScrollBar
== NULL
) { // Use built-in scrollbar
249 stc
->SetScrollPos(wxHORIZONTAL
, xOffset
);
251 else { // otherwise use the one that's been given to us
252 stc
->m_hScrollBar
->SetThumbPosition(xOffset
);
256 const int H_SCROLL_STEP
= 20;
258 bool ScintillaWX
::ModifyScrollBars(int nMax
, int nPage
) {
259 bool modified
= false;
261 // Check the vertical scrollbar
262 if (stc
->m_vScrollBar
== NULL
) { // Use built-in scrollbar
263 int sbMax
= stc
->GetScrollRange(wxVERTICAL
);
264 int sbThumb
= stc
->GetScrollThumb(wxVERTICAL
);
265 int sbPos
= stc
->GetScrollPos(wxVERTICAL
);
266 if (sbMax
!= nMax
|| sbThumb
!= nPage
) {
267 stc
->SetScrollbar(wxVERTICAL
, sbPos
, nPage
, nMax
+1);
271 else { // otherwise use the one that's been given to us
272 int sbMax
= stc
->m_vScrollBar
->GetRange();
273 int sbPage
= stc
->m_vScrollBar
->GetPageSize();
274 int sbPos
= stc
->m_vScrollBar
->GetThumbPosition();
275 if (sbMax
!= nMax
|| sbPage
!= nPage
) {
276 stc
->m_vScrollBar
->SetScrollbar(sbPos
, nPage
, nMax
+1, nPage
);
282 // Check the horizontal scrollbar
283 PRectangle rcText
= GetTextRectangle();
284 int horizEnd
= scrollWidth
;
287 if (!horizontalScrollBarVisible
|| (wrapState
!= eWrapNone
))
289 int pageWidth
= rcText
.Width();
291 if (stc
->m_hScrollBar
== NULL
) { // Use built-in scrollbar
292 int sbMax
= stc
->GetScrollRange(wxHORIZONTAL
);
293 int sbThumb
= stc
->GetScrollThumb(wxHORIZONTAL
);
294 int sbPos
= stc
->GetScrollPos(wxHORIZONTAL
);
295 if ((sbMax
!= horizEnd
) || (sbThumb
!= pageWidth
) || (sbPos
!= 0)) {
296 stc
->SetScrollbar(wxHORIZONTAL
, 0, pageWidth
, horizEnd
);
298 if (scrollWidth
< pageWidth
) {
299 HorizontalScrollTo(0);
303 else { // otherwise use the one that's been given to us
304 int sbMax
= stc
->m_hScrollBar
->GetRange();
305 int sbThumb
= stc
->m_hScrollBar
->GetPageSize();
306 int sbPos
= stc
->m_hScrollBar
->GetThumbPosition();
307 if ((sbMax
!= horizEnd
) || (sbThumb
!= pageWidth
) || (sbPos
!= 0)) {
308 stc
->m_hScrollBar
->SetScrollbar(0, pageWidth
, horizEnd
, pageWidth
);
310 if (scrollWidth
< pageWidth
) {
311 HorizontalScrollTo(0);
320 void ScintillaWX
::NotifyChange() {
325 void ScintillaWX
::NotifyParent(SCNotification scn
) {
326 stc
->NotifyParent(&scn
);
331 void ScintillaWX
::Copy() {
332 if (currentPos
!= anchor
) {
334 CopySelectionRange(&st
);
335 if (wxTheClipboard
->Open()) {
336 wxTheClipboard
->UsePrimarySelection(FALSE
);
337 wxString text
= stc2wx(st
.s
, st
.len
);
338 wxTheClipboard
->SetData(new wxTextDataObject(text
));
339 wxTheClipboard
->Close();
345 void ScintillaWX
::Paste() {
346 pdoc
->BeginUndoAction();
349 wxTextDataObject data
;
350 bool gotData
= FALSE
;
352 if (wxTheClipboard
->Open()) {
353 wxTheClipboard
->UsePrimarySelection(FALSE
);
354 gotData
= wxTheClipboard
->GetData(data
);
355 wxTheClipboard
->Close();
358 wxWX2MBbuf buf
= (wxWX2MBbuf
)wx2stc(data
.GetText());
359 int len
= strlen(buf
);
360 pdoc
->InsertString(currentPos
, buf
, len
);
361 SetEmptySelection(currentPos
+ len
);
364 pdoc
->EndUndoAction();
370 bool ScintillaWX
::CanPaste() {
371 bool canPaste
= FALSE
;
374 if ( (didOpen
= !wxTheClipboard
->IsOpened()) )
375 wxTheClipboard
->Open();
377 if (wxTheClipboard
->IsOpened()) {
378 wxTheClipboard
->UsePrimarySelection(FALSE
);
379 canPaste
= wxTheClipboard
->IsSupported(wxUSE_UNICODE ? wxDF_UNICODETEXT
: wxDF_TEXT
);
381 wxTheClipboard
->Close();
386 void ScintillaWX
::CreateCallTipWindow(PRectangle
) {
387 if (! ct
.wCallTip
.Created() ) {
388 ct
.wCallTip
= new wxSTCCallTip(stc
, &ct
, this);
389 ct
.wDraw
= ct
.wCallTip
;
394 void ScintillaWX
::AddToPopUp(const char *label
, int cmd
, bool enabled
) {
396 ((wxMenu
*)popup
.GetID())->AppendSeparator();
398 ((wxMenu
*)popup
.GetID())->Append(cmd
, stc2wx(label
));
401 ((wxMenu
*)popup
.GetID())->Enable(cmd
, enabled
);
405 // This is called by the Editor base class whenever something is selected
406 void ScintillaWX
::ClaimSelection() {
408 // Until wxGTK is able to support using both the primary selection and the
409 // clipboard at the same time I think it causes more problems than it is
410 // worth to implement this method. Selecting text should not clear the
411 // clipboard. --Robin
413 // Put the selected text in the PRIMARY selection
414 if (currentPos
!= anchor
) {
416 CopySelectionRange(&st
);
417 if (wxTheClipboard
->Open()) {
418 wxTheClipboard
->UsePrimarySelection(TRUE
);
419 wxString text
= stc2wx(st
.s
, st
.len
);
420 wxTheClipboard
->SetData(new wxTextDataObject(text
));
421 wxTheClipboard
->UsePrimarySelection(FALSE
);
422 wxTheClipboard
->Close();
430 long ScintillaWX
::DefWndProc(unsigned int /*iMessage*/, unsigned long /*wParam*/, long /*lParam*/) {
434 long ScintillaWX
::WndProc(unsigned int iMessage
, unsigned long wParam
, long lParam
) {
436 case SCI_CALLTIPSHOW
: {
437 // NOTE: This is copied here from scintilla/src/ScintillaBase.cxx
438 // because of the little tweak that needs done below for wxGTK.
439 // When updating new versions double check that this is still
440 // needed, and that any new code there is copied here too.
441 Point pt
= LocationFromPosition(wParam
);
442 char* defn
= reinterpret_cast<char *>(lParam
);
443 AutoCompleteCancel();
444 pt
.y
+= vs
.lineHeight
;
445 PRectangle rc
= ct
.CallTipStart(currentPos
, pt
,
447 vs
.styles
[STYLE_DEFAULT
].fontName
,
448 vs
.styles
[STYLE_DEFAULT
].sizeZoomed
,
451 // If the call-tip window would be out of the client
452 // space, adjust so it displays above the text.
453 PRectangle rcClient
= GetClientRectangle();
454 if (rc
.bottom
> rcClient
.bottom
) {
456 int offset
= int(vs
.lineHeight
* 1.25) + rc
.Height();
458 int offset
= vs
.lineHeight
+ rc
.Height();
463 // Now display the window.
464 CreateCallTipWindow(rc
);
465 ct
.wCallTip
.SetPositionRelative(rc
, wMain
);
471 return ScintillaBase
::WndProc(iMessage
, wParam
, lParam
);
478 //----------------------------------------------------------------------
481 void ScintillaWX
::DoPaint(wxDC
* dc
, wxRect rect
) {
483 paintState
= painting
;
484 Surface
* surfaceWindow
= Surface
::Allocate();
485 surfaceWindow
->Init(dc
, wMain
.GetID());
486 rcPaint
= PRectangleFromwxRect(rect
);
487 PRectangle rcClient
= GetClientRectangle();
488 paintingAllText
= rcPaint
.Contains(rcClient
);
491 ClipChildren(*dc
, rcPaint
);
492 Paint(surfaceWindow
, rcPaint
);
495 delete surfaceWindow
;
496 if (paintState
== paintAbandoned
) {
497 // Painting area was insufficient to cover new styling or brace highlight positions
500 paintState
= notPainting
;
504 void ScintillaWX
::DoHScroll(int type
, int pos
) {
506 PRectangle rcText
= GetTextRectangle();
507 int pageWidth
= rcText
.Width() * 2 / 3;
508 if (type
== wxEVT_SCROLLWIN_LINEUP
|| type
== wxEVT_SCROLL_LINEUP
)
509 xPos
-= H_SCROLL_STEP
;
510 else if (type
== wxEVT_SCROLLWIN_LINEDOWN
|| type
== wxEVT_SCROLL_LINEDOWN
)
511 xPos
+= H_SCROLL_STEP
;
512 else if (type
== wxEVT_SCROLLWIN_PAGEUP
|| type
== wxEVT_SCROLL_PAGEUP
)
514 else if (type
== wxEVT_SCROLLWIN_PAGEDOWN
|| type
== wxEVT_SCROLL_PAGEDOWN
) {
516 if (xPos
> scrollWidth
- rcText
.Width()) {
517 xPos
= scrollWidth
- rcText
.Width();
520 else if (type
== wxEVT_SCROLLWIN_TOP
|| type
== wxEVT_SCROLL_TOP
)
522 else if (type
== wxEVT_SCROLLWIN_BOTTOM
|| type
== wxEVT_SCROLL_BOTTOM
)
524 else if (type
== wxEVT_SCROLLWIN_THUMBTRACK
|| type
== wxEVT_SCROLL_THUMBTRACK
)
527 HorizontalScrollTo(xPos
);
530 void ScintillaWX
::DoVScroll(int type
, int pos
) {
531 int topLineNew
= topLine
;
532 if (type
== wxEVT_SCROLLWIN_LINEUP
|| type
== wxEVT_SCROLL_LINEUP
)
534 else if (type
== wxEVT_SCROLLWIN_LINEDOWN
|| type
== wxEVT_SCROLL_LINEDOWN
)
536 else if (type
== wxEVT_SCROLLWIN_PAGEUP
|| type
== wxEVT_SCROLL_PAGEUP
)
537 topLineNew
-= LinesToScroll();
538 else if (type
== wxEVT_SCROLLWIN_PAGEDOWN
|| type
== wxEVT_SCROLL_PAGEDOWN
)
539 topLineNew
+= LinesToScroll();
540 else if (type
== wxEVT_SCROLLWIN_TOP
|| type
== wxEVT_SCROLL_TOP
)
542 else if (type
== wxEVT_SCROLLWIN_BOTTOM
|| type
== wxEVT_SCROLL_BOTTOM
)
543 topLineNew
= MaxScrollPos();
544 else if (type
== wxEVT_SCROLLWIN_THUMBTRACK
|| type
== wxEVT_SCROLL_THUMBTRACK
)
547 ScrollTo(topLineNew
);
550 void ScintillaWX
::DoMouseWheel(int rotation
, int delta
,
551 int linesPerAction
, int ctrlDown
,
552 bool isPageScroll
) {
553 int topLineNew
= topLine
;
556 if (ctrlDown
) { // Zoom the fonts if Ctrl key down
558 KeyCommand(SCI_ZOOMIN
);
561 KeyCommand(SCI_ZOOMOUT
);
564 else { // otherwise just scroll the window
567 wheelRotation
+= rotation
;
568 lines
= wheelRotation
/ delta
;
569 wheelRotation
-= lines
* delta
;
572 lines
= lines
* LinesOnScreen(); // lines is either +1 or -1
574 lines
*= linesPerAction
;
576 ScrollTo(topLineNew
);
582 void ScintillaWX
::DoSize(int width
, int height
) {
583 // PRectangle rcClient(0,0,width,height);
584 // SetScrollBarsTo(rcClient);
589 void ScintillaWX
::DoLoseFocus(){
590 SetFocusState(false);
593 void ScintillaWX
::DoGainFocus(){
597 void ScintillaWX
::DoSysColourChange() {
598 InvalidateStyleData();
601 void ScintillaWX
::DoLeftButtonDown(Point pt
, unsigned int curTime
, bool shift
, bool ctrl
, bool alt
) {
602 ButtonDown(pt
, curTime
, shift
, ctrl
, alt
);
605 void ScintillaWX
::DoLeftButtonUp(Point pt
, unsigned int curTime
, bool ctrl
) {
606 ButtonUp(pt
, curTime
, ctrl
);
609 void ScintillaWX
::DoLeftButtonMove(Point pt
) {
613 void ScintillaWX
::DoMiddleButtonUp(Point pt
) {
615 // Set the current position to the mouse click point and
616 // then paste in the PRIMARY selection, if any. wxGTK only.
617 int newPos
= PositionFromLocation(pt
);
618 MovePositionTo(newPos
, 0, 1);
620 pdoc
->BeginUndoAction();
621 wxTextDataObject data
;
622 bool gotData
= FALSE
;
623 if (wxTheClipboard
->Open()) {
624 wxTheClipboard
->UsePrimarySelection(TRUE
);
625 gotData
= wxTheClipboard
->GetData(data
);
626 wxTheClipboard
->UsePrimarySelection(FALSE
);
627 wxTheClipboard
->Close();
630 wxWX2MBbuf buf
= (wxWX2MBbuf
)wx2stc(data
.GetText());
631 int len
= strlen(buf
);
632 pdoc
->InsertString(currentPos
, buf
, len
);
633 SetEmptySelection(currentPos
+ len
);
635 pdoc
->EndUndoAction();
639 ShowCaretAtCurrentPosition();
640 EnsureCaretVisible();
645 void ScintillaWX
::DoAddChar(int key
) {
650 wxWX2MBbuf buf
= (wxWX2MBbuf
)wx2stc(wszChars
);
651 AddCharUTF((char*)buf
.data(), strlen(buf
));
658 int ScintillaWX
::DoKeyDown(int key
, bool shift
, bool ctrl
, bool alt
, bool* consumed
) {
659 #if defined(__WXGTK__) || defined(__WXMAC__)
660 // Ctrl chars (A-Z) end up with the wrong keycode on wxGTK...
661 if (ctrl
&& key
>= 1 && key
<= 26)
666 case WXK_DOWN
: key
= SCK_DOWN
; break;
667 case WXK_UP
: key
= SCK_UP
; break;
668 case WXK_LEFT
: key
= SCK_LEFT
; break;
669 case WXK_RIGHT
: key
= SCK_RIGHT
; break;
670 case WXK_HOME
: key
= SCK_HOME
; break;
671 case WXK_END
: key
= SCK_END
; break;
672 case WXK_PAGEUP
: // fall through
673 case WXK_PRIOR
: key
= SCK_PRIOR
; break;
674 case WXK_PAGEDOWN
: // fall through
675 case WXK_NEXT
: key
= SCK_NEXT
; break;
676 case WXK_DELETE
: key
= SCK_DELETE
; break;
677 case WXK_INSERT
: key
= SCK_INSERT
; break;
678 case WXK_ESCAPE
: key
= SCK_ESCAPE
; break;
679 case WXK_BACK
: key
= SCK_BACK
; break;
680 case WXK_TAB
: key
= SCK_TAB
; break;
681 case WXK_RETURN
: key
= SCK_RETURN
; break;
682 case WXK_ADD
: // fall through
683 case WXK_NUMPAD_ADD
: key
= SCK_ADD
; break;
684 case WXK_SUBTRACT
: // fall through
685 case WXK_NUMPAD_SUBTRACT
: key
= SCK_SUBTRACT
; break;
686 case WXK_DIVIDE
: // fall through
687 case WXK_NUMPAD_DIVIDE
: key
= SCK_DIVIDE
; break;
688 case WXK_CONTROL
: key
= 0; break;
689 case WXK_ALT
: key
= 0; break;
690 case WXK_SHIFT
: key
= 0; break;
691 case WXK_MENU
: key
= 0; break;
694 int rv
= KeyDown(key
, shift
, ctrl
, alt
, consumed
);
703 void ScintillaWX
::DoCommand(int ID
) {
708 void ScintillaWX
::DoContextMenu(Point pt
) {
709 if (displayPopupMenu
)
713 void ScintillaWX
::DoOnListBox() {
714 AutoCompleteCompleted();
717 //----------------------------------------------------------------------
719 #if wxUSE_DRAG_AND_DROP
720 bool ScintillaWX
::DoDropText(long x
, long y
, const wxString
& data
) {
721 SetDragPosition(invalidPosition
);
723 // Send an event to allow the drag details to be changed
724 wxStyledTextEvent
evt(wxEVT_STC_DO_DROP
, stc
->GetId());
725 evt
.SetEventObject(stc
);
726 evt
.SetDragResult(dragResult
);
729 evt
.SetPosition(PositionFromLocation(Point(x
,y
)));
730 evt
.SetDragText(data
);
731 stc
->GetEventHandler()->ProcessEvent(evt
);
733 dragResult
= evt
.GetDragResult();
734 if (dragResult
== wxDragMove
|| dragResult
== wxDragCopy
) {
735 DropAt(evt
.GetPosition(),
736 wx2stc(evt
.GetDragText()),
737 dragResult
== wxDragMove
,
738 FALSE
); // TODO: rectangular?
745 wxDragResult ScintillaWX
::DoDragEnter(wxCoord x
, wxCoord y
, wxDragResult def
) {
751 wxDragResult ScintillaWX
::DoDragOver(wxCoord x
, wxCoord y
, wxDragResult def
) {
752 SetDragPosition(PositionFromLocation(Point(x
, y
)));
754 // Send an event to allow the drag result to be changed
755 wxStyledTextEvent
evt(wxEVT_STC_DRAG_OVER
, stc
->GetId());
756 evt
.SetEventObject(stc
);
757 evt
.SetDragResult(def
);
760 evt
.SetPosition(PositionFromLocation(Point(x
,y
)));
761 stc
->GetEventHandler()->ProcessEvent(evt
);
763 dragResult
= evt
.GetDragResult();
768 void ScintillaWX
::DoDragLeave() {
769 SetDragPosition(invalidPosition
);
772 //----------------------------------------------------------------------
774 // Redraw all of text area. This paint will not be abandoned.
775 void ScintillaWX
::FullPaint() {
776 paintState
= painting
;
777 rcPaint
= GetClientRectangle();
778 paintingAllText
= true;
780 Surface
* surfaceWindow
= Surface
::Allocate();
781 surfaceWindow
->Init(&dc
, wMain
.GetID());
784 ClipChildren(dc
, rcPaint
);
785 Paint(surfaceWindow
, rcPaint
);
788 delete surfaceWindow
;
789 paintState
= notPainting
;
793 void ScintillaWX
::DoScrollToLine(int line
) {
798 void ScintillaWX
::DoScrollToColumn(int column
) {
799 HorizontalScrollTo(column
* vs
.spaceWidth
);
802 void ScintillaWX
::ClipChildren(wxDC
& dc
, PRectangle rect
) {
804 wxRegion
rgn(wxRectFromPRectangle(rect
));
806 wxRect childRect
= ((wxWindow
*)ac
.lb
->GetID())->GetRect();
807 rgn
.Subtract(childRect
);
809 if (ct
.inCallTipMode
) {
810 wxRect childRect
= ((wxWindow
*)ct
.wCallTip
.GetID())->GetRect();
811 rgn
.Subtract(childRect
);
814 dc
.SetClippingRegion(rgn
);
819 //----------------------------------------------------------------------
820 //----------------------------------------------------------------------