]> git.saurik.com Git - wxWidgets.git/blame - src/stc/stc.h.in
fixed bug with not NUL-terminating the string in GAddress_UNIX_SetPath
[wxWidgets.git] / src / stc / stc.h.in
CommitLineData
f97d84a6
RD
1////////////////////////////////////////////////////////////////////////////
2// Name: stc.h
3// Purpose: A wxWindows implementation of Scintilla. This class is the
4// one meant to be used directly by wx applications. It does not
5// derive directly from the Scintilla classes, and in fact there
6// is no mention of Scintilla classes at all in this header.
7// This class delegates all method calls and events to the
8// Scintilla objects and so forth. This allows the use of
9// Scintilla without polluting the namespace with all the
10// classes and itentifiers from Scintilla.
11//
12// Author: Robin Dunn
13//
14// Created: 13-Jan-2000
15// RCS-ID: $Id$
16// Copyright: (c) 2000 by Total Control Software
17// Licence: wxWindows license
18/////////////////////////////////////////////////////////////////////////////
19
20#ifndef __stc_h__
21#define __stc_h__
22
23
24#include <wx/wx.h>
a29a241f 25#include <wx/dnd.h>
f97d84a6
RD
26
27//----------------------------------------------------------------------
28// BEGIN generated section. The following code is automatically generated
29// by gen_iface.py. Do not edit this file. Edit stc.h.in instead
30// and regenerate
31
32%(VALUES)s
33
34// END of generated section
f97d84a6
RD
35//----------------------------------------------------------------------
36
37class ScintillaWX; // forward declare
38class WordList;
39struct SCNotification;
40
41
42extern const wxChar* wxSTCNameStr;
43
44//----------------------------------------------------------------------
45
46class wxStyledTextCtrl : public wxControl {
47public:
48
49#ifdef SWIG
50 wxStyledTextCtrl(wxWindow *parent, wxWindowID id,
51 const wxPoint& pos = wxDefaultPosition,
52 const wxSize& size = wxDefaultSize, long style = 0,
137b5242 53 const wxString& name = wxPySTCNameStr);
0122b7e3
RD
54 %%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
55
f97d84a6
RD
56#else
57 wxStyledTextCtrl(wxWindow *parent, wxWindowID id,
58 const wxPoint& pos = wxDefaultPosition,
59 const wxSize& size = wxDefaultSize, long style = 0,
60 const wxString& name = wxSTCNameStr);
61#endif
62
63
64#ifndef SWIG
65 ~wxStyledTextCtrl();
66#endif
67
68//----------------------------------------------------------------------
69// BEGIN generated section. The following code is automatically generated
70// by gen_iface.py. Do not edit this file. Edit stc.h.in instead
71// and regenerate
72
73%(METHOD_DEFS)s
74
75// END of generated section
76//----------------------------------------------------------------------
77// Others...
78
79
80 // Returns the line number of the line with the caret.
81 int GetCurrentLine();
82
83 // Extract style settings from a spec-string which is composed of one or
84 // more of the following comma separated elements:
85 //
86 // bold turns on bold
87 // italic turns on italics
88 // fore:#RRGGBB sets the foreground colour
89 // back:#RRGGBB sets the background colour
90 // face:[facename] sets the font face name to use
91 // size:[num] sets the font size in points
92 // eol turns on eol filling
93 // underline turns on underlining
94 //
95 void StyleSetSpec(int styleNum, const wxString& spec);
96
97
98
99 // Set style size, face, bold, italic, and underline attributes from
100 // a wxFont's attributes.
101 void StyleSetFont(int styleNum, wxFont& font);
102
103
104
105 // Set all font style attributes at once.
106 void StyleSetFontAttr(int styleNum, int size,
107 const wxString& faceName,
108 bool bold, bool italic,
109 bool underline);
110
111
112
113 // Perform one of the operations defined by the wxSTC_CMD_* constants.
114 void CmdKeyExecute(int cmd);
115
116
117
118 // Set the left and right margin in the edit area, measured in pixels.
119 void SetMargins(int left, int right);
120
121
122 // Retrieve the start and end positions of the current selection.
123#ifdef SWIG
124 void GetSelection(int* OUTPUT, int* OUTPUT);
125#else
126 void GetSelection(int* startPos, int* endPos);
127#endif
128
129 // Retrieve the point in the window where a position is displayed.
130 wxPoint PointFromPosition(int pos);
131
132
133 // Scroll enough to make the given line visible
134 void ScrollToLine(int line);
135
136
137 // Scroll enough to make the given column visible
138 void ScrollToColumn(int column);
139
65ec6247
RD
140
141 // Send a message to Scintilla
142 long SendMsg(int msg, long wp=0, long lp=0);
143
5fa4613c
RD
144
145 // Set the vertical scrollbar to use instead of the ont that's built-in.
146 void SetVScrollBar(wxScrollBar* bar) { m_vScrollBar = bar; }
147
148
149 // Set the horizontal scrollbar to use instead of the ont that's built-in.
150 void SetHScrollBar(wxScrollBar* bar) { m_hScrollBar = bar; }
151
0b9dfbc0
RD
152 // Can be used to prevent the EVT_CHAR handler from adding the char
153 bool GetLastKeydownProcessed() { return m_lastKeyDownConsumed; }
154 void SetLastKeydownProcessed(bool val) { m_lastKeyDownConsumed = val; }
155
156
f97d84a6
RD
157//----------------------------------------------------------------------
158
159
160#ifndef SWIG
161private:
162 // Event handlers
163 void OnPaint(wxPaintEvent& evt);
164 void OnScrollWin(wxScrollWinEvent& evt);
5fa4613c 165 void OnScroll(wxScrollEvent& evt);
f97d84a6
RD
166 void OnSize(wxSizeEvent& evt);
167 void OnMouseLeftDown(wxMouseEvent& evt);
168 void OnMouseMove(wxMouseEvent& evt);
169 void OnMouseLeftUp(wxMouseEvent& evt);
ddf2da08 170 void OnMouseRightUp(wxMouseEvent& evt);
65ec6247 171 void OnContextMenu(wxContextMenuEvent& evt);
37d62433 172 void OnMouseWheel(wxMouseEvent& evt);
f97d84a6
RD
173 void OnChar(wxKeyEvent& evt);
174 void OnKeyDown(wxKeyEvent& evt);
175 void OnLoseFocus(wxFocusEvent& evt);
176 void OnGainFocus(wxFocusEvent& evt);
177 void OnSysColourChanged(wxSysColourChangedEvent& evt);
178 void OnEraseBackground(wxEraseEvent& evt);
179 void OnMenu(wxCommandEvent& evt);
180 void OnListBox(wxCommandEvent& evt);
181
182
183 // Turn notifications from Scintilla into events
184 void NotifyChange();
185 void NotifyParent(SCNotification* scn);
186
a29a241f 187
f97d84a6
RD
188private:
189 DECLARE_EVENT_TABLE()
190 DECLARE_CLASS(wxStyledTextCtrl)
191
192 ScintillaWX* m_swx;
193 wxStopWatch m_stopWatch;
5fa4613c
RD
194 wxScrollBar* m_vScrollBar;
195 wxScrollBar* m_hScrollBar;
f97d84a6 196
d6582821 197 bool m_lastKeyDownConsumed;
f97d84a6
RD
198
199 friend class ScintillaWX;
200 friend class Platform;
201#endif
202};
203
204//----------------------------------------------------------------------
205
206class wxStyledTextEvent : public wxCommandEvent {
207public:
208 wxStyledTextEvent(wxEventType commandType=0, int id=0);
4161723f
RD
209#ifndef SWIG
210 wxStyledTextEvent(const wxStyledTextEvent& event);
211#endif
f97d84a6
RD
212 ~wxStyledTextEvent() {}
213
a29a241f
RD
214 void SetPosition(int pos) { m_position = pos; }
215 void SetKey(int k) { m_key = k; }
216 void SetModifiers(int m) { m_modifiers = m; }
217 void SetModificationType(int t) { m_modificationType = t; }
10ef30eb 218 void SetText(const wxString& t) { m_text = t; }
a29a241f
RD
219 void SetLength(int len) { m_length = len; }
220 void SetLinesAdded(int num) { m_linesAdded = num; }
221 void SetLine(int val) { m_line = val; }
222 void SetFoldLevelNow(int val) { m_foldLevelNow = val; }
223 void SetFoldLevelPrev(int val) { m_foldLevelPrev = val; }
224 void SetMargin(int val) { m_margin = val; }
225 void SetMessage(int val) { m_message = val; }
226 void SetWParam(int val) { m_wParam = val; }
227 void SetLParam(int val) { m_lParam = val; }
228 void SetListType(int val) { m_listType = val; }
229 void SetX(int val) { m_x = val; }
230 void SetY(int val) { m_y = val; }
231 void SetDragText(const wxString& val) { m_dragText = val; }
232 void SetDragAllowMove(bool val) { m_dragAllowMove = val; }
233 void SetDragResult(wxDragResult val) { m_dragResult = val; }
f97d84a6
RD
234
235 int GetPosition() const { return m_position; }
236 int GetKey() const { return m_key; }
237 int GetModifiers() const { return m_modifiers; }
238 int GetModificationType() const { return m_modificationType; }
239 wxString GetText() const { return m_text; }
240 int GetLength() const { return m_length; }
241 int GetLinesAdded() const { return m_linesAdded; }
242 int GetLine() const { return m_line; }
243 int GetFoldLevelNow() const { return m_foldLevelNow; }
244 int GetFoldLevelPrev() const { return m_foldLevelPrev; }
245 int GetMargin() const { return m_margin; }
246 int GetMessage() const { return m_message; }
247 int GetWParam() const { return m_wParam; }
248 int GetLParam() const { return m_lParam; }
65ec6247
RD
249 int GetListType() const { return m_listType; }
250 int GetX() const { return m_x; }
251 int GetY() const { return m_y; }
a29a241f
RD
252 wxString GetDragText() { return m_dragText; }
253 bool GetDragAllowMove() { return m_dragAllowMove; }
254 wxDragResult GetDragResult() { return m_dragResult; }
f97d84a6
RD
255
256 bool GetShift() const;
257 bool GetControl() const;
258 bool GetAlt() const;
259
5fa4613c 260 virtual wxEvent* Clone() const { return new wxStyledTextEvent(*this); }
f97d84a6
RD
261
262#ifndef SWIG
263private:
264 DECLARE_DYNAMIC_CLASS(wxStyledTextEvent)
265
266 int m_position;
267 int m_key;
268 int m_modifiers;
269
270 int m_modificationType; // wxEVT_STC_MODIFIED
271 wxString m_text;
272 int m_length;
273 int m_linesAdded;
274 int m_line;
275 int m_foldLevelNow;
276 int m_foldLevelPrev;
277
278 int m_margin; // wxEVT_STC_MARGINCLICK
279
280 int m_message; // wxEVT_STC_MACRORECORD
281 int m_wParam;
282 int m_lParam;
65ec6247
RD
283
284 int m_listType;
285 int m_x;
286 int m_y;
a29a241f
RD
287
288 wxString m_dragText; // wxEVT_STC_START_DRAG, wxEVT_STC_DO_DROP
289 bool m_dragAllowMove; // wxEVT_STC_START_DRAG
290
291 wxDragResult m_dragResult; // wxEVT_STC_DRAG_OVER,wxEVT_STC_DO_DROP
f97d84a6
RD
292#endif
293};
294
d25f5fbb
RD
295#ifndef SWIG
296BEGIN_DECLARE_EVENT_TYPES()
65ec6247
RD
297 DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_CHANGE, 1650)
298 DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_STYLENEEDED, 1651)
299 DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_CHARADDED, 1652)
300 DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_SAVEPOINTREACHED, 1653)
301 DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_SAVEPOINTLEFT, 1654)
302 DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_ROMODIFYATTEMPT, 1655)
303 DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_KEY, 1656)
304 DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DOUBLECLICK, 1657)
305 DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_UPDATEUI, 1658)
306 DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_MODIFIED, 1659)
307 DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_MACRORECORD, 1660)
308 DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_MARGINCLICK, 1661)
309 DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_NEEDSHOWN, 1662)
310 DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_POSCHANGED, 1663)
311 DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_PAINTED, 1664)
312 DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_USERLISTSELECTION, 1665)
313 DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_URIDROPPED, 1666)
314 DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DWELLSTART, 1667)
315 DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DWELLEND, 1668)
a29a241f
RD
316 DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_START_DRAG, 1669)
317 DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DRAG_OVER, 1670)
318 DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DO_DROP, 1671)
d25f5fbb
RD
319END_DECLARE_EVENT_TYPES()
320#else
321 enum {
322 wxEVT_STC_CHANGE,
323 wxEVT_STC_STYLENEEDED,
324 wxEVT_STC_CHARADDED,
d25f5fbb
RD
325 wxEVT_STC_SAVEPOINTREACHED,
326 wxEVT_STC_SAVEPOINTLEFT,
327 wxEVT_STC_ROMODIFYATTEMPT,
65ec6247 328 wxEVT_STC_KEY,
d25f5fbb 329 wxEVT_STC_DOUBLECLICK,
65ec6247 330 wxEVT_STC_UPDATEUI,
d25f5fbb 331 wxEVT_STC_MODIFIED,
d25f5fbb
RD
332 wxEVT_STC_MACRORECORD,
333 wxEVT_STC_MARGINCLICK,
334 wxEVT_STC_NEEDSHOWN,
65ec6247
RD
335 wxEVT_STC_POSCHANGED,
336 wxEVT_STC_PAINTED,
337 wxEVT_STC_USERLISTSELECTION,
338 wxEVT_STC_URIDROPPED,
339 wxEVT_STC_DWELLSTART,
340 wxEVT_STC_DWELLEND,
a29a241f
RD
341 wxEVT_STC_START_DRAG,
342 wxEVT_STC_DRAG_OVER,
343 wxEVT_STC_DO_DROP,
d25f5fbb
RD
344 };
345#endif
f97d84a6 346
f97d84a6
RD
347
348
349#ifndef SWIG
350typedef void (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&);
351
65ec6247
RD
352#define EVT_STC_CHANGE(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CHANGE, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
353#define EVT_STC_STYLENEEDED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_STYLENEEDED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
354#define EVT_STC_CHARADDED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CHARADDED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
355#define EVT_STC_SAVEPOINTREACHED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_SAVEPOINTREACHED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
356#define EVT_STC_SAVEPOINTLEFT(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_SAVEPOINTLEFT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
357#define EVT_STC_ROMODIFYATTEMPT(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_ROMODIFYATTEMPT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
358#define EVT_STC_KEY(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_KEY, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
359#define EVT_STC_DOUBLECLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DOUBLECLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
360#define EVT_STC_UPDATEUI(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_UPDATEUI, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
361#define EVT_STC_MODIFIED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MODIFIED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
362#define EVT_STC_MACRORECORD(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MACRORECORD, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
363#define EVT_STC_MARGINCLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MARGINCLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
364#define EVT_STC_NEEDSHOWN(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_NEEDSHOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
365#define EVT_STC_POSCHANGED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_POSCHANGED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
366#define EVT_STC_PAINTED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_PAINTED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
367#define EVT_STC_USERLISTSELECTION(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_USERLISTSELECTION, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
368#define EVT_STC_URIDROPPED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_URIDROPPED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
369#define EVT_STC_DWELLSTART(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLSTART, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
370#define EVT_STC_DWELLEND(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLEND, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
a29a241f
RD
371#define EVT_STC_START_DRAG(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_START_DRAG, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
372#define EVT_STC_DRAG_OVER(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DRAG_OVER, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
373#define EVT_STC_DO_DROP(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DO_DROP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
1bc32508 374#endif
f97d84a6
RD
375
376//----------------------------------------------------------------------
377//----------------------------------------------------------------------
378#endif
379
380