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