]> git.saurik.com Git - wxWidgets.git/blob - src/stc/ScintillaWX.h
Remove some items from the Recent additions list
[wxWidgets.git] / src / stc / ScintillaWX.h
1 ////////////////////////////////////////////////////////////////////////////
2 // Name: 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.
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
22 #include <ctype.h>
23 #include <stdlib.h>
24 #include <stdio.h>
25 #include <string.h>
26
27 #include "Platform.h"
28
29 #include "Scintilla.h"
30 #include "CharClassify.h"
31 #include "XPM.h"
32 #ifdef SCI_LEXER
33 #include "SciLexer.h"
34 #include "PropSet.h"
35 #include "Accessor.h"
36 #include "KeyWords.h"
37 #endif
38 #include "ContractionState.h"
39 #include "SVector.h"
40 #include "CellBuffer.h"
41 #include "CallTip.h"
42 #include "KeyMap.h"
43 #include "Indicator.h"
44 #include "LineMarker.h"
45 #include "Style.h"
46 #include "ViewStyle.h"
47 #include "AutoComplete.h"
48 #include "Document.h"
49 #include "Editor.h"
50 #include "ScintillaBase.h"
51
52 //----------------------------------------------------------------------
53
54 #ifdef WXMAKINGDLL_STC
55 #define WXDLLIMPEXP_STC WXEXPORT
56 #elif defined(WXUSINGDLL)
57 #define WXDLLIMPEXP_STC WXIMPORT
58 #else // not making nor using DLL
59 #define WXDLLIMPEXP_STC
60 #endif
61
62 class WXDLLIMPEXP_STC wxStyledTextCtrl; // forward
63 class ScintillaWX;
64
65
66 //----------------------------------------------------------------------
67 // Helper classes
68
69 #if wxUSE_DRAG_AND_DROP
70 class wxSTCDropTarget : public wxTextDropTarget {
71 public:
72 void SetScintilla(ScintillaWX* swx) {
73 this->swx = swx;
74 }
75
76 bool OnDropText(wxCoord x, wxCoord y, const wxString& data);
77 wxDragResult OnEnter(wxCoord x, wxCoord y, wxDragResult def);
78 wxDragResult OnDragOver(wxCoord x, wxCoord y, wxDragResult def);
79 void OnLeave();
80
81 private:
82 ScintillaWX* swx;
83 };
84 #endif
85
86 //----------------------------------------------------------------------
87
88 class ScintillaWX : public ScintillaBase {
89 public:
90
91 ScintillaWX(wxStyledTextCtrl* win);
92 ~ScintillaWX();
93
94 // base class virtuals
95 virtual void Initialise();
96 virtual void Finalise();
97 virtual void StartDrag();
98 virtual bool SetIdle(bool on);
99 virtual void SetTicking(bool on);
100 virtual void SetMouseCapture(bool on);
101 virtual bool HaveMouseCapture();
102 virtual void ScrollText(int linesToMove);
103 virtual void SetVerticalScrollPos();
104 virtual void SetHorizontalScrollPos();
105 virtual bool ModifyScrollBars(int nMax, int nPage);
106 virtual void Copy();
107 virtual void Paste();
108 virtual void CopyToClipboard(const SelectionText &selectedText);
109
110 virtual void CreateCallTipWindow(PRectangle rc);
111 virtual void AddToPopUp(const char *label, int cmd = 0, bool enabled = true);
112 virtual void ClaimSelection();
113
114 virtual long DefWndProc(unsigned int iMessage,
115 unsigned long wParam,
116 long lParam);
117 virtual long WndProc(unsigned int iMessage,
118 unsigned long wParam,
119 long lParam);
120
121 virtual void NotifyChange();
122 virtual void NotifyParent(SCNotification scn);
123
124 virtual void CancelModes();
125
126 virtual void UpdateSystemCaret();
127
128 // Event delegates
129 void DoPaint(wxDC* dc, wxRect rect);
130 void DoHScroll(int type, int pos);
131 void DoVScroll(int type, int pos);
132 void DoSize(int width, int height);
133 void DoLoseFocus();
134 void DoGainFocus();
135 void DoSysColourChange();
136 void DoLeftButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt);
137 void DoLeftButtonUp(Point pt, unsigned int curTime, bool ctrl);
138 void DoLeftButtonMove(Point pt);
139 void DoMiddleButtonUp(Point pt);
140 void DoMouseWheel(int rotation, int delta, int linesPerAction, int ctrlDown, bool isPageScroll);
141 void DoAddChar(int key);
142 int DoKeyDown(const wxKeyEvent& event, bool* consumed);
143 void DoTick() { Tick(); }
144 void DoOnIdle(wxIdleEvent& evt);
145 void DoStartDrag();
146
147 #if wxUSE_DRAG_AND_DROP
148 bool DoDropText(long x, long y, const wxString& data);
149 wxDragResult DoDragEnter(wxCoord x, wxCoord y, wxDragResult def);
150 wxDragResult DoDragOver(wxCoord x, wxCoord y, wxDragResult def);
151 void DoDragLeave();
152 #endif
153
154 void DoCommand(int ID);
155 void DoContextMenu(Point pt);
156 void DoOnListBox();
157
158
159 // helpers
160 void FullPaint();
161 bool CanPaste();
162 bool GetHideSelection() { return hideSelection; }
163 void DoScrollToLine(int line);
164 void DoScrollToColumn(int column);
165 void ClipChildren(wxDC& dc, PRectangle rect);
166 void SetUseAntiAliasing(bool useAA);
167 bool GetUseAntiAliasing();
168
169 private:
170 bool capturedMouse;
171 bool focusEvent;
172 wxStyledTextCtrl* stc;
173
174 #if wxUSE_DRAG_AND_DROP
175 wxSTCDropTarget* dropTarget;
176 wxDragResult dragResult;
177 wxTimer* startDragTimer;
178 #endif
179
180 int wheelRotation;
181
182 // For use in creating a system caret
183 bool HasCaretSizeChanged();
184 bool CreateSystemCaret();
185 bool DestroySystemCaret();
186 #ifdef __WXMSW__
187 HBITMAP sysCaretBitmap;
188 int sysCaretWidth;
189 int sysCaretHeight;
190 #endif
191
192 friend class wxSTCCallTip;
193 };
194
195 //----------------------------------------------------------------------
196 #endif