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