]> git.saurik.com Git - wxWidgets.git/blame - src/stc/ScintillaWX.h
* SPACE -> TAB in filelist.txt
[wxWidgets.git] / src / stc / ScintillaWX.h
CommitLineData
9ce192d4
RD
1////////////////////////////////////////////////////////////////////////////
2// Name: ScintillaWX.h
3// Purpose: A wxWindows 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
20//----------------------------------------------------------------------
21
22#include "Platform.h"
23
24#include "Scintilla.h"
25#ifdef SCI_LEXER
26#include "SciLexer.h"
27#include "PropSet.h"
28#include "Accessor.h"
29#include "KeyWords.h"
30#endif
31#include "ContractionState.h"
32#include "SVector.h"
33#include "CellBuffer.h"
34#include "CallTip.h"
35#include "KeyMap.h"
36#include "Indicator.h"
37#include "LineMarker.h"
38#include "Style.h"
39#include "ViewStyle.h"
40#include "AutoComplete.h"
41#include "Document.h"
42#include "Editor.h"
43#include "ScintillaBase.h"
44
45#include <wx/wx.h>
46#include <wx/dataobj.h>
47#include <wx/clipbrd.h>
48#include <wx/dnd.h>
49
50//----------------------------------------------------------------------
51
52class wxStyledTextCtrl; // forward
53class ScintillaWX;
54
55
56//----------------------------------------------------------------------
57// Helper classes
58
1bc32508 59#if wxUSE_DRAG_AND_DROP
9ce192d4
RD
60class wxSTCDropTarget : public wxTextDropTarget {
61public:
62 void SetScintilla(ScintillaWX* swx) {
63 this->swx = swx;
64 }
65
66 bool OnDropText(wxCoord x, wxCoord y, const wxString& data);
67 wxDragResult OnEnter(wxCoord x, wxCoord y, wxDragResult def);
68 wxDragResult OnDragOver(wxCoord x, wxCoord y, wxDragResult def);
69 void OnLeave();
70
71private:
72 ScintillaWX* swx;
73};
1bc32508 74#endif
9ce192d4
RD
75
76//----------------------------------------------------------------------
77
78class ScintillaWX : public ScintillaBase {
79public:
80
81 ScintillaWX(wxStyledTextCtrl* win);
82 ~ScintillaWX();
83
84 // base class virtuals
85 virtual void Initialise();
86 virtual void Finalise();
87 virtual void StartDrag();
88 virtual void SetTicking(bool on);
89 virtual void SetMouseCapture(bool on);
90 virtual bool HaveMouseCapture();
91 virtual void ScrollText(int linesToMove);
92 virtual void SetVerticalScrollPos();
93 virtual void SetHorizontalScrollPos();
94 virtual bool ModifyScrollBars(int nMax, int nPage);
95 virtual void Copy();
96 virtual void Paste();
97 virtual void CreateCallTipWindow(PRectangle rc);
98 virtual void AddToPopUp(const char *label, int cmd = 0, bool enabled = true);
99 virtual void ClaimSelection();
100
d134f170
RD
101 virtual long DefWndProc(unsigned int iMessage,
102 unsigned long wParam,
103 long lParam);
104 virtual long WndProc(unsigned int iMessage,
105 unsigned long wParam,
106 long lParam);
9ce192d4
RD
107
108 virtual void NotifyChange();
109 virtual void NotifyParent(SCNotification scn);
110
111
112 // Event delegates
113 void DoPaint(wxDC* dc, wxRect rect);
114 void DoHScroll(int type, int pos);
115 void DoVScroll(int type, int pos);
116 void DoSize(int width, int height);
117 void DoLoseFocus();
118 void DoGainFocus();
119 void DoSysColourChange();
120 void DoButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt);
121 void DoButtonUp(Point pt, unsigned int curTime, bool ctrl);
122 void DoButtonMove(Point pt);
65ec6247 123 void DoMouseWheel(int rotation, int delta, int linesPerAction, int ctrlDown);
9ce192d4 124 void DoAddChar(char ch);
65ec6247 125 int DoKeyDown(int key, bool shift, bool ctrl, bool alt, bool* consumed);
9ce192d4
RD
126 void DoTick() { Tick(); }
127
1bc32508 128#if wxUSE_DRAG_AND_DROP
9ce192d4
RD
129 bool DoDropText(long x, long y, const wxString& data);
130 wxDragResult DoDragEnter(wxCoord x, wxCoord y, wxDragResult def);
131 wxDragResult DoDragOver(wxCoord x, wxCoord y, wxDragResult def);
132 void DoDragLeave();
1bc32508 133#endif
9ce192d4
RD
134
135 void DoCommand(int ID);
136 void DoContextMenu(Point pt);
f6bcfd97 137 void DoOnListBox();
9ce192d4
RD
138
139
140 // helpers
141 void FullPaint();
142 bool CanPaste();
143 bool GetHideSelection() { return hideSelection; }
144 void DoScrollToLine(int line);
145 void DoScrollToColumn(int column);
146
147private:
148 bool capturedMouse;
149 wxStyledTextCtrl* stc;
150
1bc32508 151#if wxUSE_DRAG_AND_DROP
9eb662e9 152 wxSTCDropTarget* dropTarget;
9ce192d4 153 wxDragResult dragResult;
1bc32508 154#endif
37d62433 155 int wheelRotation;
9ce192d4
RD
156};
157
158//----------------------------------------------------------------------
159#endif