1 ////////////////////////////////////////////////////////////////////////////
2 // Name: src/stc/ScintillaWX.h
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 //----------------------------------------------------------------------
30 // These are all Scintilla headers
32 #include "SplitVector.h"
33 #include "Partitioning.h"
34 #include "RunStyles.h"
35 #include "Scintilla.h"
36 #include "ScintillaWidget.h"
39 #include "PropSetSimple.h"
41 #include "LexerModule.h"
42 #include "LexAccessor.h"
46 #include "ContractionState.h"
48 #include "CellBuffer.h"
51 #include "Indicator.h"
53 #include "LineMarker.h"
55 #include "AutoComplete.h"
56 #include "ViewStyle.h"
57 #include "CharClassify.h"
58 #include "Decoration.h"
60 #include "Selection.h"
61 #include "PositionCache.h"
63 #include "PropSetSimple.h"
64 #include "ScintillaBase.h"
67 #include "wx/msw/wrapwin.h" // HBITMAP
69 #if wxUSE_DRAG_AND_DROP
73 //----------------------------------------------------------------------
76 class WXDLLIMPEXP_FWD_CORE wxDC
;
77 class WXDLLIMPEXP_FWD_STC wxStyledTextCtrl
; // forward
81 //----------------------------------------------------------------------
84 #if wxUSE_DRAG_AND_DROP
85 class wxSTCDropTarget
: public wxTextDropTarget
{
87 void SetScintilla(ScintillaWX
* swx
) {
91 bool OnDropText(wxCoord x
, wxCoord y
, const wxString
& data
);
92 wxDragResult
OnEnter(wxCoord x
, wxCoord y
, wxDragResult def
);
93 wxDragResult
OnDragOver(wxCoord x
, wxCoord y
, wxDragResult def
);
101 //----------------------------------------------------------------------
103 class ScintillaWX
: public ScintillaBase
{
106 ScintillaWX(wxStyledTextCtrl
* win
);
109 // base class virtuals
110 virtual void Initialise();
111 virtual void Finalise();
112 virtual void StartDrag();
113 virtual bool SetIdle(bool on
);
114 virtual void SetTicking(bool on
);
115 virtual void SetMouseCapture(bool on
);
116 virtual bool HaveMouseCapture();
117 virtual void ScrollText(int linesToMove
);
118 virtual void SetVerticalScrollPos();
119 virtual void SetHorizontalScrollPos();
120 virtual bool ModifyScrollBars(int nMax
, int nPage
);
122 virtual void Paste();
123 virtual void CopyToClipboard(const SelectionText
&selectedText
);
125 virtual void CreateCallTipWindow(PRectangle rc
);
126 virtual void AddToPopUp(const char *label
, int cmd
= 0, bool enabled
= true);
127 virtual void ClaimSelection();
129 virtual sptr_t
DefWndProc(unsigned int iMessage
,
132 virtual sptr_t
WndProc(unsigned int iMessage
,
136 virtual void NotifyChange();
137 virtual void NotifyParent(SCNotification scn
);
139 virtual void CancelModes();
141 virtual void UpdateSystemCaret();
144 void DoPaint(wxDC
* dc
, wxRect rect
);
145 void DoHScroll(int type
, int pos
);
146 void DoVScroll(int type
, int pos
);
147 void DoSize(int width
, int height
);
150 void DoSysColourChange();
151 void DoLeftButtonDown(Point pt
, unsigned int curTime
, bool shift
, bool ctrl
, bool alt
);
152 void DoLeftButtonUp(Point pt
, unsigned int curTime
, bool ctrl
);
153 void DoLeftButtonMove(Point pt
);
154 void DoMiddleButtonUp(Point pt
);
155 void DoMouseWheel(int rotation
, int delta
, int linesPerAction
, int ctrlDown
, bool isPageScroll
);
156 void DoAddChar(int key
);
157 int DoKeyDown(const wxKeyEvent
& event
, bool* consumed
);
158 void DoTick() { Tick(); }
159 void DoOnIdle(wxIdleEvent
& evt
);
161 #if wxUSE_DRAG_AND_DROP
162 bool DoDropText(long x
, long y
, const wxString
& data
);
163 wxDragResult
DoDragEnter(wxCoord x
, wxCoord y
, wxDragResult def
);
164 wxDragResult
DoDragOver(wxCoord x
, wxCoord y
, wxDragResult def
);
168 void DoCommand(int ID
);
169 void DoContextMenu(Point pt
);
175 void FullPaintDC(wxDC
* dc
);
177 bool GetHideSelection() { return hideSelection
; }
178 void DoScrollToLine(int line
);
179 void DoScrollToColumn(int column
);
180 void ClipChildren(wxDC
& dc
, PRectangle rect
);
181 void SetUseAntiAliasing(bool useAA
);
182 bool GetUseAntiAliasing();
187 wxStyledTextCtrl
* stc
;
189 #if wxUSE_DRAG_AND_DROP
190 wxSTCDropTarget
* dropTarget
;
191 wxDragResult dragResult
;
196 // For use in creating a system caret
197 bool HasCaretSizeChanged();
198 bool CreateSystemCaret();
199 bool DestroySystemCaret();
201 HBITMAP sysCaretBitmap
;
206 friend class wxSTCCallTip
;
209 //----------------------------------------------------------------------