1 ////////////////////////////////////////////////////////////////////////////
3 // Purpose: A wxWidgets implementation of Scintilla. A class derived
4 // from ScintillaBase that uses the "wx platform" defined in
5 // PlatWX.cpp. 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 /////////////////////////////////////////////////////////////////////////////
17 #ifndef __ScintillaWX_h__
18 #define __ScintillaWX_h__
21 //----------------------------------------------------------------------
30 #include "Scintilla.h"
31 #include "CharClassify.h"
39 #include "ContractionState.h"
41 #include "CellBuffer.h"
44 #include "Indicator.h"
45 #include "LineMarker.h"
47 #include "ViewStyle.h"
48 #include "AutoComplete.h"
51 #include "ScintillaBase.h"
54 #include "wx/msw/wrapwin.h" // HBITMAP
56 #if wxUSE_DRAG_AND_DROP
60 //----------------------------------------------------------------------
63 class WXDLLIMPEXP_FWD_CORE wxDC
;
64 class WXDLLIMPEXP_FWD_STC wxStyledTextCtrl
; // forward
68 //----------------------------------------------------------------------
71 #if wxUSE_DRAG_AND_DROP
72 class wxSTCDropTarget
: public wxTextDropTarget
{
74 void SetScintilla(ScintillaWX
* swx
) {
78 bool OnDropText(wxCoord x
, wxCoord y
, const wxString
& data
);
79 wxDragResult
OnEnter(wxCoord x
, wxCoord y
, wxDragResult def
);
80 wxDragResult
OnDragOver(wxCoord x
, wxCoord y
, wxDragResult def
);
88 //----------------------------------------------------------------------
90 class ScintillaWX
: public ScintillaBase
{
93 ScintillaWX(wxStyledTextCtrl
* win
);
96 // base class virtuals
97 virtual void Initialise();
98 virtual void Finalise();
99 virtual void StartDrag();
100 virtual bool SetIdle(bool on
);
101 virtual void SetTicking(bool on
);
102 virtual void SetMouseCapture(bool on
);
103 virtual bool HaveMouseCapture();
104 virtual void ScrollText(int linesToMove
);
105 virtual void SetVerticalScrollPos();
106 virtual void SetHorizontalScrollPos();
107 virtual bool ModifyScrollBars(int nMax
, int nPage
);
109 virtual void Paste();
110 virtual void CopyToClipboard(const SelectionText
&selectedText
);
112 virtual void CreateCallTipWindow(PRectangle rc
);
113 virtual void AddToPopUp(const char *label
, int cmd
= 0, bool enabled
= true);
114 virtual void ClaimSelection();
116 virtual sptr_t
DefWndProc(unsigned int iMessage
,
119 virtual sptr_t
WndProc(unsigned int iMessage
,
123 virtual void NotifyChange();
124 virtual void NotifyParent(SCNotification scn
);
126 virtual void CancelModes();
128 virtual void UpdateSystemCaret();
131 void DoPaint(wxDC
* dc
, wxRect rect
);
132 void DoHScroll(int type
, int pos
);
133 void DoVScroll(int type
, int pos
);
134 void DoSize(int width
, int height
);
137 void DoSysColourChange();
138 void DoLeftButtonDown(Point pt
, unsigned int curTime
, bool shift
, bool ctrl
, bool alt
);
139 void DoLeftButtonUp(Point pt
, unsigned int curTime
, bool ctrl
);
140 void DoLeftButtonMove(Point pt
);
141 void DoMiddleButtonUp(Point pt
);
142 void DoMouseWheel(int rotation
, int delta
, int linesPerAction
, int ctrlDown
, bool isPageScroll
);
143 void DoAddChar(int key
);
144 int DoKeyDown(const wxKeyEvent
& event
, bool* consumed
);
145 void DoTick() { Tick(); }
146 void DoOnIdle(wxIdleEvent
& evt
);
149 #if wxUSE_DRAG_AND_DROP
150 bool DoDropText(long x
, long y
, const wxString
& data
);
151 wxDragResult
DoDragEnter(wxCoord x
, wxCoord y
, wxDragResult def
);
152 wxDragResult
DoDragOver(wxCoord x
, wxCoord y
, wxDragResult def
);
156 void DoCommand(int ID
);
157 void DoContextMenu(Point pt
);
164 bool GetHideSelection() { return hideSelection
; }
165 void DoScrollToLine(int line
);
166 void DoScrollToColumn(int column
);
167 void ClipChildren(wxDC
& dc
, PRectangle rect
);
168 void SetUseAntiAliasing(bool useAA
);
169 bool GetUseAntiAliasing();
174 wxStyledTextCtrl
* stc
;
176 #if wxUSE_DRAG_AND_DROP
177 wxSTCDropTarget
* dropTarget
;
178 wxDragResult dragResult
;
179 wxTimer
* startDragTimer
;
184 // For use in creating a system caret
185 bool HasCaretSizeChanged();
186 bool CreateSystemCaret();
187 bool DestroySystemCaret();
189 HBITMAP sysCaretBitmap
;
194 friend class wxSTCCallTip
;
197 //----------------------------------------------------------------------