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
12 // Copyright: (c) 2000 by Total Control Software
13 // Licence: wxWindows licence
14 /////////////////////////////////////////////////////////////////////////////
16 #ifndef __ScintillaWX_h__
17 #define __ScintillaWX_h__
20 //----------------------------------------------------------------------
29 // These are all Scintilla headers
31 #include "SplitVector.h"
32 #include "Partitioning.h"
33 #include "RunStyles.h"
34 #include "Scintilla.h"
35 #include "ScintillaWidget.h"
38 #include "PropSetSimple.h"
40 #include "LexerModule.h"
41 #include "LexAccessor.h"
45 #include "ContractionState.h"
47 #include "CellBuffer.h"
50 #include "Indicator.h"
52 #include "LineMarker.h"
54 #include "AutoComplete.h"
55 #include "ViewStyle.h"
56 #include "CharClassify.h"
57 #include "Decoration.h"
59 #include "Selection.h"
60 #include "PositionCache.h"
62 #include "PropSetSimple.h"
63 #include "ScintillaBase.h"
66 #include "wx/msw/wrapwin.h" // HBITMAP
68 #if wxUSE_DRAG_AND_DROP
72 //----------------------------------------------------------------------
75 class WXDLLIMPEXP_FWD_CORE wxDC
;
76 class WXDLLIMPEXP_FWD_STC wxStyledTextCtrl
; // forward
80 //----------------------------------------------------------------------
83 #if wxUSE_DRAG_AND_DROP
84 class wxSTCDropTarget
: public wxTextDropTarget
{
86 void SetScintilla(ScintillaWX
* swx
) {
90 bool OnDropText(wxCoord x
, wxCoord y
, const wxString
& data
);
91 wxDragResult
OnEnter(wxCoord x
, wxCoord y
, wxDragResult def
);
92 wxDragResult
OnDragOver(wxCoord x
, wxCoord y
, wxDragResult def
);
100 //----------------------------------------------------------------------
102 class ScintillaWX
: public ScintillaBase
{
105 ScintillaWX(wxStyledTextCtrl
* win
);
108 // base class virtuals
109 virtual void Initialise();
110 virtual void Finalise();
111 virtual void StartDrag();
112 virtual bool SetIdle(bool on
);
113 virtual void SetTicking(bool on
);
114 virtual void SetMouseCapture(bool on
);
115 virtual bool HaveMouseCapture();
116 virtual void ScrollText(int linesToMove
);
117 virtual void SetVerticalScrollPos();
118 virtual void SetHorizontalScrollPos();
119 virtual bool ModifyScrollBars(int nMax
, int nPage
);
121 virtual void Paste();
122 virtual void CopyToClipboard(const SelectionText
&selectedText
);
124 virtual void CreateCallTipWindow(PRectangle rc
);
125 virtual void AddToPopUp(const char *label
, int cmd
= 0, bool enabled
= true);
126 virtual void ClaimSelection();
128 virtual sptr_t
DefWndProc(unsigned int iMessage
,
131 virtual sptr_t
WndProc(unsigned int iMessage
,
135 virtual void NotifyChange();
136 virtual void NotifyParent(SCNotification scn
);
138 virtual void CancelModes();
140 virtual void UpdateSystemCaret();
143 void DoPaint(wxDC
* dc
, wxRect rect
);
144 void DoHScroll(int type
, int pos
);
145 void DoVScroll(int type
, int pos
);
146 void DoSize(int width
, int height
);
149 void DoSysColourChange();
150 void DoLeftButtonDown(Point pt
, unsigned int curTime
, bool shift
, bool ctrl
, bool alt
);
151 void DoLeftButtonUp(Point pt
, unsigned int curTime
, bool ctrl
);
152 void DoLeftButtonMove(Point pt
);
153 void DoMiddleButtonUp(Point pt
);
154 void DoMouseWheel(wxMouseWheelAxis axis
, int rotation
, int delta
,
155 int linesPerAction
, int columnsPerAction
,
156 bool ctrlDown
, bool isPageScroll
);
157 void DoAddChar(int key
);
158 int DoKeyDown(const wxKeyEvent
& event
, bool* consumed
);
159 void DoTick() { Tick(); }
160 void DoOnIdle(wxIdleEvent
& evt
);
162 #if wxUSE_DRAG_AND_DROP
163 bool DoDropText(long x
, long y
, const wxString
& data
);
164 wxDragResult
DoDragEnter(wxCoord x
, wxCoord y
, wxDragResult def
);
165 wxDragResult
DoDragOver(wxCoord x
, wxCoord y
, wxDragResult def
);
169 void DoCommand(int ID
);
170 void DoContextMenu(Point pt
);
176 void FullPaintDC(wxDC
* dc
);
178 bool GetHideSelection() { return hideSelection
; }
179 void DoScrollToLine(int line
);
180 void DoScrollToColumn(int column
);
181 void ClipChildren(wxDC
& dc
, PRectangle rect
);
182 void SetUseAntiAliasing(bool useAA
);
183 bool GetUseAntiAliasing();
188 wxStyledTextCtrl
* stc
;
190 #if wxUSE_DRAG_AND_DROP
191 wxSTCDropTarget
* dropTarget
;
192 wxDragResult dragResult
;
198 // For use in creating a system caret
199 bool HasCaretSizeChanged();
200 bool CreateSystemCaret();
201 bool DestroySystemCaret();
203 HBITMAP sysCaretBitmap
;
208 friend class wxSTCCallTip
;
211 //----------------------------------------------------------------------