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 licence
15 /////////////////////////////////////////////////////////////////////////////
17 #ifndef __ScintillaWX_h__
18 #define __ScintillaWX_h__
21 //----------------------------------------------------------------------
29 #include "SplitVector.h"
30 #include "Partitioning.h"
31 #include "RunStyles.h"
32 #include "Scintilla.h"
33 #include "ScintillaWidget.h"
40 #include "ContractionState.h"
42 #include "CellBuffer.h"
45 #include "Indicator.h"
47 #include "LineMarker.h"
49 #include "AutoComplete.h"
50 #include "ViewStyle.h"
51 #include "CharClassify.h"
52 #include "Decoration.h"
54 #include "Selection.h"
55 #include "PositionCache.h"
57 #include "PropSetSimple.h"
58 #include "ScintillaBase.h"
61 #include "wx/msw/wrapwin.h" // HBITMAP
63 #if wxUSE_DRAG_AND_DROP
67 //----------------------------------------------------------------------
70 class WXDLLIMPEXP_FWD_CORE wxDC
;
71 class WXDLLIMPEXP_FWD_STC wxStyledTextCtrl
; // forward
75 //----------------------------------------------------------------------
78 #if wxUSE_DRAG_AND_DROP
79 class wxSTCDropTarget
: public wxTextDropTarget
{
81 void SetScintilla(ScintillaWX
* swx
) {
85 bool OnDropText(wxCoord x
, wxCoord y
, const wxString
& data
);
86 wxDragResult
OnEnter(wxCoord x
, wxCoord y
, wxDragResult def
);
87 wxDragResult
OnDragOver(wxCoord x
, wxCoord y
, wxDragResult def
);
95 //----------------------------------------------------------------------
97 class ScintillaWX
: public ScintillaBase
{
100 ScintillaWX(wxStyledTextCtrl
* win
);
103 // base class virtuals
104 virtual void Initialise();
105 virtual void Finalise();
106 virtual void StartDrag();
107 virtual bool SetIdle(bool on
);
108 virtual void SetTicking(bool on
);
109 virtual void SetMouseCapture(bool on
);
110 virtual bool HaveMouseCapture();
111 virtual void ScrollText(int linesToMove
);
112 virtual void SetVerticalScrollPos();
113 virtual void SetHorizontalScrollPos();
114 virtual bool ModifyScrollBars(int nMax
, int nPage
);
116 virtual void Paste();
117 virtual void CopyToClipboard(const SelectionText
&selectedText
);
119 virtual void CreateCallTipWindow(PRectangle rc
);
120 virtual void AddToPopUp(const char *label
, int cmd
= 0, bool enabled
= true);
121 virtual void ClaimSelection();
123 virtual sptr_t
DefWndProc(unsigned int iMessage
,
126 virtual sptr_t
WndProc(unsigned int iMessage
,
130 virtual void NotifyChange();
131 virtual void NotifyParent(SCNotification scn
);
133 virtual void CancelModes();
135 virtual void UpdateSystemCaret();
138 void DoPaint(wxDC
* dc
, wxRect rect
);
139 void DoHScroll(int type
, int pos
);
140 void DoVScroll(int type
, int pos
);
141 void DoSize(int width
, int height
);
144 void DoSysColourChange();
145 void DoLeftButtonDown(Point pt
, unsigned int curTime
, bool shift
, bool ctrl
, bool alt
);
146 void DoLeftButtonUp(Point pt
, unsigned int curTime
, bool ctrl
);
147 void DoLeftButtonMove(Point pt
);
148 void DoMiddleButtonUp(Point pt
);
149 void DoMouseWheel(int rotation
, int delta
, int linesPerAction
, int ctrlDown
, bool isPageScroll
);
150 void DoAddChar(int key
);
151 int DoKeyDown(const wxKeyEvent
& event
, bool* consumed
);
152 void DoTick() { Tick(); }
153 void DoOnIdle(wxIdleEvent
& evt
);
155 #if wxUSE_DRAG_AND_DROP
156 bool DoDropText(long x
, long y
, const wxString
& data
);
157 wxDragResult
DoDragEnter(wxCoord x
, wxCoord y
, wxDragResult def
);
158 wxDragResult
DoDragOver(wxCoord x
, wxCoord y
, wxDragResult def
);
162 void DoCommand(int ID
);
163 void DoContextMenu(Point pt
);
170 bool GetHideSelection() { return hideSelection
; }
171 void DoScrollToLine(int line
);
172 void DoScrollToColumn(int column
);
173 void ClipChildren(wxDC
& dc
, PRectangle rect
);
174 void SetUseAntiAliasing(bool useAA
);
175 bool GetUseAntiAliasing();
180 wxStyledTextCtrl
* stc
;
182 #if wxUSE_DRAG_AND_DROP
183 wxSTCDropTarget
* dropTarget
;
184 wxDragResult dragResult
;
189 // For use in creating a system caret
190 bool HasCaretSizeChanged();
191 bool CreateSystemCaret();
192 bool DestroySystemCaret();
194 HBITMAP sysCaretBitmap
;
199 friend class wxSTCCallTip
;
202 //----------------------------------------------------------------------