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