]> git.saurik.com Git - wxWidgets.git/blame - src/stc/ScintillaWX.h
moved primitive string and string iterators operations to stringops.h/cpp files to...
[wxWidgets.git] / src / stc / ScintillaWX.h
CommitLineData
9ce192d4
RD
1////////////////////////////////////////////////////////////////////////////
2// Name: 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
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"
b8193d80 30#include "CharClassify.h"
9e730a78 31#include "XPM.h"
9ce192d4
RD
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
633566f6
RD
52#ifdef __WXMSW__
53#include "wx/msw/wrapwin.h" // HBITMAP
54#endif
55#if wxUSE_DRAG_AND_DROP
56#include "wx/timer.h"
57#endif
58
9ce192d4
RD
59//----------------------------------------------------------------------
60
ba8a4f66
MB
61#ifdef WXMAKINGDLL_STC
62 #define WXDLLIMPEXP_STC WXEXPORT
63#elif defined(WXUSINGDLL)
64 #define WXDLLIMPEXP_STC WXIMPORT
65#else // not making nor using DLL
66 #define WXDLLIMPEXP_STC
67#endif
68
43254718 69class WXDLLIMPEXP_CORE wxDC;
ba8a4f66 70class WXDLLIMPEXP_STC wxStyledTextCtrl; // forward
9ce192d4
RD
71class ScintillaWX;
72
73
74//----------------------------------------------------------------------
75// Helper classes
76
1bc32508 77#if wxUSE_DRAG_AND_DROP
9ce192d4
RD
78class wxSTCDropTarget : public wxTextDropTarget {
79public:
80 void SetScintilla(ScintillaWX* swx) {
81 this->swx = swx;
82 }
83
84 bool OnDropText(wxCoord x, wxCoord y, const wxString& data);
85 wxDragResult OnEnter(wxCoord x, wxCoord y, wxDragResult def);
86 wxDragResult OnDragOver(wxCoord x, wxCoord y, wxDragResult def);
87 void OnLeave();
88
89private:
90 ScintillaWX* swx;
91};
1bc32508 92#endif
9ce192d4
RD
93
94//----------------------------------------------------------------------
95
96class ScintillaWX : public ScintillaBase {
97public:
98
99 ScintillaWX(wxStyledTextCtrl* win);
100 ~ScintillaWX();
101
102 // base class virtuals
103 virtual void Initialise();
104 virtual void Finalise();
105 virtual void StartDrag();
8e54aaed 106 virtual bool SetIdle(bool on);
9ce192d4
RD
107 virtual void SetTicking(bool on);
108 virtual void SetMouseCapture(bool on);
109 virtual bool HaveMouseCapture();
110 virtual void ScrollText(int linesToMove);
111 virtual void SetVerticalScrollPos();
112 virtual void SetHorizontalScrollPos();
113 virtual bool ModifyScrollBars(int nMax, int nPage);
114 virtual void Copy();
115 virtual void Paste();
e14d10b0
RD
116 virtual void CopyToClipboard(const SelectionText &selectedText);
117
9ce192d4
RD
118 virtual void CreateCallTipWindow(PRectangle rc);
119 virtual void AddToPopUp(const char *label, int cmd = 0, bool enabled = true);
120 virtual void ClaimSelection();
121
80dc1dd3
VZ
122 virtual sptr_t DefWndProc(unsigned int iMessage,
123 uptr_t wParam,
124 sptr_t lParam);
125 virtual sptr_t WndProc(unsigned int iMessage,
126 uptr_t wParam,
127 sptr_t lParam);
9ce192d4
RD
128
129 virtual void NotifyChange();
130 virtual void NotifyParent(SCNotification scn);
131
b0d0494f 132 virtual void CancelModes();
9ce192d4 133
d429e187
RD
134 virtual void UpdateSystemCaret();
135
9ce192d4
RD
136 // Event delegates
137 void DoPaint(wxDC* dc, wxRect rect);
138 void DoHScroll(int type, int pos);
139 void DoVScroll(int type, int pos);
140 void DoSize(int width, int height);
141 void DoLoseFocus();
142 void DoGainFocus();
143 void DoSysColourChange();
2b5f62a0
VZ
144 void DoLeftButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt);
145 void DoLeftButtonUp(Point pt, unsigned int curTime, bool ctrl);
146 void DoLeftButtonMove(Point pt);
147 void DoMiddleButtonUp(Point pt);
9b9337da 148 void DoMouseWheel(int rotation, int delta, int linesPerAction, int ctrlDown, bool isPageScroll);
10ef30eb 149 void DoAddChar(int key);
5fd656d5 150 int DoKeyDown(const wxKeyEvent& event, bool* consumed);
9ce192d4 151 void DoTick() { Tick(); }
8e54aaed 152 void DoOnIdle(wxIdleEvent& evt);
466c166f 153 void DoStartDrag();
7e126a07 154
1bc32508 155#if wxUSE_DRAG_AND_DROP
9ce192d4
RD
156 bool DoDropText(long x, long y, const wxString& data);
157 wxDragResult DoDragEnter(wxCoord x, wxCoord y, wxDragResult def);
158 wxDragResult DoDragOver(wxCoord x, wxCoord y, wxDragResult def);
159 void DoDragLeave();
1bc32508 160#endif
9ce192d4
RD
161
162 void DoCommand(int ID);
163 void DoContextMenu(Point pt);
f6bcfd97 164 void DoOnListBox();
9ce192d4
RD
165
166
167 // helpers
ab0f5fa6 168 void FullPaint();
9ce192d4
RD
169 bool CanPaste();
170 bool GetHideSelection() { return hideSelection; }
171 void DoScrollToLine(int line);
172 void DoScrollToColumn(int column);
9e730a78 173 void ClipChildren(wxDC& dc, PRectangle rect);
d1558f3d
RD
174 void SetUseAntiAliasing(bool useAA);
175 bool GetUseAntiAliasing();
9ce192d4
RD
176
177private:
9e730a78 178 bool capturedMouse;
b0d0494f 179 bool focusEvent;
9ce192d4
RD
180 wxStyledTextCtrl* stc;
181
1bc32508 182#if wxUSE_DRAG_AND_DROP
9eb662e9 183 wxSTCDropTarget* dropTarget;
9ce192d4 184 wxDragResult dragResult;
466c166f 185 wxTimer* startDragTimer;
1bc32508 186#endif
466c166f 187
37d62433 188 int wheelRotation;
9e730a78 189
d429e187
RD
190 // For use in creating a system caret
191 bool HasCaretSizeChanged();
192 bool CreateSystemCaret();
193 bool DestroySystemCaret();
194#ifdef __WXMSW__
195 HBITMAP sysCaretBitmap;
196 int sysCaretWidth;
197 int sysCaretHeight;
198#endif
466c166f 199
9e730a78 200 friend class wxSTCCallTip;
9ce192d4
RD
201};
202
203//----------------------------------------------------------------------
204#endif