]> git.saurik.com Git - wxWidgets.git/blame - src/stc/ScintillaWX.h
fix tool item enter/leave notify, fixes #13083
[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
12// RCS-ID: $Id$
13// Copyright: (c) 2000 by Total Control Software
526954c5 14// Licence: wxWindows licence
9ce192d4
RD
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 28#include "Platform.h"
9e96e16f
RD
29#include "SplitVector.h"
30#include "Partitioning.h"
31#include "RunStyles.h"
9ce192d4 32#include "Scintilla.h"
9e96e16f 33#include "ScintillaWidget.h"
9ce192d4
RD
34#ifdef SCI_LEXER
35#include "SciLexer.h"
9e96e16f
RD
36#include "PropSet.h"
37#include "Accessor.h"
38#include "KeyWords.h"
9ce192d4
RD
39#endif
40#include "ContractionState.h"
9e96e16f 41#include "SVector.h"
9ce192d4
RD
42#include "CellBuffer.h"
43#include "CallTip.h"
44#include "KeyMap.h"
45#include "Indicator.h"
9e96e16f 46#include "XPM.h"
9ce192d4
RD
47#include "LineMarker.h"
48#include "Style.h"
9ce192d4 49#include "AutoComplete.h"
9e96e16f
RD
50#include "ViewStyle.h"
51#include "CharClassify.h"
7e0c58e9 52#include "Decoration.h"
9ce192d4 53#include "Document.h"
9e96e16f 54#include "Selection.h"
7e0c58e9 55#include "PositionCache.h"
9ce192d4 56#include "Editor.h"
9e96e16f 57#include "PropSetSimple.h"
9ce192d4
RD
58#include "ScintillaBase.h"
59
633566f6
RD
60#ifdef __WXMSW__
61#include "wx/msw/wrapwin.h" // HBITMAP
62#endif
63#if wxUSE_DRAG_AND_DROP
64#include "wx/timer.h"
65#endif
66
9ce192d4
RD
67//----------------------------------------------------------------------
68
ba8a4f66 69
b5dbe15d
VS
70class WXDLLIMPEXP_FWD_CORE wxDC;
71class WXDLLIMPEXP_FWD_STC wxStyledTextCtrl; // forward
9ce192d4
RD
72class ScintillaWX;
73
74
75//----------------------------------------------------------------------
76// Helper classes
77
1bc32508 78#if wxUSE_DRAG_AND_DROP
9ce192d4
RD
79class wxSTCDropTarget : public wxTextDropTarget {
80public:
81 void SetScintilla(ScintillaWX* swx) {
291b0f5b 82 m_swx = swx;
9ce192d4
RD
83 }
84
85 bool OnDropText(wxCoord x, wxCoord y, const wxString& data);
86 wxDragResult OnEnter(wxCoord x, wxCoord y, wxDragResult def);
87 wxDragResult OnDragOver(wxCoord x, wxCoord y, wxDragResult def);
88 void OnLeave();
89
90private:
291b0f5b 91 ScintillaWX* m_swx;
9ce192d4 92};
1bc32508 93#endif
9ce192d4
RD
94
95//----------------------------------------------------------------------
96
97class ScintillaWX : public ScintillaBase {
98public:
99
100 ScintillaWX(wxStyledTextCtrl* win);
101 ~ScintillaWX();
102
103 // base class virtuals
104 virtual void Initialise();
105 virtual void Finalise();
106 virtual void StartDrag();
8e54aaed 107 virtual bool SetIdle(bool on);
9ce192d4
RD
108 virtual void SetTicking(bool on);
109 virtual void SetMouseCapture(bool on);
110 virtual bool HaveMouseCapture();
111 virtual void ScrollText(int linesToMove);
112 virtual void SetVerticalScrollPos();
113 virtual void SetHorizontalScrollPos();
114 virtual bool ModifyScrollBars(int nMax, int nPage);
115 virtual void Copy();
116 virtual void Paste();
e14d10b0
RD
117 virtual void CopyToClipboard(const SelectionText &selectedText);
118
9ce192d4
RD
119 virtual void CreateCallTipWindow(PRectangle rc);
120 virtual void AddToPopUp(const char *label, int cmd = 0, bool enabled = true);
121 virtual void ClaimSelection();
122
80dc1dd3
VZ
123 virtual sptr_t DefWndProc(unsigned int iMessage,
124 uptr_t wParam,
125 sptr_t lParam);
126 virtual sptr_t WndProc(unsigned int iMessage,
127 uptr_t wParam,
128 sptr_t lParam);
9ce192d4
RD
129
130 virtual void NotifyChange();
131 virtual void NotifyParent(SCNotification scn);
132
b0d0494f 133 virtual void CancelModes();
9ce192d4 134
d429e187
RD
135 virtual void UpdateSystemCaret();
136
9ce192d4
RD
137 // Event delegates
138 void DoPaint(wxDC* dc, wxRect rect);
139 void DoHScroll(int type, int pos);
140 void DoVScroll(int type, int pos);
141 void DoSize(int width, int height);
142 void DoLoseFocus();
143 void DoGainFocus();
144 void DoSysColourChange();
2b5f62a0
VZ
145 void DoLeftButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt);
146 void DoLeftButtonUp(Point pt, unsigned int curTime, bool ctrl);
147 void DoLeftButtonMove(Point pt);
148 void DoMiddleButtonUp(Point pt);
9b9337da 149 void DoMouseWheel(int rotation, int delta, int linesPerAction, int ctrlDown, bool isPageScroll);
10ef30eb 150 void DoAddChar(int key);
5fd656d5 151 int DoKeyDown(const wxKeyEvent& event, bool* consumed);
9ce192d4 152 void DoTick() { Tick(); }
8e54aaed 153 void DoOnIdle(wxIdleEvent& evt);
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;
1bc32508 185#endif
466c166f 186
37d62433 187 int wheelRotation;
9e730a78 188
d429e187
RD
189 // For use in creating a system caret
190 bool HasCaretSizeChanged();
191 bool CreateSystemCaret();
192 bool DestroySystemCaret();
193#ifdef __WXMSW__
194 HBITMAP sysCaretBitmap;
195 int sysCaretWidth;
196 int sysCaretHeight;
197#endif
466c166f 198
9e730a78 199 friend class wxSTCCallTip;
9ce192d4
RD
200};
201
202//----------------------------------------------------------------------
203#endif