1 /////////////////////////////////////////////////////////////////////////////
2 // Name: _richtextctrl.i
3 // Purpose: wxRichTextCtrl and related classes
7 // Created: 11-April-2006
9 // Copyright: (c) 2006 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
16 //---------------------------------------------------------------------------
21 //---------------------------------------------------------------------------
28 wxRICHTEXT_SHIFT_DOWN,
40 //---------------------------------------------------------------------------
42 MAKE_CONST_WXSTRING2(RichTextCtrlNameStr, wxT("richText"));
44 MustHaveApp(wxRichTextCtrl);
47 DocStr(wxRichTextCtrl,
51 class wxRichTextCtrl : public wxScrolledWindow
54 %pythonAppend wxRichTextCtrl "self._setOORInfo(self)"
55 %pythonAppend wxRichTextCtrl() ""
57 wxRichTextCtrl( wxWindow* parent,
59 const wxString& value = wxPyEmptyString,
60 const wxPoint& pos = wxDefaultPosition,
61 const wxSize& size = wxDefaultSize,
62 long style = wxRE_MULTILINE,
63 const wxValidator& validator = wxDefaultValidator,
64 const wxString& name = wxPyRichTextCtrlNameStr );
65 %RenameCtor(PreRichTextCtrl, wxRichTextCtrl());
68 bool Create( wxWindow* parent,
70 const wxString& value = wxPyEmptyString,
71 const wxPoint& pos = wxDefaultPosition,
72 const wxSize& size = wxDefaultSize,
73 long style = wxRE_MULTILINE,
74 const wxValidator& validator = wxDefaultValidator,
75 const wxString& name = wxPyRichTextCtrlNameStr );
79 virtual wxString , GetValue() const,
83 virtual void , SetValue(const wxString& value),
88 virtual wxString , GetRange(long from, long to) const,
93 virtual int , GetLineLength(long lineNo) const ,
97 virtual wxString , GetLineText(long lineNo) const ,
101 virtual int , GetNumberOfLines() const ,
106 virtual bool , IsModified() const ,
110 virtual bool , IsEditable() const ,
114 // more readable flag testing methods
116 bool , IsSingleLine() const,
120 bool , IsMultiLine() const,
125 virtual void , GetSelection(long* OUTPUT, long* OUTPUT) const,
126 "GetSelection() --> (start, end)",
127 "Returns the start and end positions of the current selection. If the
128 values are the same then there is no selection.", "");
132 virtual wxString , GetStringSelection() const,
137 wxString , GetFilename() const,
142 void , SetFilename(const wxString& filename),
147 void , SetDelayedLayoutThreshold(long threshold),
148 "Set the threshold in character positions for doing layout optimization
149 during sizing.", "");
153 long , GetDelayedLayoutThreshold() const,
154 "Get the threshold in character positions for doing layout optimization
155 during sizing.", "");
160 virtual void , Clear(),
164 virtual void , Replace(long from, long to, const wxString& value),
168 virtual void , Remove(long from, long to),
173 virtual bool , LoadFile(const wxString& file, int type = wxRICHTEXT_TYPE_ANY),
174 "Load the contents of the document from the given filename.", "");
177 virtual bool , SaveFile(const wxString& file = wxPyEmptyString,
178 int type = wxRICHTEXT_TYPE_ANY),
179 "Save the contents of the document to the given filename, or if the
180 empty string is passed then to the filename set with `SetFilename`.", "");
184 void , SetHandlerFlags(int flags),
185 "Set the handler flags, controlling loading and saving.", "");
188 int , GetHandlerFlags() const,
189 "Get the handler flags, controlling loading and saving.", "");
191 // sets/clears the dirty flag
193 virtual void , MarkDirty(),
194 "Sets the dirty flag, meaning that the contents of the control have
195 changed and need to be saved.", "");
198 virtual void , DiscardEdits(),
199 "Clears the dirty flag.
200 :see: `MarkDirty`", "");
204 virtual void , SetMaxLength(unsigned long len),
205 "Set the max number of characters which may be entered in a single line
210 virtual void , WriteText(const wxString& text),
211 "Insert text at the current position.", "");
214 virtual void , AppendText(const wxString& text),
215 "Append text to the end of the document.", "");
219 virtual bool , SetStyle(const wxRichTextRange& range, const wxRichTextAttr& style),
220 "Set the style for the text in ``range`` to ``style``", "");
223 virtual bool , GetStyle(long position, wxRichTextAttr& style),
224 "Retrieve the style used at the given position. Copies the style
225 values at ``position`` into the ``style`` parameter and returns ``True``
226 if successful. Returns ``False`` otherwise.", "");
230 virtual bool , GetStyleForRange(const wxRichTextRange& range, wxRichTextAttr& style),
231 "Get the common set of styles for the range", "");
235 virtual bool , SetStyleEx(const wxRichTextRange& range, const wxRichTextAttr& style,
236 int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO),
237 "Extended style setting operation with flags including:
238 RICHTEXT_SETSTYLE_WITH_UNDO, RICHTEXT_SETSTYLE_OPTIMIZE,
239 RICHTEXT_SETSTYLE_PARAGRAPHS_ONLY, RICHTEXT_SETSTYLE_CHARACTERS_ONLY", "");
244 virtual bool , GetUncombinedStyle(long position, wxRichTextAttr& style),
245 "Get the content (uncombined) attributes for this position. Copies the
246 style values at ``position`` into the ``style`` parameter and returns
247 ``True`` if successful. Returns ``False`` otherwise.", "");
251 virtual bool , SetDefaultStyle(const wxRichTextAttr& style),
252 "Set the style used by default for the rich text document.", "");
256 virtual const wxRichTextAttr , GetDefaultStyleEx() const,
257 "Retrieves a copy of the default style object.", "",
261 // TODO: Select which of these to keep or rename
264 // virtual bool SetListStyle(const wxRichTextRange& range,
265 // wxRichTextListStyleDefinition* def,
266 // int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO,
267 // int startFrom = 1, int specifiedLevel = -1);
268 virtual bool SetListStyle(const wxRichTextRange& range,
269 const wxString& defName,
270 int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO,
271 int startFrom = 1, int specifiedLevel = -1);
273 /// Clear list for given range
274 virtual bool ClearListStyle(const wxRichTextRange& range, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO);
276 /// Number/renumber any list elements in the given range
277 /// def/defName can be NULL/empty to indicate that the existing list style should be used.
278 // virtual bool NumberList(const wxRichTextRange& range,
279 // wxRichTextListStyleDefinition* def = NULL,
280 // int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO,
281 // int startFrom = 1, int specifiedLevel = -1);
282 virtual bool NumberList(const wxRichTextRange& range,
283 const wxString& defName,
284 int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO,
285 int startFrom = 1, int specifiedLevel = -1);
287 /// Promote the list items within the given range. promoteBy can be a positive or negative number, e.g. 1 or -1
288 /// def/defName can be NULL/empty to indicate that the existing list style should be used.
289 // virtual bool PromoteList(int promoteBy, const wxRichTextRange& range,
290 // wxRichTextListStyleDefinition* def = NULL,
291 // int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO,
292 // int specifiedLevel = -1);
293 virtual bool PromoteList(int promoteBy, const wxRichTextRange& range,
294 const wxString& defName,
295 int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO,
296 int specifiedLevel = -1);
298 /// Deletes the content in the given range
299 virtual bool Delete(const wxRichTextRange& range);
305 virtual long , XYToPosition(long x, long y) const,
306 "Translate a col,row coordinants into a document position.", "");
309 virtual void , PositionToXY(long pos, long *OUTPUT, long *OUTPUT) const,
310 "PositionToXY(self, long pos) --> (x, y)",
311 "Retrieves the col,row for the given position within the document", "");
315 virtual void , ShowPosition(long position),
316 "Ensure that the given position in the document is visible.", "");
320 virtual wxTextCtrlHitTestResult , HitTest(const wxPoint& pt, long *OUTPUT) const,
321 "HitTest(self, Point pt) --> (result, pos)",
322 "Returns the character position at the given point in pixels. Note
323 that ``pt`` should be given in device coordinates, and not be adjusted
324 for the client area origin nor for scrolling. The return value is a
325 tuple of the hit test result and the position.", "
327 Possible result values are a bitmask of these flags:
329 ========================= ====================================
330 RICHTEXT_HITTEST_NONE The point was not on this object.
331 RICHTEXT_HITTEST_BEFORE The point was before the position
332 returned from HitTest.
333 RICHTEXT_HITTEST_AFTER The point was after the position
334 returned from HitTest.
335 RICHTEXT_HITTEST_ON The point was on the position
336 returned from HitTest
337 ========================= ====================================
341 virtual wxTextCtrlHitTestResult , HitTest(const wxPoint& pt,
343 wxTextCoord *OUTPUT) const,
344 "HitTestRC(self, Point pt) --> (result, col, row)",
345 "Returns the column and row of the given point in pixels. Note that
346 ``pt`` should be given in device coordinates, and not be adjusted for
347 the client area origin nor for scrolling. The return value is a tuple
348 of the hit test result and the column and row values.", "
353 // Clipboard operations
355 virtual void , Copy(),
356 "Copies the selected text to the clipboard.", "");
359 virtual void , Cut(),
360 "Copies the selected text to the clipboard and removes the selection.", "");
363 virtual void , Paste(),
364 "Pastes text from the clipboard into the document at the current
365 insertion point.", "");
368 virtual void , DeleteSelection(),
369 "Remove the current selection.", "");
373 virtual bool , CanCopy() const,
374 "Returns ``True`` if the selection can be copied to the clipboard.", "");
377 virtual bool , CanCut() const,
378 "Returns ``True`` if the selection can be cut to the clipboard.", "");
381 virtual bool , CanPaste() const,
382 "Returns ``True`` if the current contents of the clipboard can be
383 pasted into the document.", "");
386 virtual bool , CanDeleteSelection() const,
387 "Returns ``True`` if the selection can be removed from the document.", "");
392 virtual void , Undo(),
393 "If the last operation can be undone, undoes the last operation.", "");
396 virtual void , Redo(),
397 "If the last operation can be redone, redoes the last operation.", "");
401 virtual bool , CanUndo() const,
402 "Returns ``True`` if the last operation can be undone.", "");
405 virtual bool , CanRedo() const,
406 "Returns ``True`` if the last operation can be redone.", "");
411 virtual void , SetInsertionPoint(long pos),
412 "Sets the insertion point at the given position.", "");
415 virtual void , SetInsertionPointEnd(),
416 "Moves the insertion point to the end of the document.", "");
419 virtual long , GetInsertionPoint() const,
420 "Returns the insertion point. This is defined as the zero based index
421 of the character position to the right of the insertion point.", "");
424 virtual long , GetLastPosition() const,
425 "Returns the zero based index of the last position in the document.", "");
429 virtual void , SetSelection(long from, long to),
430 "Selects the text starting at the first position up to (but not
431 including) the character at the last position. If both parameters are
432 equal to -1 then all text in the control is selected.", "");
435 virtual void , SelectAll(),
436 "Select all text in the document.", "");
439 virtual void , SetEditable(bool editable),
440 "Makes the document editable or read-only, overriding the RE_READONLY
445 virtual bool , HasSelection() const,
449 ///// Functionality specific to wxRichTextCtrl
451 /// Write an image at the current insertion point. Supply optional type to use
452 /// for internal and file storage of the raw data.
454 virtual bool , WriteImage(const wxImage& image, int bitmapType = wxBITMAP_TYPE_PNG),
458 /// Write a bitmap at the current insertion point. Supply optional type to use
459 /// for internal and file storage of the raw data.
461 virtual bool , WriteImage(const wxBitmap& bitmap, int bitmapType = wxBITMAP_TYPE_PNG),
466 /// Load an image from file and write at the current insertion point.
468 virtual bool , WriteImage(const wxString& filename, int bitmapType),
473 /// Write an image block at the current insertion point.
475 virtual bool , WriteImage(const wxRichTextImageBlock& imageBlock),
480 /// Insert a newline (actually paragraph) at the current insertion point.
482 virtual bool , Newline(),
486 /// Insert a line break at the current insertion point.
487 virtual bool LineBreak();
491 virtual void , SetBasicStyle(const wxRichTextAttr& style),
495 /// Get basic (overall) style
497 virtual const wxRichTextAttr , GetBasicStyle() const,
501 /// Begin using a style
503 virtual bool , BeginStyle(const wxRichTextAttr& style),
509 virtual bool , EndStyle(),
515 virtual bool , EndAllStyles(),
531 /// Begin using italic
533 bool , BeginItalic(),
543 /// Begin using underline
545 bool , BeginUnderline(),
549 /// End using underline
551 bool , EndUnderline(),
555 /// Begin using point size
557 bool , BeginFontSize(int pointSize),
561 /// End using point size
563 bool , EndFontSize(),
567 /// Begin using this font
569 bool , BeginFont(const wxFont& font),
579 /// Begin using this colour
581 bool , BeginTextColour(const wxColour& colour),
585 /// End using a colour
587 bool , EndTextColour(),
591 /// Begin using alignment
593 bool , BeginAlignment(wxTextAttrAlignment alignment),
599 bool , EndAlignment(),
603 /// Begin left indent
605 bool , BeginLeftIndent(int leftIndent, int leftSubIndent = 0),
611 bool , EndLeftIndent(),
615 /// Begin right indent
617 bool , BeginRightIndent(int rightIndent),
623 bool , EndRightIndent(),
627 /// Begin paragraph spacing
629 bool , BeginParagraphSpacing(int before, int after),
633 /// End paragraph spacing
635 bool , EndParagraphSpacing(),
639 /// Begin line spacing
641 bool , BeginLineSpacing(int lineSpacing),
647 bool , EndLineSpacing(),
651 /// Begin numbered bullet
653 bool , BeginNumberedBullet(int bulletNumber,
656 int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_ARABIC|wxTEXT_ATTR_BULLET_STYLE_PERIOD),
660 /// End numbered bullet
662 bool , EndNumberedBullet(),
666 /// Begin symbol bullet
668 bool , BeginSymbolBullet(const wxString& symbol,
671 int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_SYMBOL),
675 /// End symbol bullet
677 bool , EndSymbolBullet(),
681 /// Begin standard bullet
683 bool , BeginStandardBullet(const wxString& bulletName,
686 int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_STANDARD),
691 /// End standard bullet
693 bool , EndStandardBullet(),
697 /// Begin named character style
699 bool , BeginCharacterStyle(const wxString& characterStyle),
703 /// End named character style
705 bool , EndCharacterStyle(),
709 /// Begin named paragraph style
711 bool , BeginParagraphStyle(const wxString& paragraphStyle),
715 /// End named character style
717 bool , EndParagraphStyle(),
722 bool , BeginListStyle(const wxString& listStyle, int level = 1, int number = 1),
723 "Begin named list style.", "");
726 bool , EndListStyle(), "End named list style.", "");
729 bool , BeginURL(const wxString& url, const wxString& characterStyle = wxEmptyString),
733 bool , EndURL(), "End URL.", "");
735 /// Sets the default style to the style under the cursor
737 bool , SetDefaultStyleToCursorStyle(),
741 /// Clear the selection
743 virtual void , SelectNone(),
746 /// Select the word at the given character position
748 virtual bool , SelectWord(long position),
752 /// Get/set the selection range in character positions. -1, -1 means no selection.
754 wxRichTextRange , GetSelectionRange() const,
758 void , SetSelectionRange(const wxRichTextRange& range),
761 /// Get/set the selection range in character positions. -1, -1 means no selection.
762 /// The range is in internal format, i.e. a single character selection is denoted
765 const wxRichTextRange& , GetInternalSelectionRange() const,
769 void , SetInternalSelectionRange(const wxRichTextRange& range),
774 /// Add a new paragraph of text to the end of the buffer
776 virtual wxRichTextRange , AddParagraph(const wxString& text),
782 virtual wxRichTextRange , AddImage(const wxImage& image),
786 /// Layout the buffer: which we must do before certain operations, such as
787 /// setting the caret position.
789 virtual bool , LayoutContent(bool onlyVisibleRect = false),
793 /// Move the caret to the given character position
795 virtual bool , MoveCaret(long pos, bool showAtLineStart = false),
801 virtual bool , MoveRight(int noPositions = 1, int flags = 0),
807 virtual bool , MoveLeft(int noPositions = 1, int flags = 0),
813 virtual bool , MoveUp(int noLines = 1, int flags = 0),
819 virtual bool , MoveDown(int noLines = 1, int flags = 0),
823 /// Move to the end of the line
825 virtual bool , MoveToLineEnd(int flags = 0),
829 /// Move to the start of the line
831 virtual bool , MoveToLineStart(int flags = 0),
835 /// Move to the end of the paragraph
837 virtual bool , MoveToParagraphEnd(int flags = 0),
841 /// Move to the start of the paragraph
843 virtual bool , MoveToParagraphStart(int flags = 0),
847 /// Move to the start of the buffer
849 virtual bool , MoveHome(int flags = 0),
853 /// Move to the end of the buffer
855 virtual bool , MoveEnd(int flags = 0),
861 virtual bool , PageUp(int noPages = 1, int flags = 0),
865 /// Move n pages down
867 virtual bool , PageDown(int noPages = 1, int flags = 0),
871 /// Move n words left
873 virtual bool , WordLeft(int noPages = 1, int flags = 0),
877 /// Move n words right
879 virtual bool , WordRight(int noPages = 1, int flags = 0),
883 /// Returns the buffer associated with the control.
885 wxRichTextBuffer& , GetBuffer(),
889 /// Start batching undo history for commands.
891 virtual bool , BeginBatchUndo(const wxString& cmdName),
895 /// End batching undo history for commands.
897 virtual bool , EndBatchUndo(),
901 /// Are we batching undo history for commands?
903 virtual bool , BatchingUndo() const,
907 /// Start suppressing undo history for commands.
909 virtual bool , BeginSuppressUndo(),
913 /// End suppressing undo history for commands.
915 virtual bool , EndSuppressUndo(),
919 /// Are we suppressing undo history for commands?
921 virtual bool , SuppressingUndo() const,
925 /// Test if this whole range has character attributes of the specified kind. If any
926 /// of the attributes are different within the range, the test fails. You
927 /// can use this to implement, for example, bold button updating. style must have
928 /// flags indicating which attributes are of interest.
930 virtual bool , HasCharacterAttributes(const wxRichTextRange& range,
931 const wxRichTextAttr& style) const,
936 /// Test if this whole range has paragraph attributes of the specified kind. If any
937 /// of the attributes are different within the range, the test fails. You
938 /// can use this to implement, for example, centering button updating. style must have
939 /// flags indicating which attributes are of interest.
941 virtual bool , HasParagraphAttributes(const wxRichTextRange& range,
942 const wxRichTextAttr& style) const,
947 /// Is all of the selection bold?
949 virtual bool , IsSelectionBold(),
953 /// Is all of the selection italics?
955 virtual bool , IsSelectionItalics(),
959 /// Is all of the selection underlined?
961 virtual bool , IsSelectionUnderlined(),
965 /// Is all of the selection aligned according to the specified flag?
967 virtual bool , IsSelectionAligned(wxTextAttrAlignment alignment),
971 /// Apply bold to the selection
973 virtual bool , ApplyBoldToSelection(),
977 /// Apply italic to the selection
979 virtual bool , ApplyItalicToSelection(),
983 /// Apply underline to the selection
985 virtual bool , ApplyUnderlineToSelection(),
989 /// Apply alignment to the selection
991 virtual bool , ApplyAlignmentToSelection(wxTextAttrAlignment alignment),
995 /// Apply a named style to the selection
996 virtual bool ApplyStyle(wxRichTextStyleDefinition* def);
998 /// Set style sheet, if any.
1000 void , SetStyleSheet(wxRichTextStyleSheet* styleSheet),
1004 wxRichTextStyleSheet* , GetStyleSheet() const,
1008 /// Push style sheet to top of stack
1009 bool PushStyleSheet(wxRichTextStyleSheet* styleSheet);
1012 /// Pop style sheet from top of stack
1013 wxRichTextStyleSheet* PopStyleSheet();
1016 /// Apply the style sheet to the buffer, for example if the styles have changed.
1018 bool , ApplyStyleSheet(wxRichTextStyleSheet* styleSheet = NULL),
1023 %property(Buffer, GetBuffer, doc="See `GetBuffer`");
1024 %property(DefaultStyle, GetDefaultStyle, SetDefaultStyle, doc="See `GetDefaultStyle` and `SetDefaultStyle`");
1025 %property(DelayedLayoutThreshold, GetDelayedLayoutThreshold, SetDelayedLayoutThreshold, doc="See `GetDelayedLayoutThreshold` and `SetDelayedLayoutThreshold`");
1026 %property(Filename, GetFilename, SetFilename, doc="See `GetFilename` and `SetFilename`");
1027 %property(InsertionPoint, GetInsertionPoint, SetInsertionPoint, doc="See `GetInsertionPoint` and `SetInsertionPoint`");
1028 %property(InternalSelectionRange, GetInternalSelectionRange, SetInternalSelectionRange, doc="See `GetInternalSelectionRange` and `SetInternalSelectionRange`");
1029 %property(LastPosition, GetLastPosition, doc="See `GetLastPosition`");
1030 %property(NumberOfLines, GetNumberOfLines, doc="See `GetNumberOfLines`");
1031 %property(Selection, GetSelection, SetSelectionRange, doc="See `GetSelection` and `SetSelection`");
1032 %property(SelectionRange, GetSelectionRange, SetSelectionRange, doc="See `GetSelectionRange` and `SetSelectionRange`");
1033 %property(StringSelection, GetStringSelection, doc="See `GetStringSelection`");
1034 %property(StyleSheet, GetStyleSheet, SetStyleSheet, doc="See `GetStyleSheet` and `SetStyleSheet`");
1035 %property(Value, GetValue, SetValue, doc="See `GetValue` and `SetValue`");
1039 // TODO: Some of these methods may be useful too...
1042 // /// Set up scrollbars, e.g. after a resize
1043 // virtual void SetupScrollbars(bool atTop = false);
1045 // /// Keyboard navigation
1046 // virtual bool KeyboardNavigate(int keyCode, int flags);
1048 // /// Paint the background
1049 // virtual void PaintBackground(wxDC& dc);
1051 // #if wxRICHTEXT_BUFFERED_PAINTING
1052 // /// Recreate buffer bitmap if necessary
1053 // virtual bool RecreateBuffer(const wxSize& size = wxDefaultSize);
1056 // /// Set the selection
1057 // virtual void DoSetSelection(long from, long to, bool scrollCaret = true);
1060 // virtual void DoWriteText(const wxString& value, int flags = 0);
1062 // /// Should we inherit colours?
1063 // virtual bool ShouldInheritColours() const { return false; }
1065 // /// Position the caret
1066 // virtual void PositionCaret();
1068 // /// Extend the selection, returning true if the selection was
1069 // /// changed. Selections are in caret positions.
1070 // virtual bool ExtendSelection(long oldPosition, long newPosition, int flags);
1072 // /// Scroll into view. This takes a _caret_ position.
1073 // virtual bool ScrollIntoView(long position, int keyCode);
1075 // /// The caret position is the character position just before the caret.
1076 // /// A value of -1 means the caret is at the start of the buffer.
1077 // void SetCaretPosition(long position, bool showAtLineStart = false) ;
1078 // long GetCaretPosition() const { return m_caretPosition; }
1080 // /// The adjusted caret position is the character position adjusted to take
1081 // /// into account whether we're at the start of a paragraph, in which case
1082 // /// style information should be taken from the next position, not current one.
1083 // long GetAdjustedCaretPosition(long caretPos) const;
1085 // /// Move caret one visual step forward: this may mean setting a flag
1086 // /// and keeping the same position if we're going from the end of one line
1087 // /// to the start of the next, which may be the exact same caret position.
1088 // void MoveCaretForward(long oldPosition) ;
1090 // /// Move caret one visual step forward: this may mean setting a flag
1091 // /// and keeping the same position if we're going from the end of one line
1092 // /// to the start of the next, which may be the exact same caret position.
1093 // void MoveCaretBack(long oldPosition) ;
1095 // /// Get the caret height and position for the given character position
1096 // bool GetCaretPositionForIndex(long position, wxRect& rect);
1098 // /// Gets the line for the visible caret position. If the caret is
1099 // /// shown at the very end of the line, it means the next character is actually
1100 // /// on the following line. So let's get the line we're expecting to find
1101 // /// if this is the case.
1102 // wxRichTextLine* GetVisibleLineForCaretPosition(long caretPosition) const;
1104 // /// Gets the command processor
1105 // wxCommandProcessor* GetCommandProcessor() const { return GetBuffer().GetCommandProcessor(); }
1107 // /// Delete content if there is a selection, e.g. when pressing a key.
1108 // /// Returns the new caret position in newPos, or leaves it if there
1109 // /// was no action.
1110 // bool DeleteSelectedContent(long* newPos= NULL);
1112 // /// Transform logical to physical
1113 // wxPoint GetPhysicalPoint(const wxPoint& ptLogical) const;
1115 // /// Transform physical to logical
1116 // wxPoint GetLogicalPoint(const wxPoint& ptPhysical) const;
1118 // /// Finds the caret position for the next word. Direction
1119 // /// is 1 (forward) or -1 (backwards).
1120 // virtual long FindNextWordPosition(int direction = 1) const;
1122 // /// Is the given position visible on the screen?
1123 // bool IsPositionVisible(long pos) const;
1125 // /// Returns the first visible position in the current view
1126 // long GetFirstVisiblePosition() const;
1128 // /// Returns the caret position since the default formatting was changed. As
1129 // /// soon as this position changes, we no longer reflect the default style
1130 // /// in the UI. A value of -2 means that we should only reflect the style of the
1131 // /// content under the caret.
1132 // long GetCaretPositionForDefaultStyle() const { return m_caretPositionForDefaultStyle; }
1134 // /// Set the caret position for the default style that the user is selecting.
1135 // void SetCaretPositionForDefaultStyle(long pos) { m_caretPositionForDefaultStyle = pos; }
1137 // /// Should the UI reflect the default style chosen by the user, rather than the style under
1139 // bool IsDefaultStyleShowing() const { return m_caretPositionForDefaultStyle != -2; }
1141 // /// Convenience function that tells the control to start reflecting the default
1142 // /// style, since the user is changing it.
1143 // void SetAndShowDefaultStyle(const wxRichTextAttr& attr)
1145 // SetDefaultStyle(attr);
1146 // SetCaretPositionForDefaultStyle(GetCaretPosition());
1149 // /// Get the first visible point in the window
1150 // wxPoint GetFirstVisiblePoint() const;
1152 // // Implementation
1154 // /// Font names take a long time to retrieve, so cache them (on demand)
1155 // static const wxArrayString& GetAvailableFontNames();
1156 // static void ClearAvailableFontNames();
1161 //---------------------------------------------------------------------------
1165 %constant wxEventType wxEVT_COMMAND_RICHTEXT_LEFT_CLICK;
1166 %constant wxEventType wxEVT_COMMAND_RICHTEXT_RIGHT_CLICK;
1167 %constant wxEventType wxEVT_COMMAND_RICHTEXT_MIDDLE_CLICK;
1168 %constant wxEventType wxEVT_COMMAND_RICHTEXT_LEFT_DCLICK;
1169 %constant wxEventType wxEVT_COMMAND_RICHTEXT_RETURN;
1170 %constant wxEventType wxEVT_COMMAND_RICHTEXT_CHARACTER;
1171 %constant wxEventType wxEVT_COMMAND_RICHTEXT_DELETE;
1173 %constant wxEventType wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGING;
1174 %constant wxEventType wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGED;
1175 %constant wxEventType wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACING;
1176 %constant wxEventType wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACED;
1178 %constant wxEventType wxEVT_COMMAND_RICHTEXT_CONTENT_INSERTED;
1179 %constant wxEventType wxEVT_COMMAND_RICHTEXT_CONTENT_DELETED;
1180 %constant wxEventType wxEVT_COMMAND_RICHTEXT_STYLE_CHANGED;
1181 %constant wxEventType wxEVT_COMMAND_RICHTEXT_SELECTION_CHANGED;
1184 EVT_RICHTEXT_LEFT_CLICK = wx.PyEventBinder(wxEVT_COMMAND_RICHTEXT_LEFT_CLICK, 1)
1185 EVT_RICHTEXT_RIGHT_CLICK = wx.PyEventBinder(wxEVT_COMMAND_RICHTEXT_RIGHT_CLICK, 1)
1186 EVT_RICHTEXT_MIDDLE_CLICK = wx.PyEventBinder(wxEVT_COMMAND_RICHTEXT_MIDDLE_CLICK, 1)
1187 EVT_RICHTEXT_LEFT_DCLICK = wx.PyEventBinder(wxEVT_COMMAND_RICHTEXT_LEFT_DCLICK, 1)
1188 EVT_RICHTEXT_RETURN = wx.PyEventBinder( wxEVT_COMMAND_RICHTEXT_RETURN, 1)
1189 EVT_RICHTEXT_CHARACTER = wx.PyEventBinder( wxEVT_COMMAND_RICHTEXT_CHARACTER, 1)
1190 EVT_RICHTEXT_DELETE = wx.PyEventBinder( wxEVT_COMMAND_RICHTEXT_DELETE, 1)
1192 EVT_RICHTEXT_STYLESHEET_CHANGING = wx.PyEventBinder( wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGING, 1)
1193 EVT_RICHTEXT_STYLESHEET_CHANGED = wx.PyEventBinder( wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGED, 1)
1194 EVT_RICHTEXT_STYLESHEET_REPLACING = wx.PyEventBinder( wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACING, 1)
1195 EVT_RICHTEXT_STYLESHEET_REPLACED = wx.PyEventBinder( wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACED, 1)
1197 EVT_RICHTEXT_CONTENT_INSERTED = wx.PyEventBinder( wxEVT_COMMAND_RICHTEXT_CONTENT_INSERTED, 1)
1198 EVT_RICHTEXT_CONTENT_DELETED = wx.PyEventBinder( wxEVT_COMMAND_RICHTEXT_CONTENT_DELETED, 1)
1199 EVT_RICHTEXT_STYLE_CHANGED = wx.PyEventBinder( wxEVT_COMMAND_RICHTEXT_STYLE_CHANGED, 1)
1200 EVT_RICHTEXT_SELECTION_CHANGED = wx.PyEventBinder( wxEVT_COMMAND_RICHTEXT_SELECTION_CHANGED, 1)
1204 class wxRichTextEvent : public wxNotifyEvent
1207 wxRichTextEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
1209 int GetPosition() const;
1210 void SetPosition(int n);
1212 int GetFlags() const;
1213 void SetFlags(int flags);
1215 wxRichTextStyleSheet* GetOldStyleSheet() const;
1216 void SetOldStyleSheet(wxRichTextStyleSheet* sheet);
1218 wxRichTextStyleSheet* GetNewStyleSheet() const;
1219 void SetNewStyleSheet(wxRichTextStyleSheet* sheet);
1221 const wxRichTextRange& GetRange() const;
1222 void SetRange(const wxRichTextRange& range);
1224 wxChar GetCharacter() const;
1225 void SetCharacter(wxChar ch);
1228 %property(Flags, GetFlags, SetFlags);
1229 %property(Index, GetPosition, SetPosition);
1230 %property(OldStyleSheet, GetOldStyleSheet, SetOldStyleSheet);
1231 %property(NewStyleSheet, GetNewStyleSheet, SetNewStyleSheet);
1232 %property(Range, GetRange, SetRange);
1233 %property(Character, GetCharacter, SetCharacter);
1237 //---------------------------------------------------------------------------