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__
20 //----------------------------------------------------------------------
29 #include "Scintilla.h"
37 #include "ContractionState.h"
39 #include "CellBuffer.h"
42 #include "Indicator.h"
43 #include "LineMarker.h"
45 #include "ViewStyle.h"
46 #include "AutoComplete.h"
49 #include "ScintillaBase.h"
52 #include <wx/dataobj.h>
53 #include <wx/clipbrd.h>
56 //----------------------------------------------------------------------
58 #ifdef WXMAKINGDLL_STC
59 #define WXDLLIMPEXP_STC WXEXPORT
60 #elif defined(WXUSINGDLL)
61 #define WXDLLIMPEXP_STC WXIMPORT
62 #else // not making nor using DLL
63 #define WXDLLIMPEXP_STC
66 class WXDLLIMPEXP_STC wxStyledTextCtrl
; // forward
70 //----------------------------------------------------------------------
73 #if wxUSE_DRAG_AND_DROP
74 class wxSTCDropTarget
: public wxTextDropTarget
{
76 void SetScintilla(ScintillaWX
* swx
) {
80 bool OnDropText(wxCoord x
, wxCoord y
, const wxString
& data
);
81 wxDragResult
OnEnter(wxCoord x
, wxCoord y
, wxDragResult def
);
82 wxDragResult
OnDragOver(wxCoord x
, wxCoord y
, wxDragResult def
);
90 //----------------------------------------------------------------------
92 class ScintillaWX
: public ScintillaBase
{
95 ScintillaWX(wxStyledTextCtrl
* win
);
98 // base class virtuals
99 virtual void Initialise();
100 virtual void Finalise();
101 virtual void StartDrag();
102 virtual bool SetIdle(bool on
);
103 virtual void SetTicking(bool on
);
104 virtual void SetMouseCapture(bool on
);
105 virtual bool HaveMouseCapture();
106 virtual void ScrollText(int linesToMove
);
107 virtual void SetVerticalScrollPos();
108 virtual void SetHorizontalScrollPos();
109 virtual bool ModifyScrollBars(int nMax
, int nPage
);
111 virtual void Paste();
112 virtual void CopyToClipboard(const SelectionText
&selectedText
);
114 virtual void CreateCallTipWindow(PRectangle rc
);
115 virtual void AddToPopUp(const char *label
, int cmd
= 0, bool enabled
= true);
116 virtual void ClaimSelection();
118 virtual long DefWndProc(unsigned int iMessage
,
119 unsigned long wParam
,
121 virtual long WndProc(unsigned int iMessage
,
122 unsigned long wParam
,
125 virtual void NotifyChange();
126 virtual void NotifyParent(SCNotification scn
);
128 virtual void CancelModes();
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
);
148 #if wxUSE_DRAG_AND_DROP
149 bool DoDropText(long x
, long y
, const wxString
& data
);
150 wxDragResult
DoDragEnter(wxCoord x
, wxCoord y
, wxDragResult def
);
151 wxDragResult
DoDragOver(wxCoord x
, wxCoord y
, wxDragResult def
);
155 void DoCommand(int ID
);
156 void DoContextMenu(Point pt
);
163 bool GetHideSelection() { return hideSelection
; }
164 void DoScrollToLine(int line
);
165 void DoScrollToColumn(int column
);
166 void ClipChildren(wxDC
& dc
, PRectangle rect
);
167 void SetUseAntiAliasing(bool useAA
);
168 bool GetUseAntiAliasing();
173 wxStyledTextCtrl
* stc
;
175 #if wxUSE_DRAG_AND_DROP
176 wxSTCDropTarget
* dropTarget
;
177 wxDragResult dragResult
;
182 friend class wxSTCCallTip
;
185 //----------------------------------------------------------------------