]> git.saurik.com Git - wxWidgets.git/blame - src/stc/ScintillaWX.h
Reflect changes in stc.cpp in stc.cpp.in from which it's generated.
[wxWidgets.git] / src / stc / ScintillaWX.h
CommitLineData
9ce192d4 1////////////////////////////////////////////////////////////////////////////
80fdcdb9 2// Name: src/stc/ScintillaWX.h
be5a51fb 3// Purpose: A wxWidgets implementation of Scintilla. A class derived
9ce192d4
RD
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
9ce192d4 12// Copyright: (c) 2000 by Total Control Software
526954c5 13// Licence: wxWindows licence
9ce192d4
RD
14/////////////////////////////////////////////////////////////////////////////
15
16#ifndef __ScintillaWX_h__
17#define __ScintillaWX_h__
c079af66 18#include "wx/defs.h"
9ce192d4
RD
19
20//----------------------------------------------------------------------
21
1a2fb4cd
RD
22#include <ctype.h>
23#include <stdlib.h>
24#include <stdio.h>
25#include <string.h>
9b01abb8
RD
26#include <vector>
27#include <map>
1a2fb4cd 28
9b01abb8 29// These are all Scintilla headers
9ce192d4 30#include "Platform.h"
9e96e16f
RD
31#include "SplitVector.h"
32#include "Partitioning.h"
33#include "RunStyles.h"
9ce192d4 34#include "Scintilla.h"
9e96e16f 35#include "ScintillaWidget.h"
9ce192d4
RD
36#ifdef SCI_LEXER
37#include "SciLexer.h"
9b01abb8
RD
38#include "PropSetSimple.h"
39#include "ILexer.h"
40#include "LexerModule.h"
41#include "LexAccessor.h"
9e96e16f 42#include "Accessor.h"
9b01abb8 43#include "WordList.h"
9ce192d4
RD
44#endif
45#include "ContractionState.h"
9e96e16f 46#include "SVector.h"
9ce192d4
RD
47#include "CellBuffer.h"
48#include "CallTip.h"
49#include "KeyMap.h"
50#include "Indicator.h"
9e96e16f 51#include "XPM.h"
9ce192d4
RD
52#include "LineMarker.h"
53#include "Style.h"
9ce192d4 54#include "AutoComplete.h"
9e96e16f
RD
55#include "ViewStyle.h"
56#include "CharClassify.h"
7e0c58e9 57#include "Decoration.h"
9ce192d4 58#include "Document.h"
9e96e16f 59#include "Selection.h"
7e0c58e9 60#include "PositionCache.h"
9ce192d4 61#include "Editor.h"
9e96e16f 62#include "PropSetSimple.h"
9ce192d4
RD
63#include "ScintillaBase.h"
64
633566f6
RD
65#ifdef __WXMSW__
66#include "wx/msw/wrapwin.h" // HBITMAP
67#endif
68#if wxUSE_DRAG_AND_DROP
69#include "wx/timer.h"
70#endif
71
9ce192d4
RD
72//----------------------------------------------------------------------
73
ba8a4f66 74
b5dbe15d
VS
75class WXDLLIMPEXP_FWD_CORE wxDC;
76class WXDLLIMPEXP_FWD_STC wxStyledTextCtrl; // forward
9ce192d4
RD
77class ScintillaWX;
78
79
80//----------------------------------------------------------------------
81// Helper classes
82
1bc32508 83#if wxUSE_DRAG_AND_DROP
9ce192d4
RD
84class wxSTCDropTarget : public wxTextDropTarget {
85public:
86 void SetScintilla(ScintillaWX* swx) {
291b0f5b 87 m_swx = swx;
9ce192d4
RD
88 }
89
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);
93 void OnLeave();
94
95private:
291b0f5b 96 ScintillaWX* m_swx;
9ce192d4 97};
1bc32508 98#endif
9ce192d4
RD
99
100//----------------------------------------------------------------------
101
102class ScintillaWX : public ScintillaBase {
103public:
104
105 ScintillaWX(wxStyledTextCtrl* win);
106 ~ScintillaWX();
107
108 // base class virtuals
109 virtual void Initialise();
110 virtual void Finalise();
111 virtual void StartDrag();
8e54aaed 112 virtual bool SetIdle(bool on);
9ce192d4
RD
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);
120 virtual void Copy();
121 virtual void Paste();
e14d10b0
RD
122 virtual void CopyToClipboard(const SelectionText &selectedText);
123
9ce192d4
RD
124 virtual void CreateCallTipWindow(PRectangle rc);
125 virtual void AddToPopUp(const char *label, int cmd = 0, bool enabled = true);
126 virtual void ClaimSelection();
127
80dc1dd3
VZ
128 virtual sptr_t DefWndProc(unsigned int iMessage,
129 uptr_t wParam,
130 sptr_t lParam);
131 virtual sptr_t WndProc(unsigned int iMessage,
132 uptr_t wParam,
133 sptr_t lParam);
9ce192d4
RD
134
135 virtual void NotifyChange();
136 virtual void NotifyParent(SCNotification scn);
137
b0d0494f 138 virtual void CancelModes();
9ce192d4 139
d429e187
RD
140 virtual void UpdateSystemCaret();
141
9ce192d4
RD
142 // Event delegates
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);
147 void DoLoseFocus();
148 void DoGainFocus();
149 void DoSysColourChange();
2b5f62a0
VZ
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);
1d84348c
VZ
154 void DoMouseWheel(wxMouseWheelAxis axis, int rotation, int delta,
155 int linesPerAction, int columnsPerAction,
156 bool ctrlDown, bool isPageScroll);
10ef30eb 157 void DoAddChar(int key);
5fd656d5 158 int DoKeyDown(const wxKeyEvent& event, bool* consumed);
9ce192d4 159 void DoTick() { Tick(); }
8e54aaed 160 void DoOnIdle(wxIdleEvent& evt);
7e126a07 161
1bc32508 162#if wxUSE_DRAG_AND_DROP
9ce192d4
RD
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);
166 void DoDragLeave();
1bc32508 167#endif
9ce192d4
RD
168
169 void DoCommand(int ID);
170 void DoContextMenu(Point pt);
f6bcfd97 171 void DoOnListBox();
9ce192d4
RD
172
173
174 // helpers
ab0f5fa6 175 void FullPaint();
c3e0999b 176 void FullPaintDC(wxDC* dc);
9ce192d4
RD
177 bool CanPaste();
178 bool GetHideSelection() { return hideSelection; }
179 void DoScrollToLine(int line);
180 void DoScrollToColumn(int column);
9e730a78 181 void ClipChildren(wxDC& dc, PRectangle rect);
d1558f3d
RD
182 void SetUseAntiAliasing(bool useAA);
183 bool GetUseAntiAliasing();
9ce192d4
RD
184
185private:
9e730a78 186 bool capturedMouse;
b0d0494f 187 bool focusEvent;
9ce192d4
RD
188 wxStyledTextCtrl* stc;
189
1bc32508 190#if wxUSE_DRAG_AND_DROP
9eb662e9 191 wxSTCDropTarget* dropTarget;
9ce192d4 192 wxDragResult dragResult;
1bc32508 193#endif
466c166f 194
1d84348c
VZ
195 int wheelVRotation;
196 int wheelHRotation;
9e730a78 197
d429e187
RD
198 // For use in creating a system caret
199 bool HasCaretSizeChanged();
200 bool CreateSystemCaret();
201 bool DestroySystemCaret();
202#ifdef __WXMSW__
203 HBITMAP sysCaretBitmap;
204 int sysCaretWidth;
205 int sysCaretHeight;
206#endif
466c166f 207
9e730a78 208 friend class wxSTCCallTip;
9ce192d4
RD
209};
210
211//----------------------------------------------------------------------
212#endif