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