]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/stc/ScintillaWX.h
splitted wxApp docs in wxApp+wxAppConsole docs; fix the signature of the documented...
[wxWidgets.git] / src / stc / ScintillaWX.h
... / ...
CommitLineData
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#include "wx/defs.h"
20
21//----------------------------------------------------------------------
22
23#include <ctype.h>
24#include <stdlib.h>
25#include <stdio.h>
26#include <string.h>
27
28#include "Platform.h"
29
30#include "Scintilla.h"
31#include "CharClassify.h"
32#include "XPM.h"
33#ifdef SCI_LEXER
34#include "SciLexer.h"
35#include "PropSet.h"
36#include "Accessor.h"
37#include "KeyWords.h"
38#endif
39#include "SplitVector.h"
40#include "Partitioning.h"
41#include "RunStyles.h"
42#include "ContractionState.h"
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"
51#include "Decoration.h"
52#include "Document.h"
53#include "PositionCache.h"
54#include "Editor.h"
55#include "ScintillaBase.h"
56
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
64//----------------------------------------------------------------------
65
66
67class WXDLLIMPEXP_FWD_CORE wxDC;
68class WXDLLIMPEXP_FWD_STC wxStyledTextCtrl; // forward
69class ScintillaWX;
70
71
72//----------------------------------------------------------------------
73// Helper classes
74
75#if wxUSE_DRAG_AND_DROP
76class wxSTCDropTarget : public wxTextDropTarget {
77public:
78 void SetScintilla(ScintillaWX* swx) {
79 m_swx = swx;
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:
88 ScintillaWX* m_swx;
89};
90#endif
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();
104 virtual bool SetIdle(bool on);
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();
114 virtual void CopyToClipboard(const SelectionText &selectedText);
115
116 virtual void CreateCallTipWindow(PRectangle rc);
117 virtual void AddToPopUp(const char *label, int cmd = 0, bool enabled = true);
118 virtual void ClaimSelection();
119
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);
126
127 virtual void NotifyChange();
128 virtual void NotifyParent(SCNotification scn);
129
130 virtual void CancelModes();
131
132 virtual void UpdateSystemCaret();
133
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();
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);
146 void DoMouseWheel(int rotation, int delta, int linesPerAction, int ctrlDown, bool isPageScroll);
147 void DoAddChar(int key);
148 int DoKeyDown(const wxKeyEvent& event, bool* consumed);
149 void DoTick() { Tick(); }
150 void DoOnIdle(wxIdleEvent& evt);
151 void DoStartDrag();
152
153#if wxUSE_DRAG_AND_DROP
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();
158#endif
159
160 void DoCommand(int ID);
161 void DoContextMenu(Point pt);
162 void DoOnListBox();
163
164
165 // helpers
166 void FullPaint();
167 bool CanPaste();
168 bool GetHideSelection() { return hideSelection; }
169 void DoScrollToLine(int line);
170 void DoScrollToColumn(int column);
171 void ClipChildren(wxDC& dc, PRectangle rect);
172 void SetUseAntiAliasing(bool useAA);
173 bool GetUseAntiAliasing();
174
175private:
176 bool capturedMouse;
177 bool focusEvent;
178 wxStyledTextCtrl* stc;
179
180#if wxUSE_DRAG_AND_DROP
181 wxSTCDropTarget* dropTarget;
182 wxDragResult dragResult;
183 wxTimer* startDragTimer;
184#endif
185
186 int wheelRotation;
187
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
197
198 friend class wxSTCCallTip;
199};
200
201//----------------------------------------------------------------------
202#endif