]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/richtext.i
fixes for compilation with wxUSE_XXX==0 and some other minor fixes (patch 1569904)
[wxWidgets.git] / wxPython / src / richtext.i
CommitLineData
30fc5e8f
RD
1/////////////////////////////////////////////////////////////////////////////
2// Name: richtext.i
3// Purpose: Classes for wxRichTExtCtrl and support classes
4//
5// Author: Robin Dunn
6//
7// Created: 11-April-2006
8// RCS-ID: $Id$
9// Copyright: (c) 2006 by Total Control Software
10// Licence: wxWindows license
11/////////////////////////////////////////////////////////////////////////////
12
13%define DOCSTRING
14""
15%enddef
16
17%module(package="wx", docstring=DOCSTRING) richtext
18
19%{
20#include "wx/wxPython/wxPython.h"
21#include "wx/wxPython/pyclasses.h"
22#include "wx/wxPython/printfw.h"
23#include "wx/wxPython/twoitem.h"
24
25#include <wx/richtext/richtextctrl.h>
26
27
28class wxEffects;
29class wxBufferedDC;
30class wxBufferedPaintDC;
31class wxMetaFile;
32class wxMetaFileDC;
33class wxPrinterDC;
34
35%}
36
37#define USE_TEXTATTREX 0
38
39//----------------------------------------------------------------------
40
41%import windows.i
475edb11 42// ?? %import gdi.i
30fc5e8f
RD
43
44%pythoncode { wx = _core }
45%pythoncode { __docfilter__ = wx.__DocFilter(globals()) }
46
47MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
48
49//----------------------------------------------------------------------
50
51enum {
52 wxRE_READONLY,
53 wxRE_MULTILINE,
54
55 wxRICHTEXT_SHIFT_DOWN,
56 wxRICHTEXT_CTRL_DOWN,
57 wxRICHTEXT_ALT_DOWN,
58
59 wxRICHTEXT_SELECTED,
60 wxRICHTEXT_TAGGED,
61 wxRICHTEXT_FOCUSSED,
62 wxRICHTEXT_IS_FOCUS,
63
64 wxRICHTEXT_TYPE_ANY,
65 wxRICHTEXT_TYPE_TEXT,
66 wxRICHTEXT_TYPE_XML,
67 wxRICHTEXT_TYPE_HTML,
68 wxRICHTEXT_TYPE_RTF,
69 wxRICHTEXT_TYPE_PDF,
70
71 wxRICHTEXT_FIXED_WIDTH,
72 wxRICHTEXT_FIXED_HEIGHT,
73 wxRICHTEXT_VARIABLE_WIDTH,
74 wxRICHTEXT_VARIABLE_HEIGHT,
75
76
77 wxRICHTEXT_HITTEST_NONE,
78 wxRICHTEXT_HITTEST_BEFORE,
79 wxRICHTEXT_HITTEST_AFTER,
80 wxRICHTEXT_HITTEST_ON,
81
82 wxRICHTEXT_FORMATTED,
83 wxRICHTEXT_UNFORMATTED,
bdec7d7a
RD
84
85 wxRICHTEXT_INSERT_NONE,
86 wxRICHTEXT_INSERT_WITH_PREVIOUS_PARAGRAPH_STYLE,
87
30fc5e8f
RD
88
89
90 // TODO: Rename these to be wxRICHTEXT_* ??
91
92 wxTEXT_ATTR_TEXT_COLOUR,
93 wxTEXT_ATTR_BACKGROUND_COLOUR,
94 wxTEXT_ATTR_FONT_FACE,
95 wxTEXT_ATTR_FONT_SIZE,
96 wxTEXT_ATTR_FONT_WEIGHT,
97 wxTEXT_ATTR_FONT_ITALIC,
98 wxTEXT_ATTR_FONT_UNDERLINE,
99 wxTEXT_ATTR_FONT,
100 wxTEXT_ATTR_ALIGNMENT,
101 wxTEXT_ATTR_LEFT_INDENT,
102 wxTEXT_ATTR_RIGHT_INDENT,
103 wxTEXT_ATTR_TABS,
104
105 wxTEXT_ATTR_PARA_SPACING_AFTER,
106 wxTEXT_ATTR_PARA_SPACING_BEFORE,
107 wxTEXT_ATTR_LINE_SPACING,
108 wxTEXT_ATTR_CHARACTER_STYLE_NAME,
109 wxTEXT_ATTR_PARAGRAPH_STYLE_NAME,
110 wxTEXT_ATTR_BULLET_STYLE,
111 wxTEXT_ATTR_BULLET_NUMBER,
112 wxTEXT_ATTR_BULLET_SYMBOL,
113
114 wxTEXT_ATTR_BULLET_STYLE_NONE,
115 wxTEXT_ATTR_BULLET_STYLE_ARABIC,
116 wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER,
117 wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER,
118 wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER,
119 wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER,
120 wxTEXT_ATTR_BULLET_STYLE_SYMBOL,
121 wxTEXT_ATTR_BULLET_STYLE_BITMAP,
122 wxTEXT_ATTR_BULLET_STYLE_PARENTHESES,
123 wxTEXT_ATTR_BULLET_STYLE_PERIOD,
124
125 wxTEXT_ATTR_LINE_SPACING_NORMAL,
126 wxTEXT_ATTR_LINE_SPACING_HALF,
127 wxTEXT_ATTR_LINE_SPACING_TWICE,
128
129};
130
131enum wxTextAttrAlignment
132{
133 wxTEXT_ALIGNMENT_DEFAULT,
134 wxTEXT_ALIGNMENT_LEFT,
135 wxTEXT_ALIGNMENT_CENTRE,
136 wxTEXT_ALIGNMENT_CENTER = wxTEXT_ALIGNMENT_CENTRE,
137 wxTEXT_ALIGNMENT_RIGHT,
138 wxTEXT_ALIGNMENT_JUSTIFIED
139};
140
141//----------------------------------------------------------------------
142
143%typemap(in) wxRichTextRange& (wxRichTextRange temp) {
144 $1 = &temp;
145 if ( ! wxRichTextRange_helper($input, &$1)) SWIG_fail;
146}
147%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER) wxRichTextRange& {
148 $1 = wxPySimple_typecheck($input, wxT("wxRichTextRange"), 2);
149}
150
151
152%{
153
154bool wxRichTextRange_helper(PyObject* source, wxRichTextRange** obj)
155{
156 if (source == Py_None) {
157 **obj = wxRICHTEXT_NONE;
158 return true;
159 }
160 return wxPyTwoIntItem_helper(source, obj, wxT("wxRichTextRange"));
161}
162%}
163
164
165
166DocStr(wxRichTextRange,
167"RichTextRange is a data structure that represents a range of text
168within a `RichTextCtrl`. It simply contains integer ``start`` and
169``end`` properties and a few operations useful for dealing with
170ranges. In most places in wxPython where a RichTextRange is expected a
1712-tuple containing (start, end) can be used instead.", "");
172
173class wxRichTextRange
174{
175public:
176 DocCtorStr(
177 wxRichTextRange(long start=0, long end=0),
178 "Creates a new range object.", "");
179
180 ~wxRichTextRange();
181
182 %extend {
183 KeepGIL(__eq__);
184 DocStr(__eq__, "Test for equality of RichTextRange objects.", "");
185 bool __eq__(PyObject* other) {
186 wxRichTextRange temp, *obj = &temp;
187 if ( other == Py_None ) return false;
188 if ( ! wxRichTextRange_helper(other, &obj) ) {
189 PyErr_Clear();
190 return false;
191 }
192 return self->operator==(*obj);
193 }
194 }
195
196
197 DocDeclStr(
198 wxRichTextRange , operator -(const wxRichTextRange& range) const,
199 "", "");
200
201 DocDeclStr(
202 wxRichTextRange , operator +(const wxRichTextRange& range) const,
203 "", "");
204
205
206 DocDeclStr(
207 void , SetRange(long start, long end),
208 "", "");
209
210
211 DocDeclStr(
212 void , SetStart(long start),
213 "", "");
214
215 DocDeclStr(
216 long , GetStart() const,
217 "", "");
218
219 %pythoncode { start = property(GetStart, SetStart) }
220
221 DocDeclStr(
222 void , SetEnd(long end),
223 "", "");
224
225 DocDeclStr(
226 long , GetEnd() const,
227 "", "");
228
229 %pythoncode { end = property(GetEnd, SetEnd) }
230
231
232 DocDeclStr(
233 bool , IsOutside(const wxRichTextRange& range) const,
234 "Returns true if this range is completely outside 'range'", "");
235
236
237 DocDeclStr(
238 bool , IsWithin(const wxRichTextRange& range) const,
239 "Returns true if this range is completely within 'range'", "");
240
241
242 DocDeclStr(
243 bool , Contains(long pos) const,
244 "Returns true if the given position is within this range. Allow for the
245possibility of an empty range - assume the position is within this
246empty range.", "");
247
248
249 DocDeclStr(
250 bool , LimitTo(const wxRichTextRange& range) ,
251 "Limit this range to be within 'range'", "");
252
253
254 DocDeclStr(
255 long , GetLength() const,
256 "Gets the length of the range", "");
257
258
259 DocDeclStr(
260 void , Swap(),
261 "Swaps the start and end", "");
262
263
264 %extend {
265 DocAStr(Get,
266 "Get() -> (start,end)",
267 "Returns the start and end properties as a tuple.", "");
268 PyObject* Get() {
269 wxPyBlock_t blocked = wxPyBeginBlockThreads();
270 PyObject* tup = PyTuple_New(2);
271 PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->GetStart()));
272 PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->GetEnd()));
273 wxPyEndBlockThreads(blocked);
274 return tup;
275 }
276 }
277 %pythoncode {
278 def __str__(self): return str(self.Get())
279 def __repr__(self): return 'RichTextRange'+str(self.Get())
280 def __len__(self): return len(self.Get())
281 def __getitem__(self, index): return self.Get()[index]
282 def __setitem__(self, index, val):
283 if index == 0: self.start = val
284 elif index == 1: self.end = val
285 else: raise IndexError
286 def __nonzero__(self): return self.Get() != (0,0)
287 __safe_for_unpickling__ = True
288 def __reduce__(self): return (RichTextRange, self.Get())
289 }
e70b4d2d
RD
290
291 %property(End, GetEnd, SetEnd, doc="See `GetEnd` and `SetEnd`");
292 %property(Length, GetLength, doc="See `GetLength`");
293 %property(Start, GetStart, SetStart, doc="See `GetStart` and `SetStart`");
30fc5e8f
RD
294};
295
296
297
298%{
299 wxRichTextRange wxPy_RTR_ALL(wxRICHTEXT_ALL);
300 wxRichTextRange wxPy_RTR_NONE(wxRICHTEXT_NONE);
301%}
302
303%rename(RICHTEXT_ALL) wxPy_RTR_ALL;
304%rename(RICHTEXT_NONE) wxPy_RTR_NONE;
305
306%immutable;
307wxRichTextRange wxPy_RTR_ALL;
308wxRichTextRange wxPy_RTR_NONE;
309%mutable;
310
311//----------------------------------------------------------------------
312
313DocStr(wxRichTextAttr,
314"The RichTextAttr class stored information about the various attributes
315for a block of text, including font, colour, indents, alignments, and
316etc.", "");
317
318class wxRichTextAttr
319{
320public:
321
322 wxRichTextAttr(const wxColour& colText = wxNullColour,
323 const wxColour& colBack = wxNullColour,
324 wxTextAttrAlignment alignment = wxTEXT_ALIGNMENT_DEFAULT);
325
326 ~wxRichTextAttr();
327
328// // Making a wxTextAttrEx object.
329// operator wxTextAttrEx () const ;
330
331// // Copy to a wxTextAttr
332// void CopyTo(wxTextAttrEx& attr) const;
333
334
335
336 // Create font from font attributes.
337 DocDeclStr(
338 wxFont , CreateFont() const,
339 "", "");
340
341
342 // Get attributes from font.
343 bool GetFontAttributes(const wxFont& font);
344
345 %pythoncode {
346 def GetFont(self):
347 return self.CreateFont()
348 def SetFont(self, font):
349 return self.GetFontAttributes(font)
350 }
351
352 // setters
353 void SetTextColour(const wxColour& colText);
354 void SetBackgroundColour(const wxColour& colBack);
355 void SetAlignment(wxTextAttrAlignment alignment);
356 void SetTabs(const wxArrayInt& tabs);
357 void SetLeftIndent(int indent, int subIndent = 0);
358 void SetRightIndent(int indent);
359
360 void SetFontSize(int pointSize);
361 void SetFontStyle(int fontStyle);
362 void SetFontWeight(int fontWeight);
363 void SetFontFaceName(const wxString& faceName);
364 void SetFontUnderlined(bool underlined);
365
366 void SetFlags(long flags);
367
368 void SetCharacterStyleName(const wxString& name);
369 void SetParagraphStyleName(const wxString& name);
370 void SetParagraphSpacingAfter(int spacing);
371 void SetParagraphSpacingBefore(int spacing);
372 void SetLineSpacing(int spacing);
373 void SetBulletStyle(int style);
374 void SetBulletNumber(int n);
375 void SetBulletSymbol(wxChar symbol);
376
377 const wxColour& GetTextColour() const;
378 const wxColour& GetBackgroundColour() const;
379 wxTextAttrAlignment GetAlignment() const;
380 const wxArrayInt& GetTabs() const;
381 long GetLeftIndent() const;
382 long GetLeftSubIndent() const;
383 long GetRightIndent() const;
384 long GetFlags() const;
385
386 int GetFontSize() const;
387 int GetFontStyle() const;
388 int GetFontWeight() const;
389 bool GetFontUnderlined() const;
390 const wxString& GetFontFaceName() const;
391
392 const wxString& GetCharacterStyleName() const;
393 const wxString& GetParagraphStyleName() const;
394 int GetParagraphSpacingAfter() const;
395 int GetParagraphSpacingBefore() const;
396 int GetLineSpacing() const;
397 int GetBulletStyle() const;
398 int GetBulletNumber() const { return m_bulletNumber; }
399 wxChar GetBulletSymbol() const;
400
401 // accessors
402 bool HasTextColour() const;
403 bool HasBackgroundColour() const;
404 bool HasAlignment() const;
405 bool HasTabs() const;
406 bool HasLeftIndent() const;
407 bool HasRightIndent() const;
408 bool HasWeight() const;
409 bool HasSize() const;
410 bool HasItalic() const;
411 bool HasUnderlined() const;
412 bool HasFaceName() const;
413 bool HasFont() const;
414
415 bool HasParagraphSpacingAfter() const;
416 bool HasParagraphSpacingBefore() const;
417 bool HasLineSpacing() const;
418 bool HasCharacterStyleName() const;
419 bool HasParagraphStyleName() const;
420 bool HasBulletStyle() const;
421 bool HasBulletNumber() const;
422 bool HasBulletSymbol() const;
423
424 bool HasFlag(long flag) const;
425
426 // Is this a character style?
427 bool IsCharacterStyle() const;
428 bool IsParagraphStyle() const;
429
430 // returns false if we have any attributes set, true otherwise
431 bool IsDefault() const;
432
475edb11
RD
433
434// // return the attribute having the valid font and colours: it uses the
435// // attributes set in attr and falls back first to attrDefault and then to
436// // the text control font/colours for those attributes which are not set
437// static wxRichTextAttr Combine(const wxRichTextAttr& attr,
438// const wxRichTextAttr& attrDef,
439// const wxTextCtrlBase *text);
e70b4d2d
RD
440
441
442 %property(Alignment, GetAlignment, SetAlignment, doc="See `GetAlignment` and `SetAlignment`");
443 %property(BackgroundColour, GetBackgroundColour, SetBackgroundColour, doc="See `GetBackgroundColour` and `SetBackgroundColour`");
444 %property(BulletNumber, GetBulletNumber, SetBulletNumber, doc="See `GetBulletNumber` and `SetBulletNumber`");
445 %property(BulletStyle, GetBulletStyle, SetBulletStyle, doc="See `GetBulletStyle` and `SetBulletStyle`");
446 %property(BulletSymbol, GetBulletSymbol, SetBulletSymbol, doc="See `GetBulletSymbol` and `SetBulletSymbol`");
447 %property(CharacterStyleName, GetCharacterStyleName, SetCharacterStyleName, doc="See `GetCharacterStyleName` and `SetCharacterStyleName`");
448 %property(Flags, GetFlags, SetFlags, doc="See `GetFlags` and `SetFlags`");
449 %property(Font, GetFont, SetFont, doc="See `GetFont` and `SetFont`");
450 %property(FontAttributes, GetFontAttributes, doc="See `GetFontAttributes`");
451 %property(FontFaceName, GetFontFaceName, SetFontFaceName, doc="See `GetFontFaceName` and `SetFontFaceName`");
452 %property(FontSize, GetFontSize, SetFontSize, doc="See `GetFontSize` and `SetFontSize`");
453 %property(FontStyle, GetFontStyle, SetFontStyle, doc="See `GetFontStyle` and `SetFontStyle`");
454 %property(FontUnderlined, GetFontUnderlined, SetFontUnderlined, doc="See `GetFontUnderlined` and `SetFontUnderlined`");
455 %property(FontWeight, GetFontWeight, SetFontWeight, doc="See `GetFontWeight` and `SetFontWeight`");
456 %property(LeftIndent, GetLeftIndent, SetLeftIndent, doc="See `GetLeftIndent` and `SetLeftIndent`");
457 %property(LeftSubIndent, GetLeftSubIndent, doc="See `GetLeftSubIndent`");
458 %property(LineSpacing, GetLineSpacing, SetLineSpacing, doc="See `GetLineSpacing` and `SetLineSpacing`");
459 %property(ParagraphSpacingAfter, GetParagraphSpacingAfter, SetParagraphSpacingAfter, doc="See `GetParagraphSpacingAfter` and `SetParagraphSpacingAfter`");
460 %property(ParagraphSpacingBefore, GetParagraphSpacingBefore, SetParagraphSpacingBefore, doc="See `GetParagraphSpacingBefore` and `SetParagraphSpacingBefore`");
461 %property(ParagraphStyleName, GetParagraphStyleName, SetParagraphStyleName, doc="See `GetParagraphStyleName` and `SetParagraphStyleName`");
462 %property(RightIndent, GetRightIndent, SetRightIndent, doc="See `GetRightIndent` and `SetRightIndent`");
463 %property(Tabs, GetTabs, SetTabs, doc="See `GetTabs` and `SetTabs`");
464 %property(TextColour, GetTextColour, SetTextColour, doc="See `GetTextColour` and `SetTextColour`");
30fc5e8f
RD
465};
466
467
468enum {
469 wxTEXT_ATTR_CHARACTER,
470 wxTEXT_ATTR_PARAGRAPH,
471 wxTEXT_ATTR_ALL
472};
473
474
475//----------------------------------------------------------------------
476//----------------------------------------------------------------------
477
478MustHaveApp(wxRichTextCtrl);
479DocStr(wxRichTextCtrl,
480"", "");
481
482class wxRichTextCtrl : public wxScrolledWindow
483{
484public:
485 %pythonAppend wxRichTextCtrl "self._setOORInfo(self)"
486 %pythonAppend wxRichTextCtrl() ""
487
488 wxRichTextCtrl( wxWindow* parent,
489 wxWindowID id = -1,
80b08b7f 490 const wxString& value = wxPyEmptyString,
30fc5e8f
RD
491 const wxPoint& pos = wxDefaultPosition,
492 const wxSize& size = wxDefaultSize,
493 long style = wxRE_MULTILINE );
494 %RenameCtor(PreRichTextCtrl, wxRichTextCtrl());
495
496
497 bool Create( wxWindow* parent,
498 wxWindowID id = -1,
80b08b7f 499 const wxString& value = wxPyEmptyString,
30fc5e8f
RD
500 const wxPoint& pos = wxDefaultPosition,
501 const wxSize& size = wxDefaultSize,
502 long style = wxRE_MULTILINE );
503
504
505 DocDeclStr(
506 virtual wxString , GetValue() const,
507 "", "");
508
509 DocDeclStr(
510 virtual void , SetValue(const wxString& value),
511 "", "");
512
513
514 DocDeclStr(
515 virtual wxString , GetRange(long from, long to) const,
516 "", "");
517
518
519 DocDeclStr(
520 virtual int , GetLineLength(long lineNo) const ,
521 "", "");
522
523 DocDeclStr(
524 virtual wxString , GetLineText(long lineNo) const ,
525 "", "");
526
527 DocDeclStr(
528 virtual int , GetNumberOfLines() const ,
529 "", "");
530
531
532 DocDeclStr(
533 virtual bool , IsModified() const ,
534 "", "");
535
536 DocDeclStr(
537 virtual bool , IsEditable() const ,
538 "", "");
539
540
541 // more readable flag testing methods
542 DocDeclStr(
543 bool , IsSingleLine() const,
544 "", "");
545
546 DocDeclStr(
547 bool , IsMultiLine() const,
548 "", "");
549
550
551 DocDeclAStr(
552 virtual void , GetSelection(long* OUTPUT, long* OUTPUT) const,
553 "GetSelection() --> (start, end)",
554 "Returns the start and end positions of the current selection. If the
555values are the same then there is no selection.", "");
556
557
558 DocDeclStr(
559 virtual wxString , GetStringSelection() const,
560 "", "");
561
562
563 DocDeclStr(
564 wxString , GetFilename() const,
565 "", "");
566
567
568 DocDeclStr(
569 void , SetFilename(const wxString& filename),
570 "", "");
571
572
573 DocDeclStr(
574 void , SetDelayedLayoutThreshold(long threshold),
575 "Set the threshold in character positions for doing layout optimization
576during sizing.", "");
577
578
579 DocDeclStr(
580 long , GetDelayedLayoutThreshold() const,
581 "Get the threshold in character positions for doing layout optimization
582during sizing.", "");
583
584
585
586 DocDeclStr(
587 virtual void , Clear(),
588 "", "");
589
590 DocDeclStr(
591 virtual void , Replace(long from, long to, const wxString& value),
592 "", "");
593
594 DocDeclStr(
595 virtual void , Remove(long from, long to),
596 "", "");
597
598
599 DocDeclStr(
600 virtual bool , LoadFile(const wxString& file, int type = wxRICHTEXT_TYPE_ANY),
601 "Load the contents of the document from the given filename.", "");
602
603 DocDeclStr(
604 virtual bool , SaveFile(const wxString& file = wxPyEmptyString,
605 int type = wxRICHTEXT_TYPE_ANY),
606 "Save the contents of the document to the given filename, or if the
a2cccbc3 607empty string is passed then to the filename set with `SetFilename`.", "");
30fc5e8f
RD
608
609
610 // sets/clears the dirty flag
611 DocDeclStr(
612 virtual void , MarkDirty(),
613 "Sets the dirty flag, meaning that the contents of the control have
614changed and need to be saved.", "");
615
616 DocDeclStr(
617 virtual void , DiscardEdits(),
618 "Clears the dirty flag.
619:see: `MarkDirty`", "");
620
621
622 DocDeclStr(
623 virtual void , SetMaxLength(unsigned long len),
624 "Set the max number of characters which may be entered in a single line
625text control.", "");
626
627
628 DocDeclStr(
629 virtual void , WriteText(const wxString& text),
630 "Insert text at the current position.", "");
631
632 DocDeclStr(
633 virtual void , AppendText(const wxString& text),
634 "Append text to the end of the document.", "");
635
636
637 DocDeclStr(
638 virtual bool , SetStyle(const wxRichTextRange& range, const wxRichTextAttr& style),
639 "Set the style for the text in ``range`` to ``style``", "");
640
641 DocDeclStr(
74c8720e 642 virtual bool , GetStyle(long position, wxRichTextAttr& style),
30fc5e8f 643 "Retrieve the style used at the given position. Copies the style
bdec7d7a 644values at ``position`` into the ``style`` parameter and returns ``True``
30fc5e8f
RD
645if successful. Returns ``False`` otherwise.", "");
646
bdec7d7a
RD
647 DocDeclStr(
648 virtual bool , GetUncombinedStyle(long position, wxRichTextAttr& style),
649 "Get the content (uncombined) attributes for this position. Copies the
650style values at ``position`` into the ``style`` parameter and returns
651``True`` if successful. Returns ``False`` otherwise.", "");
652
653
30fc5e8f
RD
654 DocDeclStr(
655 virtual bool , SetDefaultStyle(const wxRichTextAttr& style),
656 "Set the style used by default for the rich text document.", "");
657
658
659 DocDeclStrName(
660 virtual const wxRichTextAttr , GetDefaultStyleEx() const,
661 "Retrieves a copy of the default style object.", "",
662 GetDefaultStyle);
663
664
665 DocDeclStr(
666 virtual long , XYToPosition(long x, long y) const,
667 "Translate a col,row coordinants into a document position.", "");
668
669 DocDeclAStr(
670 virtual void , PositionToXY(long pos, long *OUTPUT, long *OUTPUT) const,
671 "PositionToXY(self, long pos) --> (x, y)",
672 "Retrieves the col,row for the given position within the document", "");
673
674
675 DocDeclStr(
676 virtual void , ShowPosition(long position),
677 "Ensure that the given position in the document is visible.", "");
678
679
680 DocDeclAStr(
681 virtual wxTextCtrlHitTestResult , HitTest(const wxPoint& pt, long *OUTPUT) const,
682 "HitTest(self, Point pt) --> (result, pos)",
683 "Returns the character position at the given point in pixels. Note
684that ``pt`` should be given in device coordinates, and not be adjusted
685for the client area origin nor for scrolling. The return value is a
686tuple of the hit test result and the position.", "
687
688Possible result values are a bitmask of these flags:
689
690 ========================= ====================================
691 RICHTEXT_HITTEST_NONE The point was not on this object.
692 RICHTEXT_HITTEST_BEFORE The point was before the position
693 returned from HitTest.
694 RICHTEXT_HITTEST_AFTER The point was after the position
695 returned from HitTest.
696 RICHTEXT_HITTEST_ON The point was on the position
697 returned from HitTest
698 ========================= ====================================
699");
700
701 DocDeclAStrName(
702 virtual wxTextCtrlHitTestResult , HitTest(const wxPoint& pt,
703 wxTextCoord *OUTPUT,
704 wxTextCoord *OUTPUT) const,
705 "HitTestRC(self, Point pt) --> (result, col, row)",
706 "Returns the column and row of the given point in pixels. Note that
707``pt`` should be given in device coordinates, and not be adjusted for
708the client area origin nor for scrolling. The return value is a tuple
709of the hit test result and the column and row values.", "
710:see: `HitTest`",
711 HitTestXY);
712
713
714 // Clipboard operations
715 DocDeclStr(
716 virtual void , Copy(),
717 "Copies the selected text to the clipboard.", "");
718
719 DocDeclStr(
720 virtual void , Cut(),
721 "Copies the selected text to the clipboard and removes the selection.", "");
722
723 DocDeclStr(
724 virtual void , Paste(),
725 "Pastes text from the clipboard into the document at the current
726insertion point.", "");
727
728 DocDeclStr(
729 virtual void , DeleteSelection(),
730 "Remove the current selection.", "");
731
732
733 DocDeclStr(
734 virtual bool , CanCopy() const,
735 "Returns ``True`` if the selection can be copied to the clipboard.", "");
736
737 DocDeclStr(
738 virtual bool , CanCut() const,
739 "Returns ``True`` if the selection can be cut to the clipboard.", "");
740
741 DocDeclStr(
742 virtual bool , CanPaste() const,
743 "Returns ``True`` if the current contents of the clipboard can be
744pasted into the document.", "");
745
746 DocDeclStr(
747 virtual bool , CanDeleteSelection() const,
748 "Returns ``True`` if the selection can be removed from the document.", "");
749
750
751 // Undo/redo
752 DocDeclStr(
753 virtual void , Undo(),
754 "If the last operation can be undone, undoes the last operation.", "");
755
756 DocDeclStr(
757 virtual void , Redo(),
758 "If the last operation can be redone, redoes the last operation.", "");
759
760
761 DocDeclStr(
762 virtual bool , CanUndo() const,
763 "Returns ``True`` if the last operation can be undone.", "");
764
765 DocDeclStr(
766 virtual bool , CanRedo() const,
767 "Returns ``True`` if the last operation can be redone.", "");
768
769
770 // Insertion point
771 DocDeclStr(
772 virtual void , SetInsertionPoint(long pos),
773 "Sets the insertion point at the given position.", "");
774
775 DocDeclStr(
776 virtual void , SetInsertionPointEnd(),
777 "Moves the insertion point to the end of the document.", "");
778
779 DocDeclStr(
780 virtual long , GetInsertionPoint() const,
781 "Returns the insertion point. This is defined as the zero based index
782of the character position to the right of the insertion point.", "");
783
784 DocDeclStr(
785 virtual long , GetLastPosition() const,
786 "Returns the zero based index of the last position in the document.", "");
787
788
789 DocDeclStr(
790 virtual void , SetSelection(long from, long to),
791 "Selects the text starting at the first position up to (but not
792including) the character at the last position. If both parameters are
793equal to -1 then all text in the control is selected.", "");
794
795 DocDeclStr(
796 virtual void , SelectAll(),
797 "Select all text in the document.", "");
798
799 DocDeclStr(
800 virtual void , SetEditable(bool editable),
801 "Makes the document editable or read-only, overriding the RE_READONLY
802flag.", "");
803
804
805// /// Call Freeze to prevent refresh
806// virtual void Freeze();
807
808// /// Call Thaw to refresh
809// virtual void Thaw();
810
811// /// Call Thaw to refresh
812// DocDeclStr(
813// virtual bool , IsFrozen() const,
814// "", "");
815
816
817 DocDeclStr(
818 virtual bool , HasSelection() const,
819 "", "");
820
821
822///// Functionality specific to wxRichTextCtrl
823
824 /// Write an image at the current insertion point. Supply optional type to use
825 /// for internal and file storage of the raw data.
826 DocDeclStr(
827 virtual bool , WriteImage(const wxImage& image, int bitmapType = wxBITMAP_TYPE_PNG),
828 "", "");
829
830
831 /// Write a bitmap at the current insertion point. Supply optional type to use
832 /// for internal and file storage of the raw data.
833 DocDeclStrName(
834 virtual bool , WriteImage(const wxBitmap& bitmap, int bitmapType = wxBITMAP_TYPE_PNG),
835 "", "",
836 WriteBitmap);
837
838
839 /// Load an image from file and write at the current insertion point.
840 DocDeclStrName(
841 virtual bool , WriteImage(const wxString& filename, int bitmapType),
842 "", "",
843 WriteImageFile);
844
845
846 /// Write an image block at the current insertion point.
847 DocDeclStrName(
848 virtual bool , WriteImage(const wxRichTextImageBlock& imageBlock),
849 "", "",
850 WriteImageBlock);
851
852
853 /// Insert a newline (actually paragraph) at the current insertion point.
854 DocDeclStr(
855 virtual bool , Newline(),
856 "", "");
857
858
859#if USE_TEXTATTREX
860/// Set basic (overall) style
861 DocDeclStr(
862 virtual void , SetBasicStyle(const wxTextAttrEx& style),
863 "", "");
864#endif
865
866 DocDeclStr(
867 virtual void , SetBasicStyle(const wxRichTextAttr& style),
868 "", "");
869
870
871#if USE_TEXTATTREX
872 /// Get basic (overall) style
873 DocDeclStr(
874 virtual const wxTextAttrEx& , GetBasicStyle() const,
875 "", "");
876
877
878 /// Begin using a style
879 DocDeclStr(
880 virtual bool , BeginStyle(const wxTextAttrEx& style),
881 "", "");
882#endif
883
884 /// End the style
885 DocDeclStr(
886 virtual bool , EndStyle(),
887 "", "");
888
889
890 /// End all styles
891 DocDeclStr(
892 virtual bool , EndAllStyles(),
893 "", "");
894
895
896 /// Begin using bold
897 DocDeclStr(
898 bool , BeginBold(),
899 "", "");
900
901
902 /// End using bold
903 DocDeclStr(
904 bool , EndBold(),
905 "", "");
906
907
908 /// Begin using italic
909 DocDeclStr(
910 bool , BeginItalic(),
911 "", "");
912
913
914 /// End using italic
915 DocDeclStr(
916 bool , EndItalic(),
917 "", "");
918
919
920 /// Begin using underline
921 DocDeclStr(
922 bool , BeginUnderline(),
923 "", "");
924
925
926 /// End using underline
927 DocDeclStr(
928 bool , EndUnderline(),
929 "", "");
930
931
932 /// Begin using point size
933 DocDeclStr(
934 bool , BeginFontSize(int pointSize),
935 "", "");
936
937
938 /// End using point size
939 DocDeclStr(
940 bool , EndFontSize(),
941 "", "");
942
943
944 /// Begin using this font
945 DocDeclStr(
946 bool , BeginFont(const wxFont& font),
947 "", "");
948
949
950 /// End using a font
951 DocDeclStr(
952 bool , EndFont(),
953 "", "");
954
955
956 /// Begin using this colour
957 DocDeclStr(
958 bool , BeginTextColour(const wxColour& colour),
959 "", "");
960
961
962 /// End using a colour
963 DocDeclStr(
964 bool , EndTextColour(),
965 "", "");
966
967
968 /// Begin using alignment
969 DocDeclStr(
970 bool , BeginAlignment(wxTextAttrAlignment alignment),
971 "", "");
972
973
974 /// End alignment
975 DocDeclStr(
976 bool , EndAlignment(),
977 "", "");
978
979
980 /// Begin left indent
981 DocDeclStr(
982 bool , BeginLeftIndent(int leftIndent, int leftSubIndent = 0),
983 "", "");
984
985
986 /// End left indent
987 DocDeclStr(
988 bool , EndLeftIndent(),
989 "", "");
990
991
992 /// Begin right indent
993 DocDeclStr(
994 bool , BeginRightIndent(int rightIndent),
995 "", "");
996
997
998 /// End right indent
999 DocDeclStr(
1000 bool , EndRightIndent(),
1001 "", "");
1002
1003
1004 /// Begin paragraph spacing
1005 DocDeclStr(
1006 bool , BeginParagraphSpacing(int before, int after),
1007 "", "");
1008
1009
1010 /// End paragraph spacing
1011 DocDeclStr(
1012 bool , EndParagraphSpacing(),
1013 "", "");
1014
1015
1016 /// Begin line spacing
1017 DocDeclStr(
1018 bool , BeginLineSpacing(int lineSpacing),
1019 "", "");
1020
1021
1022 /// End line spacing
1023 DocDeclStr(
1024 bool , EndLineSpacing(),
1025 "", "");
1026
1027
1028 /// Begin numbered bullet
1029 DocDeclStr(
1030 bool , BeginNumberedBullet(int bulletNumber,
1031 int leftIndent,
1032 int leftSubIndent,
1033 int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_ARABIC|wxTEXT_ATTR_BULLET_STYLE_PERIOD),
1034 "", "");
1035
1036
1037 /// End numbered bullet
1038 DocDeclStr(
1039 bool , EndNumberedBullet(),
1040 "", "");
1041
1042
1043 /// Begin symbol bullet
1044 DocDeclStr(
1045 bool , BeginSymbolBullet(char symbol,
1046 int leftIndent,
1047 int leftSubIndent,
1048 int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_SYMBOL),
1049 "", "");
1050
1051
1052 /// End symbol bullet
1053 DocDeclStr(
1054 bool , EndSymbolBullet(),
1055 "", "");
1056
1057
1058 /// Begin named character style
1059 DocDeclStr(
1060 bool , BeginCharacterStyle(const wxString& characterStyle),
1061 "", "");
1062
1063
1064 /// End named character style
1065 DocDeclStr(
1066 bool , EndCharacterStyle(),
1067 "", "");
1068
1069
1070 /// Begin named paragraph style
1071 DocDeclStr(
1072 bool , BeginParagraphStyle(const wxString& paragraphStyle),
1073 "", "");
1074
1075
1076 /// End named character style
1077 DocDeclStr(
1078 bool , EndParagraphStyle(),
1079 "", "");
1080
1081
1082 /// Sets the default style to the style under the cursor
1083 DocDeclStr(
1084 bool , SetDefaultStyleToCursorStyle(),
1085 "", "");
1086
1087
1088 /// Clear the selection
1089 DocDeclStr(
1090 virtual void , SelectNone(),
1091 "", "");
1092
bdec7d7a
RD
1093 /// Select the word at the given character position
1094 DocDeclStr(
1095 virtual bool , SelectWord(long position),
1096 "", "");
1097
30fc5e8f
RD
1098
1099 /// Get/set the selection range in character positions. -1, -1 means no selection.
1100 DocDeclStr(
74c8720e 1101 wxRichTextRange , GetSelectionRange() const,
30fc5e8f
RD
1102 "", "");
1103
1104 DocDeclStr(
1105 void , SetSelectionRange(const wxRichTextRange& range),
1106 "", "");
1107
74c8720e
RD
1108 /// Get/set the selection range in character positions. -1, -1 means no selection.
1109 /// The range is in internal format, i.e. a single character selection is denoted
1110 /// by (n, n)
1111 DocDeclStr(
1112 const wxRichTextRange& , GetInternalSelectionRange() const,
1113 "", "");
1114
1115 DocDeclStr(
1116 void , SetInternalSelectionRange(const wxRichTextRange& range),
1117 "", "");
1118
1119
30fc5e8f
RD
1120
1121 /// Add a new paragraph of text to the end of the buffer
1122 DocDeclStr(
1123 virtual wxRichTextRange , AddParagraph(const wxString& text),
1124 "", "");
1125
1126
1127 /// Add an image
1128 DocDeclStr(
1129 virtual wxRichTextRange , AddImage(const wxImage& image),
1130 "", "");
1131
1132
1133 /// Layout the buffer: which we must do before certain operations, such as
1134 /// setting the caret position.
1135 DocDeclStr(
1136 virtual bool , LayoutContent(bool onlyVisibleRect = false),
1137 "", "");
1138
1139
1140 /// Move the caret to the given character position
1141 DocDeclStr(
1142 virtual bool , MoveCaret(long pos, bool showAtLineStart = false),
1143 "", "");
1144
1145
1146 /// Move right
1147 DocDeclStr(
1148 virtual bool , MoveRight(int noPositions = 1, int flags = 0),
1149 "", "");
1150
1151
1152 /// Move left
1153 DocDeclStr(
1154 virtual bool , MoveLeft(int noPositions = 1, int flags = 0),
1155 "", "");
1156
1157
1158 /// Move up
1159 DocDeclStr(
1160 virtual bool , MoveUp(int noLines = 1, int flags = 0),
1161 "", "");
1162
1163
1164 /// Move up
1165 DocDeclStr(
1166 virtual bool , MoveDown(int noLines = 1, int flags = 0),
1167 "", "");
1168
1169
1170 /// Move to the end of the line
1171 DocDeclStr(
1172 virtual bool , MoveToLineEnd(int flags = 0),
1173 "", "");
1174
1175
1176 /// Move to the start of the line
1177 DocDeclStr(
1178 virtual bool , MoveToLineStart(int flags = 0),
1179 "", "");
1180
1181
1182 /// Move to the end of the paragraph
1183 DocDeclStr(
1184 virtual bool , MoveToParagraphEnd(int flags = 0),
1185 "", "");
1186
1187
1188 /// Move to the start of the paragraph
1189 DocDeclStr(
1190 virtual bool , MoveToParagraphStart(int flags = 0),
1191 "", "");
1192
1193
1194 /// Move to the start of the buffer
1195 DocDeclStr(
1196 virtual bool , MoveHome(int flags = 0),
1197 "", "");
1198
1199
1200 /// Move to the end of the buffer
1201 DocDeclStr(
1202 virtual bool , MoveEnd(int flags = 0),
1203 "", "");
1204
1205
1206 /// Move n pages up
1207 DocDeclStr(
1208 virtual bool , PageUp(int noPages = 1, int flags = 0),
1209 "", "");
1210
1211
1212 /// Move n pages down
1213 DocDeclStr(
1214 virtual bool , PageDown(int noPages = 1, int flags = 0),
1215 "", "");
1216
1217
1218 /// Move n words left
1219 DocDeclStr(
1220 virtual bool , WordLeft(int noPages = 1, int flags = 0),
1221 "", "");
1222
1223
1224 /// Move n words right
1225 DocDeclStr(
1226 virtual bool , WordRight(int noPages = 1, int flags = 0),
1227 "", "");
1228
1229
1230 /// Returns the buffer associated with the control.
1231// wxRichTextBuffer& GetBuffer();
1232 DocDeclStr(
1233 const wxRichTextBuffer& , GetBuffer() const,
1234 "", "");
1235
1236
1237 /// Start batching undo history for commands.
1238 DocDeclStr(
1239 virtual bool , BeginBatchUndo(const wxString& cmdName),
1240 "", "");
1241
1242
1243 /// End batching undo history for commands.
1244 DocDeclStr(
1245 virtual bool , EndBatchUndo(),
1246 "", "");
1247
1248
1249 /// Are we batching undo history for commands?
1250 DocDeclStr(
1251 virtual bool , BatchingUndo() const,
1252 "", "");
1253
1254
1255 /// Start suppressing undo history for commands.
1256 DocDeclStr(
1257 virtual bool , BeginSuppressUndo(),
1258 "", "");
1259
1260
1261 /// End suppressing undo history for commands.
1262 DocDeclStr(
1263 virtual bool , EndSuppressUndo(),
1264 "", "");
1265
1266
1267 /// Are we suppressing undo history for commands?
1268 DocDeclStr(
1269 virtual bool , SuppressingUndo() const,
1270 "", "");
1271
1272
1273 /// Test if this whole range has character attributes of the specified kind. If any
1274 /// of the attributes are different within the range, the test fails. You
1275 /// can use this to implement, for example, bold button updating. style must have
1276 /// flags indicating which attributes are of interest.
1277#if USE_TEXTATTREX
1278 DocDeclStr(
1279 virtual bool , HasCharacterAttributes(const wxRichTextRange& range,
1280 const wxTextAttrEx& style) const,
1281 "", "");
1282#endif
1283
1284 DocDeclStr(
1285 virtual bool , HasCharacterAttributes(const wxRichTextRange& range,
1286 const wxRichTextAttr& style) const,
1287 "", "");
1288
1289
1290
1291 /// Test if this whole range has paragraph attributes of the specified kind. If any
1292 /// of the attributes are different within the range, the test fails. You
1293 /// can use this to implement, for example, centering button updating. style must have
1294 /// flags indicating which attributes are of interest.
1295#if USE_TEXTATTREX
1296 DocDeclStr(
1297 virtual bool , HasParagraphAttributes(const wxRichTextRange& range,
1298 const wxTextAttrEx& style) const,
1299 "", "");
1300#endif
1301
1302 DocDeclStr(
1303 virtual bool , HasParagraphAttributes(const wxRichTextRange& range,
1304 const wxRichTextAttr& style) const,
1305 "", "");
1306
1307
1308
1309 /// Is all of the selection bold?
1310 DocDeclStr(
74c8720e 1311 virtual bool , IsSelectionBold(),
30fc5e8f
RD
1312 "", "");
1313
1314
1315 /// Is all of the selection italics?
1316 DocDeclStr(
74c8720e 1317 virtual bool , IsSelectionItalics(),
30fc5e8f
RD
1318 "", "");
1319
1320
1321 /// Is all of the selection underlined?
1322 DocDeclStr(
74c8720e 1323 virtual bool , IsSelectionUnderlined(),
30fc5e8f
RD
1324 "", "");
1325
1326
1327 /// Is all of the selection aligned according to the specified flag?
1328 DocDeclStr(
74c8720e 1329 virtual bool , IsSelectionAligned(wxTextAttrAlignment alignment),
30fc5e8f
RD
1330 "", "");
1331
1332
1333 /// Apply bold to the selection
1334 DocDeclStr(
1335 virtual bool , ApplyBoldToSelection(),
1336 "", "");
1337
1338
1339 /// Apply italic to the selection
1340 DocDeclStr(
1341 virtual bool , ApplyItalicToSelection(),
1342 "", "");
1343
1344
1345 /// Apply underline to the selection
1346 DocDeclStr(
1347 virtual bool , ApplyUnderlineToSelection(),
1348 "", "");
1349
1350
1351 /// Apply alignment to the selection
1352 DocDeclStr(
1353 virtual bool , ApplyAlignmentToSelection(wxTextAttrAlignment alignment),
1354 "", "");
1355
1356
1357 /// Set style sheet, if any.
1358 DocDeclStr(
1359 void , SetStyleSheet(wxRichTextStyleSheet* styleSheet),
1360 "", "");
1361
1362 DocDeclStr(
1363 wxRichTextStyleSheet* , GetStyleSheet() const,
1364 "", "");
1365
bdec7d7a
RD
1366 /// Apply the style sheet to the buffer, for example if the styles have changed.
1367 DocDeclStr(
1368 bool , ApplyStyleSheet(wxRichTextStyleSheet* styleSheet = NULL),
1369 "", "");
1370
1371
30fc5e8f 1372
e70b4d2d
RD
1373 %property(Buffer, GetBuffer, doc="See `GetBuffer`");
1374 %property(DefaultStyle, GetDefaultStyle, SetDefaultStyle, doc="See `GetDefaultStyle` and `SetDefaultStyle`");
1375 %property(DelayedLayoutThreshold, GetDelayedLayoutThreshold, SetDelayedLayoutThreshold, doc="See `GetDelayedLayoutThreshold` and `SetDelayedLayoutThreshold`");
1376 %property(Filename, GetFilename, SetFilename, doc="See `GetFilename` and `SetFilename`");
1377 %property(InsertionPoint, GetInsertionPoint, SetInsertionPoint, doc="See `GetInsertionPoint` and `SetInsertionPoint`");
1378 %property(InternalSelectionRange, GetInternalSelectionRange, SetInternalSelectionRange, doc="See `GetInternalSelectionRange` and `SetInternalSelectionRange`");
1379 %property(LastPosition, GetLastPosition, doc="See `GetLastPosition`");
1380 %property(NumberOfLines, GetNumberOfLines, doc="See `GetNumberOfLines`");
1381 %property(Selection, GetSelection, SetSelection, doc="See `GetSelection` and `SetSelection`");
1382 %property(SelectionRange, GetSelectionRange, SetSelectionRange, doc="See `GetSelectionRange` and `SetSelectionRange`");
1383 %property(StringSelection, GetStringSelection, doc="See `GetStringSelection`");
1384 %property(StyleSheet, GetStyleSheet, SetStyleSheet, doc="See `GetStyleSheet` and `SetStyleSheet`");
1385 %property(Value, GetValue, SetValue, doc="See `GetValue` and `SetValue`");
30fc5e8f
RD
1386
1387// Implementation
1388// TODO: Which of these should be exposed to Python?
1389
1390// /// Set font, and also default attributes
1391// virtual bool SetFont(const wxFont& font);
1392
1393// /// Set up scrollbars, e.g. after a resize
1394// virtual void SetupScrollbars(bool atTop = false);
1395
1396// /// Keyboard navigation
1397// virtual bool KeyboardNavigate(int keyCode, int flags);
1398
1399// /// Paint the background
1400// virtual void PaintBackground(wxDC& dc);
1401
1402// /// Recreate buffer bitmap if necessary
1403// virtual bool RecreateBuffer(const wxSize& size = wxDefaultSize);
1404
1405// /// Set the selection
1406// virtual void DoSetSelection(long from, long to, bool scrollCaret = true);
1407
1408// /// Write text
1409// virtual void DoWriteText(const wxString& value, bool selectionOnly = true);
1410
1411// /// Send an update event
1412// virtual bool SendUpdateEvent();
1413
1414// /// Init command event
1415// void InitCommandEvent(wxCommandEvent& event) const;
1416
1417// /// do the window-specific processing after processing the update event
1418// // (duplicated code from wxTextCtrlBase)
1419// #if !wxRICHTEXT_DERIVES_FROM_TEXTCTRLBASE
1420// virtual void DoUpdateWindowUI(wxUpdateUIEvent& event);
1421// #endif
1422
1423// /// Should we inherit colours?
1424// virtual bool ShouldInheritColours() const;
1425
1426// /// Position the caret
1427// virtual void PositionCaret();
1428
1429// /// Extend the selection, returning true if the selection was
1430// /// changed. Selections are in caret positions.
1431// virtual bool ExtendSelection(long oldPosition, long newPosition, int flags);
1432
1433// /// Scroll into view. This takes a _caret_ position.
1434// virtual bool ScrollIntoView(long position, int keyCode);
1435
1436// /// The caret position is the character position just before the caret.
1437// /// A value of -1 means the caret is at the start of the buffer.
1438// void SetCaretPosition(long position, bool showAtLineStart = false) ;
1439// long GetCaretPosition() const;
1440
1441// /// Move caret one visual step forward: this may mean setting a flag
1442// /// and keeping the same position if we're going from the end of one line
1443// /// to the start of the next, which may be the exact same caret position.
1444// void MoveCaretForward(long oldPosition) ;
1445
1446// /// Move caret one visual step forward: this may mean setting a flag
1447// /// and keeping the same position if we're going from the end of one line
1448// /// to the start of the next, which may be the exact same caret position.
1449// void MoveCaretBack(long oldPosition) ;
1450
1451// /// Get the caret height and position for the given character position
1452// bool GetCaretPositionForIndex(long position, wxRect& rect);
1453
1454// /// Gets the line for the visible caret position. If the caret is
1455// /// shown at the very end of the line, it means the next character is actually
1456// /// on the following line. So let's get the line we're expecting to find
1457// /// if this is the case.
1458// wxRichTextLine* GetVisibleLineForCaretPosition(long caretPosition) const;
1459
1460// /// Gets the command processor
1461// wxCommandProcessor* GetCommandProcessor() const;
1462
1463// /// Delete content if there is a selection, e.g. when pressing a key.
1464// /// Returns the new caret position in newPos, or leaves it if there
1465// /// was no action.
1466// bool DeleteSelectedContent(long* newPos= NULL);
1467
1468// /// Transform logical to physical
1469// wxPoint GetPhysicalPoint(const wxPoint& ptLogical) const;
1470
1471// /// Transform physical to logical
1472// wxPoint GetLogicalPoint(const wxPoint& ptPhysical) const;
1473
1474// /// Finds the caret position for the next word. Direction
1475// /// is 1 (forward) or -1 (backwards).
1476// virtual long FindNextWordPosition(int direction = 1) const;
1477
1478// /// Is the given position visible on the screen?
1479// bool IsPositionVisible(long pos) const;
1480
1481// /// Returns the first visible position in the current view
1482// long GetFirstVisiblePosition() const;
1483};
1484
1485
1486//----------------------------------------------------------------------
1487
1488
1489%constant wxEventType wxEVT_COMMAND_RICHTEXT_ITEM_SELECTED;
1490%constant wxEventType wxEVT_COMMAND_RICHTEXT_ITEM_DESELECTED;
1491%constant wxEventType wxEVT_COMMAND_RICHTEXT_LEFT_CLICK;
1492%constant wxEventType wxEVT_COMMAND_RICHTEXT_RIGHT_CLICK;
1493%constant wxEventType wxEVT_COMMAND_RICHTEXT_MIDDLE_CLICK;
1494%constant wxEventType wxEVT_COMMAND_RICHTEXT_LEFT_DCLICK;
1495%constant wxEventType wxEVT_COMMAND_RICHTEXT_RETURN;
1496
1497
1498%pythoncode {
1499EVT_RICHTEXT_ITEM_SELECTED = wx.PyEventBinder(wxEVT_COMMAND_RICHTEXT_ITEM_SELECTED, 1)
1500EVT_RICHTEXT_ITEM_DESELECTED = wx.PyEventBinder(wxEVT_COMMAND_RICHTEXT_ITEM_DESELECTED, 1)
1501EVT_RICHTEXT_LEFT_CLICK = wx.PyEventBinder(wxEVT_COMMAND_RICHTEXT_LEFT_CLICK, 1)
1502EVT_RICHTEXT_RIGHT_CLICK = wx.PyEventBinder(wxEVT_COMMAND_RICHTEXT_RIGHT_CLICK, 1)
1503EVT_RICHTEXT_MIDDLE_CLICK = wx.PyEventBinder(wxEVT_COMMAND_RICHTEXT_MIDDLE_CLICK, 1)
1504EVT_RICHTEXT_LEFT_DCLICK = wx.PyEventBinder(wxEVT_COMMAND_RICHTEXT_LEFT_DCLICK, 1)
1505EVT_RICHTEXT_RETURN = wx.PyEventBinder( wxEVT_COMMAND_RICHTEXT_RETURN, 1)
1506}
1507
1508
1509class wxRichTextEvent : public wxNotifyEvent
1510{
1511public:
1512 wxRichTextEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
1513
1514 int GetIndex() const;
1515 void SetIndex(int n);
1516
1517 int GetFlags() const;
1518 void SetFlags(int flags);
e70b4d2d
RD
1519
1520 %property(Flags, GetFlags, SetFlags, doc="See `GetFlags` and `SetFlags`");
1521 %property(Index, GetIndex, SetIndex, doc="See `GetIndex` and `SetIndex`");
30fc5e8f
RD
1522};
1523
1524//----------------------------------------------------------------------
1525
1526%init %{
1527%}
1528
1529//----------------------------------------------------------------------