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
);
257 const int H_SCROLL_STEP
= 20;
259 bool ScintillaWX::ModifyScrollBars(int nMax
, int nPage
) {
260 bool modified
= false;
263 if (!verticalScrollBarVisible
)
266 // Check the vertical scrollbar
267 if (stc
->m_vScrollBar
== NULL
) { // Use built-in scrollbar
268 int sbMax
= stc
->GetScrollRange(wxVERTICAL
);
269 int sbThumb
= stc
->GetScrollThumb(wxVERTICAL
);
270 int sbPos
= stc
->GetScrollPos(wxVERTICAL
);
271 if (sbMax
!= vertEnd
|| sbThumb
!= nPage
) {
272 stc
->SetScrollbar(wxVERTICAL
, sbPos
, nPage
, vertEnd
+1);
276 else { // otherwise use the one that's been given to us
277 int sbMax
= stc
->m_vScrollBar
->GetRange();
278 int sbPage
= stc
->m_vScrollBar
->GetPageSize();
279 int sbPos
= stc
->m_vScrollBar
->GetThumbPosition();
280 if (sbMax
!= vertEnd
|| sbPage
!= nPage
) {
281 stc
->m_vScrollBar
->SetScrollbar(sbPos
, nPage
, vertEnd
+1, nPage
);
287 // Check the horizontal scrollbar
288 PRectangle rcText
= GetTextRectangle();
289 int horizEnd
= scrollWidth
;
292 if (!horizontalScrollBarVisible
|| (wrapState
!= eWrapNone
))
294 int pageWidth
= rcText
.Width();
296 if (stc
->m_hScrollBar
== NULL
) { // Use built-in scrollbar
297 int sbMax
= stc
->GetScrollRange(wxHORIZONTAL
);
298 int sbThumb
= stc
->GetScrollThumb(wxHORIZONTAL
);
299 int sbPos
= stc
->GetScrollPos(wxHORIZONTAL
);
300 if ((sbMax
!= horizEnd
) || (sbThumb
!= pageWidth
) || (sbPos
!= 0)) {
301 stc
->SetScrollbar(wxHORIZONTAL
, sbPos
, pageWidth
, horizEnd
);
303 if (scrollWidth
< pageWidth
) {
304 HorizontalScrollTo(0);
308 else { // otherwise use the one that's been given to us
309 int sbMax
= stc
->m_hScrollBar
->GetRange();
310 int sbThumb
= stc
->m_hScrollBar
->GetPageSize();
311 int sbPos
= stc
->m_hScrollBar
->GetThumbPosition();
312 if ((sbMax
!= horizEnd
) || (sbThumb
!= pageWidth
) || (sbPos
!= 0)) {
313 stc
->m_hScrollBar
->SetScrollbar(sbPos
, pageWidth
, horizEnd
, pageWidth
);
315 if (scrollWidth
< pageWidth
) {
316 HorizontalScrollTo(0);
325 void ScintillaWX::NotifyChange() {
330 void ScintillaWX::NotifyParent(SCNotification scn
) {
331 stc
->NotifyParent(&scn
);
336 void ScintillaWX::Copy() {
337 if (currentPos
!= anchor
) {
339 CopySelectionRange(&st
);
340 if (wxTheClipboard
->Open()) {
341 wxTheClipboard
->UsePrimarySelection(FALSE
);
342 wxString text
= stc2wx(st
.s
, st
.len
);
343 wxTheClipboard
->SetData(new wxTextDataObject(text
));
344 wxTheClipboard
->Close();
350 void ScintillaWX::Paste() {
351 pdoc
->BeginUndoAction();
354 wxTextDataObject data
;
355 bool gotData
= FALSE
;
357 if (wxTheClipboard
->Open()) {
358 wxTheClipboard
->UsePrimarySelection(FALSE
);
359 gotData
= wxTheClipboard
->GetData(data
);
360 wxTheClipboard
->Close();
363 wxWX2MBbuf buf
= (wxWX2MBbuf
)wx2stc(data
.GetText());
364 int len
= strlen(buf
);
365 pdoc
->InsertString(currentPos
, buf
, len
);
366 SetEmptySelection(currentPos
+ len
);
369 pdoc
->EndUndoAction();
375 bool ScintillaWX::CanPaste() {
376 bool canPaste
= FALSE
;
379 if (Editor::CanPaste()) {
380 if ( (didOpen
= !wxTheClipboard
->IsOpened()) )
381 wxTheClipboard
->Open();
383 if (wxTheClipboard
->IsOpened()) {
384 wxTheClipboard
->UsePrimarySelection(FALSE
);
385 canPaste
= wxTheClipboard
->IsSupported(wxUSE_UNICODE
? wxDF_UNICODETEXT
: wxDF_TEXT
);
387 wxTheClipboard
->Close();
393 void ScintillaWX::CreateCallTipWindow(PRectangle
) {
394 if (! ct
.wCallTip
.Created() ) {
395 ct
.wCallTip
= new wxSTCCallTip(stc
, &ct
, this);
396 ct
.wDraw
= ct
.wCallTip
;
401 void ScintillaWX::AddToPopUp(const char *label
, int cmd
, bool enabled
) {
403 ((wxMenu
*)popup
.GetID())->AppendSeparator();
405 ((wxMenu
*)popup
.GetID())->Append(cmd
, stc2wx(label
));
408 ((wxMenu
*)popup
.GetID())->Enable(cmd
, enabled
);
412 // This is called by the Editor base class whenever something is selected
413 void ScintillaWX::ClaimSelection() {
415 // Until wxGTK is able to support using both the primary selection and the
416 // clipboard at the same time I think it causes more problems than it is
417 // worth to implement this method. Selecting text should not clear the
418 // clipboard. --Robin
420 // Put the selected text in the PRIMARY selection
421 if (currentPos
!= anchor
) {
423 CopySelectionRange(&st
);
424 if (wxTheClipboard
->Open()) {
425 wxTheClipboard
->UsePrimarySelection(TRUE
);
426 wxString text
= stc2wx(st
.s
, st
.len
);
427 wxTheClipboard
->SetData(new wxTextDataObject(text
));
428 wxTheClipboard
->UsePrimarySelection(FALSE
);
429 wxTheClipboard
->Close();
437 long ScintillaWX::DefWndProc(unsigned int /*iMessage*/, unsigned long /*wParam*/, long /*lParam*/) {
441 long ScintillaWX::WndProc(unsigned int iMessage
, unsigned long wParam
, long lParam
) {
443 case SCI_CALLTIPSHOW
: {
444 // NOTE: This is copied here from scintilla/src/ScintillaBase.cxx
445 // because of the little tweak that needs done below for wxGTK.
446 // When updating new versions double check that this is still
447 // needed, and that any new code there is copied here too.
448 Point pt
= LocationFromPosition(wParam
);
449 char* defn
= reinterpret_cast<char *>(lParam
);
450 AutoCompleteCancel();
451 pt
.y
+= vs
.lineHeight
;
452 PRectangle rc
= ct
.CallTipStart(currentPos
, pt
,
454 vs
.styles
[STYLE_DEFAULT
].fontName
,
455 vs
.styles
[STYLE_DEFAULT
].sizeZoomed
,
458 // If the call-tip window would be out of the client
459 // space, adjust so it displays above the text.
460 PRectangle rcClient
= GetClientRectangle();
461 if (rc
.bottom
> rcClient
.bottom
) {
463 int offset
= int(vs
.lineHeight
* 1.25) + rc
.Height();
465 int offset
= vs
.lineHeight
+ rc
.Height();
470 // Now display the window.
471 CreateCallTipWindow(rc
);
472 ct
.wCallTip
.SetPositionRelative(rc
, wMain
);
478 return ScintillaBase::WndProc(iMessage
, wParam
, lParam
);
485 //----------------------------------------------------------------------
488 void ScintillaWX::DoPaint(wxDC
* dc
, wxRect rect
) {
490 paintState
= painting
;
491 Surface
* surfaceWindow
= Surface::Allocate();
492 surfaceWindow
->Init(dc
, wMain
.GetID());
493 rcPaint
= PRectangleFromwxRect(rect
);
494 PRectangle rcClient
= GetClientRectangle();
495 paintingAllText
= rcPaint
.Contains(rcClient
);
498 ClipChildren(*dc
, rcPaint
);
499 Paint(surfaceWindow
, rcPaint
);
502 delete surfaceWindow
;
503 if (paintState
== paintAbandoned
) {
504 // Painting area was insufficient to cover new styling or brace highlight positions
507 paintState
= notPainting
;
511 void ScintillaWX::DoHScroll(int type
, int pos
) {
513 PRectangle rcText
= GetTextRectangle();
514 int pageWidth
= rcText
.Width() * 2 / 3;
515 if (type
== wxEVT_SCROLLWIN_LINEUP
|| type
== wxEVT_SCROLL_LINEUP
)
516 xPos
-= H_SCROLL_STEP
;
517 else if (type
== wxEVT_SCROLLWIN_LINEDOWN
|| type
== wxEVT_SCROLL_LINEDOWN
)
518 xPos
+= H_SCROLL_STEP
;
519 else if (type
== wxEVT_SCROLLWIN_PAGEUP
|| type
== wxEVT_SCROLL_PAGEUP
)
521 else if (type
== wxEVT_SCROLLWIN_PAGEDOWN
|| type
== wxEVT_SCROLL_PAGEDOWN
) {
523 if (xPos
> scrollWidth
- rcText
.Width()) {
524 xPos
= scrollWidth
- rcText
.Width();
527 else if (type
== wxEVT_SCROLLWIN_TOP
|| type
== wxEVT_SCROLL_TOP
)
529 else if (type
== wxEVT_SCROLLWIN_BOTTOM
|| type
== wxEVT_SCROLL_BOTTOM
)
531 else if (type
== wxEVT_SCROLLWIN_THUMBTRACK
|| type
== wxEVT_SCROLL_THUMBTRACK
)
534 HorizontalScrollTo(xPos
);
537 void ScintillaWX::DoVScroll(int type
, int pos
) {
538 int topLineNew
= topLine
;
539 if (type
== wxEVT_SCROLLWIN_LINEUP
|| type
== wxEVT_SCROLL_LINEUP
)
541 else if (type
== wxEVT_SCROLLWIN_LINEDOWN
|| type
== wxEVT_SCROLL_LINEDOWN
)
543 else if (type
== wxEVT_SCROLLWIN_PAGEUP
|| type
== wxEVT_SCROLL_PAGEUP
)
544 topLineNew
-= LinesToScroll();
545 else if (type
== wxEVT_SCROLLWIN_PAGEDOWN
|| type
== wxEVT_SCROLL_PAGEDOWN
)
546 topLineNew
+= LinesToScroll();
547 else if (type
== wxEVT_SCROLLWIN_TOP
|| type
== wxEVT_SCROLL_TOP
)
549 else if (type
== wxEVT_SCROLLWIN_BOTTOM
|| type
== wxEVT_SCROLL_BOTTOM
)
550 topLineNew
= MaxScrollPos();
551 else if (type
== wxEVT_SCROLLWIN_THUMBTRACK
|| type
== wxEVT_SCROLL_THUMBTRACK
)
554 ScrollTo(topLineNew
);
557 void ScintillaWX::DoMouseWheel(int rotation
, int delta
,
558 int linesPerAction
, int ctrlDown
,
559 bool isPageScroll
) {
560 int topLineNew
= topLine
;
563 if (ctrlDown
) { // Zoom the fonts if Ctrl key down
565 KeyCommand(SCI_ZOOMIN
);
568 KeyCommand(SCI_ZOOMOUT
);
571 else { // otherwise just scroll the window
574 wheelRotation
+= rotation
;
575 lines
= wheelRotation
/ delta
;
576 wheelRotation
-= lines
* delta
;
579 lines
= lines
* LinesOnScreen(); // lines is either +1 or -1
581 lines
*= linesPerAction
;
583 ScrollTo(topLineNew
);
589 void ScintillaWX::DoSize(int width
, int height
) {
590 // PRectangle rcClient(0,0,width,height);
591 // SetScrollBarsTo(rcClient);
596 void ScintillaWX::DoLoseFocus(){
597 SetFocusState(false);
600 void ScintillaWX::DoGainFocus(){
604 void ScintillaWX::DoSysColourChange() {
605 InvalidateStyleData();
608 void ScintillaWX::DoLeftButtonDown(Point pt
, unsigned int curTime
, bool shift
, bool ctrl
, bool alt
) {
609 ButtonDown(pt
, curTime
, shift
, ctrl
, alt
);
612 void ScintillaWX::DoLeftButtonUp(Point pt
, unsigned int curTime
, bool ctrl
) {
613 ButtonUp(pt
, curTime
, ctrl
);
616 void ScintillaWX::DoLeftButtonMove(Point pt
) {
620 void ScintillaWX::DoMiddleButtonUp(Point pt
) {
622 // Set the current position to the mouse click point and
623 // then paste in the PRIMARY selection, if any. wxGTK only.
624 int newPos
= PositionFromLocation(pt
);
625 MovePositionTo(newPos
, 0, 1);
627 pdoc
->BeginUndoAction();
628 wxTextDataObject data
;
629 bool gotData
= FALSE
;
630 if (wxTheClipboard
->Open()) {
631 wxTheClipboard
->UsePrimarySelection(TRUE
);
632 gotData
= wxTheClipboard
->GetData(data
);
633 wxTheClipboard
->UsePrimarySelection(FALSE
);
634 wxTheClipboard
->Close();
637 wxWX2MBbuf buf
= (wxWX2MBbuf
)wx2stc(data
.GetText());
638 int len
= strlen(buf
);
639 pdoc
->InsertString(currentPos
, buf
, len
);
640 SetEmptySelection(currentPos
+ len
);
642 pdoc
->EndUndoAction();
646 ShowCaretAtCurrentPosition();
647 EnsureCaretVisible();
652 void ScintillaWX::DoAddChar(int key
) {
657 wxWX2MBbuf buf
= (wxWX2MBbuf
)wx2stc(wszChars
);
658 AddCharUTF((char*)buf
.data(), strlen(buf
));
665 int ScintillaWX::DoKeyDown(int key
, bool shift
, bool ctrl
, bool alt
, bool* consumed
) {
666 #if defined(__WXGTK__) || defined(__WXMAC__)
667 // Ctrl chars (A-Z) end up with the wrong keycode on wxGTK...
668 if (ctrl
&& key
>= 1 && key
<= 26)
673 case WXK_DOWN
: key
= SCK_DOWN
; break;
674 case WXK_UP
: key
= SCK_UP
; break;
675 case WXK_LEFT
: key
= SCK_LEFT
; break;
676 case WXK_RIGHT
: key
= SCK_RIGHT
; break;
677 case WXK_HOME
: key
= SCK_HOME
; break;
678 case WXK_END
: key
= SCK_END
; break;
679 case WXK_PAGEUP
: // fall through
680 case WXK_PRIOR
: key
= SCK_PRIOR
; break;
681 case WXK_PAGEDOWN
: // fall through
682 case WXK_NEXT
: key
= SCK_NEXT
; break;
683 case WXK_DELETE
: key
= SCK_DELETE
; break;
684 case WXK_INSERT
: key
= SCK_INSERT
; break;
685 case WXK_ESCAPE
: key
= SCK_ESCAPE
; break;
686 case WXK_BACK
: key
= SCK_BACK
; break;
687 case WXK_TAB
: key
= SCK_TAB
; break;
688 case WXK_RETURN
: key
= SCK_RETURN
; break;
689 case WXK_ADD
: // fall through
690 case WXK_NUMPAD_ADD
: key
= SCK_ADD
; break;
691 case WXK_SUBTRACT
: // fall through
692 case WXK_NUMPAD_SUBTRACT
: key
= SCK_SUBTRACT
; break;
693 case WXK_DIVIDE
: // fall through
694 case WXK_NUMPAD_DIVIDE
: key
= SCK_DIVIDE
; break;
695 case WXK_CONTROL
: key
= 0; break;
696 case WXK_ALT
: key
= 0; break;
697 case WXK_SHIFT
: key
= 0; break;
698 case WXK_MENU
: key
= 0; break;
701 int rv
= KeyDown(key
, shift
, ctrl
, alt
, consumed
);
710 void ScintillaWX::DoCommand(int ID
) {
715 void ScintillaWX::DoContextMenu(Point pt
) {
716 if (displayPopupMenu
)
720 void ScintillaWX::DoOnListBox() {
721 AutoCompleteCompleted();
724 //----------------------------------------------------------------------
726 #if wxUSE_DRAG_AND_DROP
727 bool ScintillaWX::DoDropText(long x
, long y
, const wxString
& data
) {
728 SetDragPosition(invalidPosition
);
730 // Send an event to allow the drag details to be changed
731 wxStyledTextEvent
evt(wxEVT_STC_DO_DROP
, stc
->GetId());
732 evt
.SetEventObject(stc
);
733 evt
.SetDragResult(dragResult
);
736 evt
.SetPosition(PositionFromLocation(Point(x
,y
)));
737 evt
.SetDragText(data
);
738 stc
->GetEventHandler()->ProcessEvent(evt
);
740 dragResult
= evt
.GetDragResult();
741 if (dragResult
== wxDragMove
|| dragResult
== wxDragCopy
) {
742 DropAt(evt
.GetPosition(),
743 wx2stc(evt
.GetDragText()),
744 dragResult
== wxDragMove
,
745 FALSE
); // TODO: rectangular?
752 wxDragResult
ScintillaWX::DoDragEnter(wxCoord x
, wxCoord y
, wxDragResult def
) {
758 wxDragResult
ScintillaWX::DoDragOver(wxCoord x
, wxCoord y
, wxDragResult def
) {
759 SetDragPosition(PositionFromLocation(Point(x
, y
)));
761 // Send an event to allow the drag result to be changed
762 wxStyledTextEvent
evt(wxEVT_STC_DRAG_OVER
, stc
->GetId());
763 evt
.SetEventObject(stc
);
764 evt
.SetDragResult(def
);
767 evt
.SetPosition(PositionFromLocation(Point(x
,y
)));
768 stc
->GetEventHandler()->ProcessEvent(evt
);
770 dragResult
= evt
.GetDragResult();
775 void ScintillaWX::DoDragLeave() {
776 SetDragPosition(invalidPosition
);
779 //----------------------------------------------------------------------
781 // Redraw all of text area. This paint will not be abandoned.
782 void ScintillaWX::FullPaint() {
783 paintState
= painting
;
784 rcPaint
= GetClientRectangle();
785 paintingAllText
= true;
787 Surface
* surfaceWindow
= Surface::Allocate();
788 surfaceWindow
->Init(&dc
, wMain
.GetID());
791 ClipChildren(dc
, rcPaint
);
792 Paint(surfaceWindow
, rcPaint
);
795 delete surfaceWindow
;
796 paintState
= notPainting
;
800 void ScintillaWX::DoScrollToLine(int line
) {
805 void ScintillaWX::DoScrollToColumn(int column
) {
806 HorizontalScrollTo(column
* vs
.spaceWidth
);
809 void ScintillaWX::ClipChildren(wxDC
& dc
, PRectangle rect
) {
811 wxRegion
rgn(wxRectFromPRectangle(rect
));
813 wxRect childRect
= ((wxWindow
*)ac
.lb
->GetID())->GetRect();
814 rgn
.Subtract(childRect
);
816 if (ct
.inCallTipMode
) {
817 wxRect childRect
= ((wxWindow
*)ct
.wCallTip
.GetID())->GetRect();
818 rgn
.Subtract(childRect
);
821 dc
.SetClippingRegion(rgn
);
826 //----------------------------------------------------------------------
827 //----------------------------------------------------------------------