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