~damien-moore/+junk/codeblocks

« back to all changes in this revision

Viewing changes to src/sdk/wxscintilla/src/ScintillaWX.h

  • Committer: Damien Moore
  • Date: 2013-10-11 14:25:27 UTC
  • Revision ID: damienlmoore@gmail.com-20131011142527-w13ki0x8yjd7973d
copy of Code::Blocks repo based on SVN rev 9395

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 wxScintilla to function.
 
8
//
 
9
// Author:      Robin Dunn
 
10
//
 
11
// Created:     13-Jan-2000
 
12
// RCS-ID:      $Id: ScintillaWX.h 9226 2013-07-24 05:11:21Z mortenmacfly $
 
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 <ctype.h>
 
23
#include <stdlib.h>
 
24
#include <stdio.h>
 
25
#include <string.h>
 
26
 
 
27
#include "Platform.h"
 
28
 
 
29
#include "Scintilla.h"
 
30
#include "XPM.h"
 
31
#ifdef SCI_LEXER
 
32
#include "SciLexer.h"
 
33
#include "Accessor.h"
 
34
#endif
 
35
#include "ContractionState.h"
 
36
#include "CellBuffer.h"
 
37
#include "CallTip.h"
 
38
#include "KeyMap.h"
 
39
#include "Indicator.h"
 
40
#include "LineMarker.h"
 
41
#include "Style.h"
 
42
#include "ViewStyle.h"
 
43
#include "AutoComplete.h"
 
44
#include "CharClassify.h"
 
45
#include "RESearch.h"
 
46
#include "Document.h"
 
47
#include "Editor.h"
 
48
#include "ScintillaBase.h"
 
49
 
 
50
#include <wx/wx.h>
 
51
#include <wx/dataobj.h>
 
52
#include <wx/dnd.h>
 
53
 
 
54
//----------------------------------------------------------------------
 
55
 
 
56
#ifdef WXMAKINGDLL_SCI
 
57
    #define WXDLLIMPEXP_SCI WXEXPORT
 
58
#elif defined(WXUSINGDLL)
 
59
    #define WXDLLIMPEXP_SCI WXIMPORT
 
60
#else // not making nor using DLL
 
61
    #define WXDLLIMPEXP_SCI
 
62
#endif
 
63
 
 
64
 
 
65
#ifdef SCI_NAMESPACE
 
66
        #ifndef SCI_NAMESPACE_PREFIX
 
67
                #define SCI_NAMESPACE_PREFIX( x ) Scintilla::x
 
68
        #endif
 
69
#else
 
70
        #ifndef SCI_NAMESPACE_PREFIX
 
71
                #define SCI_NAMESPACE_PREFIX( x ) x
 
72
        #endif
 
73
#endif
 
74
 
 
75
//----------------------------------------------------------------------
 
76
 
 
77
 
 
78
class wxScintilla;           // forward
 
79
class ScintillaWX;
 
80
 
 
81
 
 
82
//----------------------------------------------------------------------
 
83
// Helper classes
 
84
 
 
85
#if wxUSE_DRAG_AND_DROP
 
86
class wxSCIDropTarget : public wxTextDropTarget {
 
87
public:
 
88
    void SetScintilla(ScintillaWX* swx) {
 
89
        m_swx = swx;
 
90
    }
 
91
 
 
92
    bool OnDropText(wxCoord x, wxCoord y, const wxString& data);
 
93
    wxDragResult OnEnter(wxCoord x, wxCoord y, wxDragResult def);
 
94
    wxDragResult OnDragOver(wxCoord x, wxCoord y, wxDragResult def);
 
95
    void OnLeave();
 
96
 
 
97
private:
 
98
    ScintillaWX* m_swx;
 
99
};
 
100
#endif
 
101
 
 
102
//----------------------------------------------------------------------
 
103
 
 
104
/* C::B begin */
 
