]>
Commit | Line | Data |
---|---|---|
9ce192d4 RD |
1 | //////////////////////////////////////////////////////////////////////////// |
2 | // Name: ScintillaWX.h | |
3 | // Purpose: A wxWindows 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. | |
8 | // | |
9 | // Author: Robin Dunn | |
10 | // | |
11 | // Created: 13-Jan-2000 | |
12 | // RCS-ID: $Id$ | |
13 | // Copyright: (c) 2000 by Total Control Software | |
14 | // Licence: wxWindows license | |
15 | ///////////////////////////////////////////////////////////////////////////// | |
16 | ||
17 | #ifndef __ScintillaWX_h__ | |
18 | #define __ScintillaWX_h__ | |
19 | ||
20 | //---------------------------------------------------------------------- | |
21 | ||
1a2fb4cd RD |
22 | #include <ctype.h> |
23 | #include <stdlib.h> | |
24 | #include <stdio.h> | |
25 | #include <string.h> | |
26 | ||
9ce192d4 RD |
27 | #include "Platform.h" |
28 | ||
29 | #include "Scintilla.h" | |
9e730a78 | 30 | #include "XPM.h" |
9ce192d4 RD |
31 | #ifdef SCI_LEXER |
32 | #include "SciLexer.h" | |
33 | #include "PropSet.h" | |
34 | #include "Accessor.h" | |
35 | #include "KeyWords.h" | |
36 | #endif | |
37 | #include "ContractionState.h" | |
38 | #include "SVector.h" | |
39 | #include "CellBuffer.h" | |
40 | #include "CallTip.h" | |
41 | #include "KeyMap.h" | |
42 | #include "Indicator.h" | |
43 | #include "LineMarker.h" | |
44 | #include "Style.h" | |
45 | #include "ViewStyle.h" | |
46 | #include "AutoComplete.h" | |
47 | #include "Document.h" | |
48 | #include "Editor.h" | |
49 | #include "ScintillaBase.h" | |
50 | ||
51 | #include <wx/wx.h> | |
52 | #include <wx/dataobj.h> | |
53 | #include <wx/clipbrd.h> | |
54 | #include <wx/dnd.h> | |
55 | ||
56 | //---------------------------------------------------------------------- | |
57 | ||
58 | class wxStyledTextCtrl; // forward | |
59 | class ScintillaWX; | |
60 | ||
61 | ||
62 | //---------------------------------------------------------------------- | |
63 | // Helper classes | |
64 | ||
1bc32508 | 65 | #if wxUSE_DRAG_AND_DROP |
9ce192d4 RD |
66 | class wxSTCDropTarget : public wxTextDropTarget { |
67 | public: | |
68 | void SetScintilla(ScintillaWX* swx) { | |
69 | this->swx = swx; | |
70 | } | |
71 | ||
72 | bool OnDropText(wxCoord x, wxCoord y, const wxString& data); | |
73 | wxDragResult OnEnter(wxCoord x, wxCoord y, wxDragResult def); | |
74 | wxDragResult OnDragOver(wxCoord x, wxCoord y, wxDragResult def); | |
75 | void OnLeave(); | |
76 | ||
77 | private: | |
78 | ScintillaWX* swx; | |
79 | }; | |
1bc32508 | 80 | #endif |
9ce192d4 RD |
81 | |
82 | //---------------------------------------------------------------------- | |
83 | ||
84 | class ScintillaWX : public ScintillaBase { | |
85 | public: | |
86 | ||
87 | ScintillaWX(wxStyledTextCtrl* win); | |
88 | ~ScintillaWX(); | |
89 | ||
90 | // base class virtuals | |
91 | virtual void Initialise(); | |
92 | virtual void Finalise(); | |
93 | virtual void StartDrag(); | |
94 | virtual void SetTicking(bool on); | |
95 | virtual void SetMouseCapture(bool on); | |
96 | virtual bool HaveMouseCapture(); | |
97 | virtual void ScrollText(int linesToMove); | |
98 | virtual void SetVerticalScrollPos(); | |
99 | virtual void SetHorizontalScrollPos(); | |
100 | virtual bool ModifyScrollBars(int nMax, int nPage); | |
101 | virtual void Copy(); | |
102 | virtual void Paste(); | |
e14d10b0 RD |
103 | virtual void CopyToClipboard(const SelectionText &selectedText); |
104 | ||
9ce192d4 RD |
105 | virtual void CreateCallTipWindow(PRectangle rc); |
106 | virtual void AddToPopUp(const char *label, int cmd = 0, bool enabled = true); | |
107 | virtual void ClaimSelection(); | |
108 | ||
d134f170 RD |
109 | virtual long DefWndProc(unsigned int iMessage, |
110 | unsigned long wParam, | |
111 | long lParam); | |
112 | virtual long WndProc(unsigned int iMessage, | |
113 | unsigned long wParam, | |
114 | long lParam); | |
9ce192d4 RD |
115 | |
116 | virtual void NotifyChange(); | |
117 | virtual void NotifyParent(SCNotification scn); | |
118 | ||
119 | ||
120 | // Event delegates | |
121 | void DoPaint(wxDC* dc, wxRect rect); | |
122 | void DoHScroll(int type, int pos); | |
123 | void DoVScroll(int type, int pos); | |
124 | void DoSize(int width, int height); | |
125 | void DoLoseFocus(); | |
126 | void DoGainFocus(); | |
127 | void DoSysColourChange(); | |
2b5f62a0 VZ |
128 | void DoLeftButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt); |
129 | void DoLeftButtonUp(Point pt, unsigned int curTime, bool ctrl); | |
130 | void DoLeftButtonMove(Point pt); | |
131 | void DoMiddleButtonUp(Point pt); | |
9b9337da | 132 | void DoMouseWheel(int rotation, int delta, int linesPerAction, int ctrlDown, bool isPageScroll); |
10ef30eb | 133 | void DoAddChar(int key); |
65ec6247 | 134 | int DoKeyDown(int key, bool shift, bool ctrl, bool alt, bool* consumed); |
9ce192d4 RD |
135 | void DoTick() { Tick(); } |
136 | ||
1bc32508 | 137 | #if wxUSE_DRAG_AND_DROP |
9ce192d4 RD |
138 | bool DoDropText(long x, long y, const wxString& data); |
139 | wxDragResult DoDragEnter(wxCoord x, wxCoord y, wxDragResult def); | |
140 | wxDragResult DoDragOver(wxCoord x, wxCoord y, wxDragResult def); | |
141 | void DoDragLeave(); | |
1bc32508 | 142 | #endif |
9ce192d4 RD |
143 | |
144 | void DoCommand(int ID); | |
145 | void DoContextMenu(Point pt); | |
f6bcfd97 | 146 | void DoOnListBox(); |
9ce192d4 RD |
147 | |
148 | ||
149 | // helpers | |
150 | void FullPaint(); | |
151 | bool CanPaste(); | |
152 | bool GetHideSelection() { return hideSelection; } | |
153 | void DoScrollToLine(int line); | |
154 | void DoScrollToColumn(int column); | |
9e730a78 | 155 | void ClipChildren(wxDC& dc, PRectangle rect); |
9ce192d4 RD |
156 | |
157 | private: | |
9e730a78 | 158 | bool capturedMouse; |
9ce192d4 RD |
159 | wxStyledTextCtrl* stc; |
160 | ||
1bc32508 | 161 | #if wxUSE_DRAG_AND_DROP |
9eb662e9 | 162 | wxSTCDropTarget* dropTarget; |
9ce192d4 | 163 | wxDragResult dragResult; |
1bc32508 | 164 | #endif |
37d62433 | 165 | int wheelRotation; |
9e730a78 RD |
166 | |
167 | ||
168 | friend class wxSTCCallTip; | |
9ce192d4 RD |
169 | }; |
170 | ||
171 | //---------------------------------------------------------------------- | |
172 | #endif |