Changeset 56199 for wxWidgets/trunk/interface/wx/richtext/richtextctrl.h
- Timestamp:
- 10/09/08 09:30:57 (3 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
wxWidgets/trunk/interface/wx/richtext/richtextctrl.h
r55912 r56199 1 1 ///////////////////////////////////////////////////////////////////////////// 2 2 // Name: richtext/richtextctrl.h 3 // Purpose: interface of wxRichText Event3 // Purpose: interface of wxRichTextCtrl and wxRichTextEvent 4 4 // Author: wxWidgets team 5 5 // RCS-ID: $Id$ … … 12 12 This is the event class for wxRichTextCtrl notifications. 13 13 14 @beginEventTable{wxRichTextEvent} 15 @event{EVT_RICHTEXT_CHARACTER(id, func)} 16 Process a wxEVT_COMMAND_RICHTEXT_CHARACTER event, generated when the user 17 presses a character key. Valid event functions: GetFlags, GetPosition, GetCharacter. 18 @event{EVT_RICHTEXT_DELETE(id, func)} 19 Process a wxEVT_COMMAND_RICHTEXT_DELETE event, generated when the user 20 presses the backspace or delete key. Valid event functions: GetFlags, GetPosition. 21 @event{EVT_RICHTEXT_RETURN(id, func)} 22 Process a wxEVT_COMMAND_RICHTEXT_RETURN event, generated when the user 23 presses the return key. Valid event functions: GetFlags, GetPosition. 24 @event{EVT_RICHTEXT_STYLE_CHANGED(id, func)} 25 Process a wxEVT_COMMAND_RICHTEXT_STYLE_CHANGED event, generated when 26 styling has been applied to the control. Valid event functions: GetPosition, GetRange. 27 @event{EVT_RICHTEXT_STYLESHEET_CHANGED(id, func)} 28 Process a wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGING event, generated 29 when the control's stylesheet has changed, for example the user added, 30 edited or deleted a style. Valid event functions: GetRange, GetPosition. 31 @event{EVT_RICHTEXT_STYLESHEET_REPLACING(id, func)} 32 Process a wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACING event, generated 33 when the control's stylesheet is about to be replaced, for example when 34 a file is loaded into the control. 35 Valid event functions: Veto, GetOldStyleSheet, GetNewStyleSheet. 36 @event{EVT_RICHTEXT_STYLESHEET_REPLACED(id, func)} 37 Process a wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACED event, generated 38 when the control's stylesheet has been replaced, for example when a file 39 is loaded into the control. 40 Valid event functions: GetOldStyleSheet, GetNewStyleSheet. 41 @event{EVT_RICHTEXT_CONTENT_INSERTED(id, func)} 42 Process a wxEVT_COMMAND_RICHTEXT_CONTENT_INSERTED event, generated when 43 content has been inserted into the control. 44 Valid event functions: GetPosition, GetRange. 45 @event{EVT_RICHTEXT_CONTENT_DELETED(id, func)} 46 Process a wxEVT_COMMAND_RICHTEXT_CONTENT_DELETED event, generated when 47 content has been deleted from the control. 48 Valid event functions: GetPosition, GetRange. 49 @event{EVT_RICHTEXT_BUFFER_RESET(id, func)} 50 Process a wxEVT_COMMAND_RICHTEXT_BUFFER_RESET event, generated when the 51 buffer has been reset by deleting all content. 52 You can use this to set a default style for the first new paragraph. 53 @endEventTable 54 14 55 @library{wxrichtext} 15 @category{ richtext}56 @category{events,richtext} 16 57 */ 17 58 class wxRichTextEvent : public wxNotifyEvent … … 26 67 Constructor. 27 68 69 @param commandType 70 The type of the event. 28 71 @param id 29 72 Window identifier. The value @c wxID_ANY indicates a default value. … … 42 85 43 86 /** 44 Returns flags indicating modifier keys pressed. Possible values are45 wxRICHTEXT_CTRL_DOWN, 46 wxRICHTEXT_SHIFT_DOWN, and wxRICHTEXT_ALT_DOWN.87 Returns flags indicating modifier keys pressed. 88 89 Possible values are wxRICHTEXT_CTRL_DOWN, wxRICHTEXT_SHIFT_DOWN, and wxRICHTEXT_ALT_DOWN. 47 90 */ 48 91 int GetFlags() const; 49 92 50 93 /** 51 Returns the new style sheet. Can be used in a 52 wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGING or 94 Returns the new style sheet. 95 96 Can be used in a wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGING or 53 97 wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGED event handler. 54 98 */ … … 56 100 57 101 /** 58 Returns the old style sheet. Can be used in a 59 wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGING or 102 Returns the old style sheet. 103 104 Can be used in a wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGING or 60 105 wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGED event handler. 61 106 */ … … 78 123 79 124 /** 80 Sets flags indicating modifier keys pressed. Possible values are81 wxRICHTEXT_CTRL_DOWN, 82 wxRICHTEXT_SHIFT_DOWN, and wxRICHTEXT_ALT_DOWN.125 Sets flags indicating modifier keys pressed. 126 127 Possible values are wxRICHTEXT_CTRL_DOWN, wxRICHTEXT_SHIFT_DOWN, and wxRICHTEXT_ALT_DOWN. 83 128 */ 84 129 void SetFlags(int flags); … … 114 159 115 160 wxRichTextCtrl sends notification events: see wxRichTextEvent. 161 116 162 It also sends the standard wxTextCtrl events wxEVT_COMMAND_TEXT_ENTER and 117 wxEVT_COMMAND_TEXT_UPDATED, 118 and wxTextUrlEvent when URL content is clicked. 163 wxEVT_COMMAND_TEXT_UPDATED, and wxTextUrlEvent when URL content is clicked. 119 164 120 165 For more information, see the @ref overview_richtextctrl. … … 204 249 /** 205 250 Applies the style sheet to the buffer, matching paragraph styles in the sheet 206 against named styles 207 in the buffer. This might be useful if the styles have changed. If @a sheet is 208 @NULL, the209 sheet set with SetStyleSheetis used.251 against named styles in the buffer. 252 253 This might be useful if the styles have changed. 254 If @a sheet is @NULL, the sheet set with SetStyleSheet() is used. 210 255 Currently this applies paragraph styles only. 211 256 */ … … 223 268 224 269 /** 225 Begins using alignment 270 Begins using alignment. 226 271 For alignment values, see wxTextAttr. 227 272 */ … … 260 305 /** 261 306 Begins applying a left indent and subindent in tenths of a millimetre. 262 The subindent is an offset from the left edge of the paragraph, and is 263 used for all but the first line in a paragraph. A positive value will 307 The subindent is an offset from the left edge of the paragraph, and is 308 used for all but the first line in a paragraph. A positive value will 264 309 cause the first line to appear to the left of the subsequent lines, and 265 310 a negative value will cause the first line to be indented to the right … … 280 325 /** 281 326 Begins appling line spacing. @e spacing is a multiple, where 10 means 282 single-spacing, 283 15 means 1.5 spacing, and 20 means double spacing. The following constants are 284 defined for convenience:327 single-spacing, 15 means 1.5 spacing, and 20 means double spacing. 328 329 The ::wxTextAttrLineSpacing constants are defined for convenience. 285 330 */ 286 331 bool BeginLineSpacing(int lineSpacing); 287 332 288 333 /** 289 Begins using a specified list style. Optionally, you can also pass a level and290 a number.334 Begins using a specified list style. 335 Optionally, you can also pass a level and a number. 291 336 */ 292 337 bool BeginListStyle(const wxString& listStyle, int level = 1, … … 294 339 295 340 /** 296 Begins a numbered bullet. This call will be needed for each item in the list, 297 and the 341 Begins a numbered bullet. 342 343 This call will be needed for each item in the list, and the 298 344 application should take care of incrementing the numbering. 345 299 346 @a bulletNumber is a number, usually starting with 1. 300 347 @a leftIndent and @a leftSubIndent are values in tenths of a millimetre. 301 @a bulletStyle is a bitlist of the following values: 302 303 wxRichTextBuffer uses indentation to render a bulleted item. The left indent is 304 the distance between 305 the margin and the bullet. The content of the paragraph, including the first 306 line, starts 307 at leftMargin + leftSubIndent. So the distance between the left edge of the 308 bullet and the 348 @a bulletStyle is a bitlist of the ::wxTextAttrBulletStyle values. 349 350 wxRichTextBuffer uses indentation to render a bulleted item. 351 The left indent is the distance between the margin and the bullet. 352 The content of the paragraph, including the first line, starts 353 at leftMargin + leftSubIndent. 354 So the distance between the left edge of the bullet and the 309 355 left of the actual paragraph is leftSubIndent. 310 356 */ … … 315 361 /** 316 362 Begins paragraph spacing; pass the before-paragraph and after-paragraph spacing 317 in tenths of 318 a millimetre. 363 in tenths of a millimetre. 319 364 */ 320 365 bool BeginParagraphSpacing(int before, int after); … … 341 386 342 387 /** 343 Begins applying a symbol bullet, using a character from the current font. See344 BeginNumberedBullet() for345 an explanation of how indentation is usedto render the bulleted paragraph.388 Begins applying a symbol bullet, using a character from the current font. 389 See BeginNumberedBullet() for an explanation of how indentation is used 390 to render the bulleted paragraph. 346 391 */ 347 392 bool BeginSymbolBullet(wxChar symbol, int leftIndent, … … 355 400 356 401 /** 357 Begins applying wxTEXT_ATTR_URL to the content. Pass a URL and optionally, a358 character style to apply, 359 since it is common to mark a URL with a familiar style such as blue text with360 underlining.402 Begins applying wxTEXT_ATTR_URL to the content. 403 404 Pass a URL and optionally, a character style to apply, since it is common 405 to mark a URL with a familiar style such as blue text with underlining. 361 406 */ 362 407 bool BeginURL(const wxString& url, … … 407 452 Clears the list style from the given range, clearing list-related attributes 408 453 and applying any named paragraph style associated with each paragraph. 454 409 455 @a flags is a bit list of the following: 410 wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this command will be undoable. 411 See also SetListStyle(), PromoteList(), NumberList(). 456 - wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this command will be undoable. 457 458 @see SetListStyle(), PromoteList(), NumberList(). 412 459 */ 413 460 bool ClearListStyle(const wxRichTextRange& range, … … 579 626 /** 580 627 Helper function for extending the selection, returning @true if the selection 581 was 582 changed. Selections are in caret positions. 628 was changed. Selections are in caret positions. 583 629 */ 584 630 bool ExtendSelection(long oldPosition, long newPosition, … … 586 632 587 633 /** 588 Helper function for finding the caret position for the next word. Direction589 is 1 (forward) or -1 (backwards).634 Helper function for finding the caret position for the next word. 635 Direction is 1 (forward) or -1 (backwards). 590 636 */ 591 637 virtual long FindNextWordPosition(int direction = 1) const; … … 598 644 599 645 /** 600 Gets the basic (overall) style. This is the style of the whole 601 buffer before further styles are applied, unlike the default style, which 602 only affects the style currently being applied (for example, setting the default 603 style to bold will cause subsequently inserted text to be bold). 646 Gets the basic (overall) style. 647 648 This is the style of the whole buffer before further styles are applied, 649 unlike the default style, which only affects the style currently being 650 applied (for example, setting the default style to bold will cause 651 subsequently inserted text to be bold). 604 652 */ 605 653 const wxTextAttr GetBasicStyle() const; … … 619 667 620 668 /** 621 Returns the caret height and position for the given character position 669 Returns the caret height and position for the given character position. 622 670 */ 623 671 bool GetCaretPositionForIndex(long position, wxRect& rect); … … 630 678 /** 631 679 Returns the current default style, which can be used to change how subsequently 632 inserted 633 text is displayed. 680 inserted text is displayed. 634 681 */ 635 682 const wxTextAttr GetDefaultStyle() const; … … 652 699 653 700 /** 654 Returns flags that change the behaviour of loading or saving. See the655 documentation for each656 handler class to see what flags arerelevant for each handler.701 Returns flags that change the behaviour of loading or saving. 702 See the documentation for each handler class to see what flags are 703 relevant for each handler. 657 704 */ 658 705 int GetHandlerFlags() const; … … 695 742 /** 696 743 Gets the text for the given range. 697 The end point of range is specified as the last character position of the span698 of text, plus one.744 The end point of range is specified as the last character position of 745 the span of text, plus one. 699 746 */ 700 747 virtual wxString GetRange(long from, long to) const; … … 721 768 Gets the attributes at the given position. 722 769 This function gets the combined style - that is, the style you see on the 723 screen as a result 724 of combining base style, paragraph style and character style attributes. To get725 the character 726 or paragraph style alone, use GetUncombinedStyle().770 screen as a result of combining base style, paragraph style and character 771 style attributes. 772 773 To get the character or paragraph style alone, use GetUncombinedStyle(). 727 774 */ 728 775 virtual bool GetStyle(long position, wxTextAttr& style); 729 776 730 777 /** 731 Gets the attributes common to the specified range. Attributes that differ in732 value within the range will733 not be included in @e style'sflags.778 Gets the attributes common to the specified range. 779 Attributes that differ in value within the range will not be included 780 in @a style flags. 734 781 */ 735 782 bool GetStyleForRange(const wxRichTextRange& range, … … 737 784 738 785 /** 739 Returns the style sheet associated with the control, if any. A style sheet 740 allows named 741 character and paragraph styles to be applied. 786 Returns the style sheet associated with the control, if any. 787 A style sheet allows named character and paragraph styles to be applied. 742 788 */ 743 789 wxRichTextStyleSheet* GetStyleSheet() const; … … 746 792 Gets the attributes at the given position. 747 793 This function gets the @e uncombined style - that is, the attributes associated 748 with the 749 paragraph or character content, and not necessarily the combined attributes you750 see on the751 screen. To get the combined attributes, use GetStyle(). 794 with the paragraph or character content, and not necessarily the combined 795 attributes you see on the screen. 796 To get the combined attributes, use GetStyle(). 797 752 798 If you specify (any) paragraph attribute in @e style's flags, this function 753 will fetch 754 the paragraph attributes.Otherwise, it will return the character attributes.799 will fetch the paragraph attributes. 800 Otherwise, it will return the character attributes. 755 801 */ 756 802 virtual bool GetUncombinedStyle(long position, wxTextAttr& style); … … 762 808 763 809 /** 764 Internal helper function returning the line for the visible caret position. If 765 the caret is 766 shown at the very end of the line, it means the next character is actually 767 on the following line. So this function gets the line we're expecting to find 768 if this is the case. 810 Internal helper function returning the line for the visible caret position. 811 If the caret is shown at the very end of the line, it means the next character 812 is actually on the following line. 813 So this function gets the line we're expecting to find if this is the case. 769 814 */ 770 815 wxRichTextLine* GetVisibleLineForCaretPosition(long caretPosition) const; 771 816 772 817 /** 773 Test if this whole range has character attributes of the specified kind. If any 774 of the attributes are different within the range, the test fails. You 775 can use this to implement, for example, bold button updating. @a style must have 776 flags indicating which attributes are of interest. 818 Test if this whole range has character attributes of the specified kind. 819 If any of the attributes are different within the range, the test fails. 820 821 You can use this to implement, for example, bold button updating. 822 @a style must have flags indicating which attributes are of interest. 777 823 */ 778 824 bool HasCharacterAttributes(const wxRichTextRange& range, … … 780 826 781 827 /** 782 Test if this whole range has paragraph attributes of the specified kind. If any 783 of the attributes are different within the range, the test fails. You 784 can use this to implement, for example, centering button updating. @a style 785 must have 786 flags indicating which attributes are of interest. 828 Test if this whole range has paragraph attributes of the specified kind. 829 If any of the attributes are different within the range, the test fails. 830 You can use this to implement, for example, centering button updating. 831 @a style must have flags indicating which attributes are of interest. 787 832 */ 788 833 bool HasParagraphAttributes(const wxRichTextRange& range, … … 818 863 /** 819 864 Returns @true if the user has recently set the default style without moving 820 the caret, 821 and therefore the UI needs to reflect the default style and not the style at822 the caret. 865 the caret, and therefore the UI needs to reflect the default style and not 866 the style at the caret. 867 823 868 Below is an example of code that uses this function to determine whether the UI 824 869 should show that the current style is bold. 825 826 See alsoSetAndShowDefaultStyle().870 871 @see SetAndShowDefaultStyle(). 827 872 */ 828 873 bool IsDefaultStyleShowing() const; … … 854 899 855 900 /** 856 Returns @true if all of the selection is aligned according to the specified 857 flag. 901 Returns @true if all of the selection is aligned according to the specified flag. 858 902 */ 859 903 virtual bool IsSelectionAligned(wxTextAttrAlignment alignment); … … 875 919 876 920 /** 877 Returns @true if the control is single-line. Currently wxRichTextCtrl does not878 support single-line editing.921 Returns @true if the control is single-line. 922 Currently wxRichTextCtrl does not support single-line editing. 879 923 */ 880 924 bool IsSingleLine() const; … … 887 931 /** 888 932 Lays out the buffer, which must be done before certain operations, such as 889 setting the caret position. This function should not normally be required by the890 application.933 setting the caret position. 934 This function should not normally be required by the application. 891 935 */ 892 936 virtual bool LayoutContent(bool onlyVisibleRect = false); 893 937 894 938 /** 895 Inserts a line break at the current insertion point. A line break forces896 wrapping within a paragraph, and 897 can be introduced by using this function, by appending the wxChar value @b898 wxRichTextLineBreakChar to text content,899 or by typing Shift-Return.939 Inserts a line break at the current insertion point. 940 941 A line break forces wrapping within a paragraph, and can be introduced by 942 using this function, by appending the wxChar value @b wxRichTextLineBreakChar 943 to text content, or by typing Shift-Return. 900 944 */ 901 945 virtual bool LineBreak(); 902 946 903 947 /** 904 Loads content into the control's buffer using the given type. If the specified 905 type 906 is wxRICHTEXT_TYPE_ANY, the type is deduced from the filename extension. 948 Loads content into the control's buffer using the given type. 949 950 If the specified type is wxRICHTEXT_TYPE_ANY, the type is deduced from 951 the filename extension. 952 907 953 This function looks for a suitable wxRichTextFileHandler object. 908 954 */ … … 985 1031 986 1032 /** 987 Inserts a new paragraph at the current insertion point. See alsoLineBreak().1033 Inserts a new paragraph at the current insertion point. @see LineBreak(). 988 1034 */ 989 1035 virtual bool Newline(); … … 991 1037 //@{ 992 1038 /** 993 Numbers the paragraphs in the given range. Pass flags to determine how the 994 attributes are set. 1039 Numbers the paragraphs in the given range. 1040 Pass flags to determine how the attributes are set. 1041 995 1042 Either the style definition or the name of the style definition (in the current 996 1043 sheet) can be passed. 1044 997 1045 @a flags is a bit list of the following: 998 wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this command will be undoable. 999 wxRICHTEXT_SETSTYLE_RENUMBER: specifies that numbering should start from @e 1000 startFrom, otherwise existing attributes are used. 1001 wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL: specifies that @a listLevel should be used 1002 as the level for all paragraphs, otherwise the current indentation will be used. 1003 See also SetListStyle(), PromoteList(), ClearListStyle(). 1046 - wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this command will be undoable. 1047 - wxRICHTEXT_SETSTYLE_RENUMBER: specifies that numbering should start from 1048 @a startFrom, otherwise existing attributes are used. 1049 - wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL: specifies that @a listLevel should be used 1050 as the level for all paragraphs, otherwise the current indentation will be used. 1051 1052 @see SetListStyle(), PromoteList(), ClearListStyle(). 1004 1053 */ 1005 1054 bool NumberList(const wxRichTextRange& range, … … 1129 1178 //@{ 1130 1179 /** 1131 Promotes or demotes the paragraphs in the given range. A positive @a promoteBy1132 produces a smaller indent, and a negative number1180 Promotes or demotes the paragraphs in the given range. 1181 A positive @a promoteBy produces a smaller indent, and a negative number 1133 1182 produces a larger indent. Pass flags to determine how the attributes are set. 1134 1183 Either the style definition or the name of the style definition (in the current 1135 1184 sheet) can be passed. 1185 1136 1186 @a flags is a bit list of the following: 1137 wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this command will be undoable.1138 wxRICHTEXT_SETSTYLE_RENUMBER: specifies that numbering should start from @e1139 startFrom, otherwise existing attributes are used.1140 wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL: specifies that @a listLevel should be used1187 - wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this command will be undoable. 1188 - wxRICHTEXT_SETSTYLE_RENUMBER: specifies that numbering should start from 1189 @a startFrom, otherwise existing attributes are used. 1190 - wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL: specifies that @a listLevel should be used 1141 1191 as the level for all paragraphs, otherwise the current indentation will be used. 1142 See also SetListStyle(), See also SetListStyle(), ClearListStyle(). 1192 1193 @see SetListStyle(), @see SetListStyle(), ClearListStyle(). 1143 1194 */ 1144 1195 bool PromoteList(int promoteBy, const wxRichTextRange& range, … … 1163 1214 1164 1215 /** 1165 Replaces the content in the specified range with the string specified by @e1166 value.1216 Replaces the content in the specified range with the string specified by 1217 @a value. 1167 1218 */ 1168 1219 virtual void Replace(long from, long to, const wxString& value); 1169 1220 1170 1221 /** 1171 Saves the buffer content using the given type. If the specified type 1172 is wxRICHTEXT_TYPE_ANY, the type is deduced from the filename extension. 1222 Saves the buffer content using the given type. 1223 1224 If the specified type is wxRICHTEXT_TYPE_ANY, the type is deduced from 1225 the filename extension. 1226 1173 1227 This function looks for a suitable wxRichTextFileHandler object. 1174 1228 */ … … 1193 1247 /** 1194 1248 Sets @a attr as the default style and tells the control that the UI should 1195 reflect 1196 this attribute until the user moves the caret. 1197 See alsoIsDefaultStyleShowing().1249 reflect this attribute until the user moves the caret. 1250 1251 @see IsDefaultStyleShowing(). 1198 1252 */ 1199 1253 void SetAndShowDefaultStyle(const wxTextAttr& attr); 1200 1254 1201 1255 /** 1202 Sets the basic (overall) style. This is the style of the whole 1203 buffer before further styles are applied, unlike the default style, which 1204 only affects the style currently being applied (for example, setting the default 1205 style to bold will cause subsequently inserted text to be bold). 1256 Sets the basic (overall) style. 1257 1258 This is the style of the whole buffer before further styles are applied, 1259 unlike the default style, which only affects the style currently being 1260 applied (for example, setting the default style to bold will cause 1261 subsequently inserted text to be bold). 1206 1262 */ 1207 1263 virtual void SetBasicStyle(const wxTextAttr& style); … … 1216 1272 /** 1217 1273 Sets the current default style, which can be used to change how subsequently 1218 inserted 1219 text is displayed. 1274 inserted text is displayed. 1220 1275 */ 1221 1276 virtual bool SetDefaultStyle(const wxTextAttr& style); … …