105
class ScintillaWX : public SCI_NAMESPACE_PREFIX(ScintillaBase) {
 
106
/* C::B end */
 
107
public:
 
108
 
 
109
    ScintillaWX(wxScintilla* win);
 
110
    ~ScintillaWX();
 
111
 
 
112
    // base class virtuals
 
113
    virtual void Initialise();
 
114
    virtual void Finalise();
 
115
    virtual void StartDrag();
 
116
    virtual bool SetIdle(bool on);
 
117
    virtual void SetTicking(bool on);
 
118
    virtual void SetMouseCapture(bool on);
 
119
    virtual bool HaveMouseCapture();
 
120
    virtual void ScrollText(int linesToMove);
 
121
    virtual void SetVerticalScrollPos();
 
122
    virtual void SetHorizontalScrollPos();
 
123
    virtual bool ModifyScrollBars(int nMax, int nPage);
 
124
    virtual void Copy();
 
125
    virtual void Paste();
 
126
/* C::B begin */
 
127
    virtual void CopyToClipboard(const SCI_NAMESPACE_PREFIX(SelectionText) &selectedText);
 
128
 
 
129
    virtual void CreateCallTipWindow(SCI_NAMESPACE_PREFIX(PRectangle) rc);
 
130
/* C::B end */
 
131
    virtual void AddToPopUp(const char *label, int cmd = 0, bool enabled = true);
 
132
    virtual void ClaimSelection();
 
133
 
 
134
    virtual sptr_t DefWndProc(unsigned int iMessage,
 
135
                              uptr_t wParam,
 
136
                              sptr_t lParam);
 
137
    virtual sptr_t WndProc(unsigned int iMessage,
 
138
                           uptr_t wParam,
 
139
                           sptr_t lParam);
 
140
/* C::B begin */
 
141
    static sptr_t DirectFunction(ScintillaWX *wxsci,
 
142
                                 unsigned int iMessage,
 
143
                                 uptr_t wParam,
 
144
                                 sptr_t lParam);
 
145
/* C::B end */
 
146
 
 
147
    virtual void NotifyChange();
 
148
    virtual void NotifyParent(SCI_NAMESPACE_PREFIX(SCNotification) scn);
 
149
/* C::B begin */
 
150
    virtual void NotifyFocus(bool focus);
 
151
/* C::B end */
 
152
 
 
153
    virtual void CancelModes();
 
154
 
 
155
    virtual void UpdateSystemCaret();
 
156
 
 
157
    // Event delegates
 
158
    void DoPaint(wxDC* dc, wxRect rect);
 
159
    void DoHScroll(int type, int pos);
 
160
    void DoVScroll(int type, int pos);
 
161
    void DoSize(int width, int height);
 
162
    void DoLoseFocus();
 
163
    void DoGainFocus();
 
164
    void DoSysColourChange();
 
165
/* C::B begin */
 
166
    void DoLeftButtonDown(SCI_NAMESPACE_PREFIX(Point) pt, unsigned int curTime, bool shift, bool ctrl, bool alt);
 
167
    void DoLeftButtonUp(SCI_NAMESPACE_PREFIX(Point) pt, unsigned int curTime, bool ctrl);
 
168
    void DoLeftButtonMove(SCI_NAMESPACE_PREFIX(Point) pt);
 
169
    void DoMiddleButtonUp(SCI_NAMESPACE_PREFIX(Point) pt);
 
170
/* C::B end */
 
171
/* C::B begin */
 
172
#if !wxCHECK_VERSION(2,9,2)
 
173
    enum wxMouseWheelAxis
 
174
    {
 
175
        wxMOUSE_WHEEL_VERTICAL,
 
176
        wxMOUSE_WHEEL_HORIZONTAL
 
177
    };
 
178
#endif
 
179
/* C::B end */
 
180
    void DoMouseWheel(wxMouseWheelAxis axis, int rotation, int delta,
 
181
                      int linesPerAction, int columnsPerAction,
 
182
                      bool ctrlDown, bool isPageScroll);
 
183
    void DoAddChar(int key);
 
184
    int  DoKeyDown(const wxKeyEvent& event, bool* consumed);
 
185
    void DoTick() { Tick(); }
 
186
    void DoOnIdle(wxIdleEvent& evt);
 
187
 
 
188
#if wxUSE_DRAG_AND_DROP
 
189
    bool DoDropText(long x, long y, const wxString& data);
 
190
    wxDragResult DoDragEnter(wxCoord x, wxCoord y, wxDragResult def);
 
191
    wxDragResult DoDragOver(wxCoord x, wxCoord y, wxDragResult def);
 
192
    void DoDragLeave();
 
193
#endif
 
194
 
 
195
    void DoCommand(int ID);
 
196
/* C::B begin */
 
197
    void DoContextMenu(SCI_NAMESPACE_PREFIX(Point) pt);
 
198
/* C::B ebd */
 
199
    void DoOnListBox();
 
200
 
 
201
 
 
202
    // helpers
 
203
    void FullPaint();
 
204
    void FullPaintDC(wxDC* dc);
 
205
    bool CanPaste();
 
206
    bool GetHideSelection() { return hideSelection; }
 
207
    void DoScrollToLine(int line);
 
208
    void DoScrollToColumn(int column);
 
209
/* C::B begin */
 
210
    void ClipChildren(wxDC& dc, SCI_NAMESPACE_PREFIX(PRectangle) rect);
 
211
/* C::B end */
 
212
    void SetUseAntiAliasing(bool useAA);
 
213
    bool GetUseAntiAliasing();
 
214
 
 
215
private:
 
216
    bool                capturedMouse;
 
217
    bool                focusEvent;
 
218
    wxScintilla*        sci;
 
219
 
 
220
#if wxUSE_DRAG_AND_DROP
 
221
    wxSCIDropTarget*    dropTarget;
 
222
    wxDragResult        dragResult;
 
223
/* C::B begin */
 
224
    bool                dragRectangle;
 
225
/* C::B end */
 
226
#endif
 
227
 
 
228
    int                 wheelVRotation;
 
229
    int                 wheelHRotation;
 
230
 
 
231
    // For use in creating a system caret
 
232
    bool HasCaretSizeChanged();
 
233
    bool CreateSystemCaret();
 
234
    bool DestroySystemCaret();
 
235
#ifdef __WXMSW__
 
236
    HBITMAP sysCaretBitmap;
 
237
    int sysCaretWidth;
 
238
    int sysCaretHeight;
 
239
#endif
 
240
 
 
241
    friend class wxSCICallTipContent;
 
242
};
 
243
 
 
244
//----------------------------------------------------------------------
 
245
#endif