]> git.saurik.com Git - wxWidgets.git/blame - src/stc/ScintillaWX.h
Fixed and refactored wxPropertyGridManager decsription text box painting
[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);
7e126a07 151
1bc32508 152#if wxUSE_DRAG_AND_DROP
9ce192d4
RD
153 bool DoDropText(long x, long y, const wxString& data);
154 wxDragResult DoDragEnter(wxCoord x, wxCoord y, wxDragResult def);
155 wxDragResult DoDragOver(wxCoord x, wxCoord y, wxDragResult def);
156 void DoDragLeave();
1bc32508 157#endif
9ce192d4
RD
158
159 void DoCommand(int ID);
160 void DoContextMenu(Point pt);
f6bcfd97 161 void DoOnListBox();
9ce192d4
RD
162
163
164 // helpers
ab0f5fa6 165 void FullPaint();
9ce192d4
RD
166 bool CanPaste();
167 bool GetHideSelection() { return hideSelection; }
168 void DoScrollToLine(int line);
169 void DoScrollToColumn(int column);
9e730a78 170 void ClipChildren(wxDC& dc, PRectangle rect);
d1558f3d
RD
171 void SetUseAntiAliasing(bool useAA);
172 bool GetUseAntiAliasing();
9ce192d4
RD
173
174private:
9e730a78 175 bool capturedMouse;
b0d0494f 176 bool focusEvent;
9ce192d4
RD
177 wxStyledTextCtrl* stc;
178
1bc32508 179#if wxUSE_DRAG_AND_DROP
9eb662e9 180 wxSTCDropTarget* dropTarget;
9ce192d4 181 wxDragResult dragResult;
1bc32508 182#endif
466c166f 183
37d62433 184 int wheelRotation;
9e730a78 185
d429e187
RD
186 // For use in creating a system caret
187 bool HasCaretSizeChanged();
188 bool CreateSystemCaret();
189 bool DestroySystemCaret();
190#ifdef __WXMSW__
191 HBITMAP sysCaretBitmap;
192 int sysCaretWidth;
193 int sysCaretHeight;
194#endif
466c166f 195
9e730a78 196 friend class wxSTCCallTip;
9ce192d4
RD
197};
198
199//----------------------------------------------------------------------
200#endif