1/* 2 * Copyright 2001-2013 Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Stephan Aßmus <superstippi@gmx.de> 7 * Stefano Ceccherini (stefano.ceccherini@gmail.com) 8 * John Scipione, jscipione@gmail.com 9 * 10 * Corresponds to: 11 * headers/os/interface/TextView.h hrev45377 12 * src/kits/interface/TextView.cpp hrev45377 13 */ 14 15 16/*! 17 \file TextView.h 18 \ingroup interface 19 \ingroup libbe 20 \brief Provides the BTextView class and associated structs. 21*/ 22 23 24/*! 25 \struct text_run 26 \ingroup interface 27 \ingroup libbe 28 \brief text run struct 29 30 \since BeOS R3 31*/ 32 33 34/*! 35 \var text_run::offset 36 37 \since BeOS R3 38*/ 39 40 41/*! 42 \var text_run::font 43 44 \since BeOS R3 45*/ 46 47 48/*! 49 \var text_run::color 50 51 \since BeOS R3 52*/ 53 54 55/*! 56 \struct text_run_array 57 \ingroup interface 58 \ingroup libbe 59 \brief text run array struct 60 61 \since BeOS R3 62*/ 63 64 65/*! 66 \var text_run_array::count 67 68 \since BeOS R3 69*/ 70 71 72/*! 73 \var text_run_array::runs 74 75 \since BeOS R3 76*/ 77 78 79/*! 80 \enum undo_state 81 \ingroup interface 82 83 Undo state flags. 84 85 \since BeOS R3 86*/ 87 88 89/*! 90 \var undo_state B_UNDO_UNAVAILABLE 91 92 \since BeOS R3 93*/ 94 95 96/*! 97 \var undo_state B_UNDO_TYPING 98 99 \since BeOS R3 100*/ 101 102 103/*! 104 \var undo_state B_UNDO_CUT 105 106 \since BeOS R3 107*/ 108 109 110/*! 111 \var undo_state B_UNDO_PASTE 112 113 \since BeOS R3 114*/ 115 116 117/*! 118 \var undo_state B_UNDO_CLEAR 119 120 \since BeOS R3 121*/ 122 123 124/*! 125 \var undo_state B_UNDO_DROP 126 127 \since BeOS R3 128*/ 129 130 131/*! 132 \class BTextView 133 \ingroup interface 134 \ingroup libbe 135 \brief Displays and manipulates styled text. 136 137 \since BeOS R3 138*/ 139 140 141/*! 142 \fn BTextView::BTextView(BRect frame, const char* name, BRect textRect, 143 uint32 resizeMask, uint32 flags) 144 \brief Creates a new BTextView object. 145 146 \param frame The frame rectangle of the view. 147 \param name The name of the view. 148 \param textRect The area of the text within the view. 149 \param resizeMask Resizing mask, passed to BView. 150 \param flags \a flags passed to BView, \c B_FRAME_EVENTS, 151 \c B_PULSE_NEEDED and \c B_INPUT_METHOD_AWARE are always set. 152 153 \since BeOS R3 154*/ 155 156 157/*! 158 \fn BTextView::BTextView(BRect frame, const char* name, BRect textRect, 159 const BFont* initialFont, const rgb_color* initialColor, 160 uint32 resizeMask, uint32 flags) 161 \brief Creates a new BTextView object and sets the initial font and color. 162 163 \param frame The BTextView frame rectangle. 164 \param name The name of the object. 165 \param textRect The area of the text within the BTextView object. 166 \param initialFont The text font to display. 167 \param initialColor The text color to display. 168 \param resizeMask Resizing mask, passed to BView. 169 \param flags \a flags passed to BView, \c B_FRAME_EVENTS, 170 \c B_PULSE_NEEDED and \c B_INPUT_METHOD_AWARE are always set. 171 172 \since BeOS R3 173*/ 174 175 176/*! 177 \fn BTextView::BTextView(const char* name, uint32 flags) 178 \brief Creates a BTextView object, dynamic layout version. 179 180 \param name The name of the object. 181 \param flags \a flags passed to BView, \c B_FRAME_EVENTS, 182 \c B_PULSE_NEEDED and \c B_INPUT_METHOD_AWARE are always set. 183 184 \since Haiku R1 185*/ 186 187 188/*! 189 \fn BTextView::BTextView(const char* name, const BFont* initialFont, 190 const rgb_color* initialColor, uint32 flags) 191 \brief Creates a new BTextView object and sets the initial font and color, 192 dynamic layout version. 193 194 \param name The name of the object. 195 \param initialFont The text font to display. 196 \param initialColor The text color to display. 197 \param flags \a flags passed to BView, \c B_FRAME_EVENTS, 198 \c B_PULSE_NEEDED and \c B_INPUT_METHOD_AWARE are always set. 199 200 \since Haiku R1 201*/ 202 203 204/*! 205 \fn BTextView::BTextView(BMessage* archive) 206 \brief Creates a BTextView object from the passed in \a archive. 207 208 \param archive The BMessage object from which the object is created. 209 210 \since BeOS R3 211*/ 212 213 214/*! 215 \fn BTextView::~BTextView() 216 \brief Frees the memory allocated and destroys the object. 217 218 \since BeOS R3 219*/ 220 221 222/*! 223 \name Archiving 224*/ 225 226 227//! @{ 228 229 230/*! 231 \fn BArchivable* BTextView::Instantiate(BMessage* archive) 232 \brief Instantiates a BTextView object from the passed in \a archive. 233 234 \param archive The BMessage object that the object is created from. 235 236 \return A new BTextView object as a BArchivable. 237 238 \since BeOS R3 239*/ 240 241 242/*! 243 \fn status_t BTextView::Archive(BMessage* data, bool deep) const 244 \brief Archives the object into the \a data message. 245 246 \param data A pointer to the BMessage object to archive the object into. 247 \param deep Whether or not to archive child views as well. 248 249 \return A status code, \c B_OK if everything went well or an error code 250 otherwise. 251 \retval B_OK The object was archived. 252 \retval B_NO_MEMORY Ran out of memory while archiving the object. 253 254 \since BeOS R3 255*/ 256 257 258//! @} 259 260 261/*! 262 \name Hook Methods 263*/ 264 265 266//! @{ 267 268 269/*! 270 \fn void BTextView::AllAttached() 271 \copydoc BView::AllAttached() 272*/ 273 274 275/*! 276 \fn void BTextView::AllDetached() 277 \copydoc BView::AllDetached() 278*/ 279 280 281/*! 282 \fn void BTextView::AttachedToWindow() 283 \brief Hook method called when the text view is added to the view hierarchy. 284 285 Sets the pulse rate to 2 per second and adjust scrollbars if needed. 286 287 \copydetails BView::AttachedToWindow() 288*/ 289 290 291/*! 292 \fn void BTextView::DetachedFromWindow() 293 \brief Hook method that is called when the text view is removed from the 294 view hierarchy. 295 296 \copydetails BView::DetachedFromWindow() 297*/ 298 299 300/*! 301 \fn void BTextView::Draw(BRect updateRect) 302 \brief Hook method called to draw the contents of the text view. 303 304 \param updateRect The rectangular area to draw. 305 306 \since BeOS R3 307*/ 308 309 310/*! 311 \fn void BTextView::FrameResized(float newWidth, float newHeight) 312 \brief Hook method that is called when the frame is resized. 313 314 This method updates any associated scrollbars. 315 316 \copydetails BView::FrameResized() 317*/ 318 319 320/*! 321 \fn void BTextView::KeyDown(const char* bytes, int32 numBytes) 322 \brief Hook method that is called when a key is pressed while the view is 323 the focus view of the active window. 324 325 \copydetails BView::KeyDown() 326*/ 327 328 329/*! 330 \fn void BTextView::MessageReceived(BMessage* message) 331 \brief Hook method called with a message is received by the text view. 332 333 \copydetails BView::MessageReceived() 334*/ 335 336 337/*! 338 \fn void BTextView::MouseDown(BPoint where) 339 \brief Hook method that is called when a mouse button is pushed down while 340 the cursor is contained in the view. 341 342 \copydetails BView::MouseDown() 343*/ 344 345 346/*! 347 \fn void BTextView::MouseUp(BPoint where) 348 \brief Hook method that is called when a mouse button is released while 349 the cursor is contained in the view. 350 351 This method stops asynchronous mouse tracking. 352 353 \copydetails BView::MouseUp() 354*/ 355 356 357/*! 358 \fn void BTextView::MouseMoved(BPoint where, uint32 code, 359 const BMessage* dragMessage) 360 \brief Hook method that is called whenever the mouse cursor enters, exits 361 or moves inside the view. 362 363 \copydetails BView::MouseMoved() 364*/ 365 366 367/*! 368 \fn void BTextView::Pulse() 369 \brief Hook method that is called at a set interval. 370 371 This method is used to make the I-beam cursor blink. 372 373 \copydetails BView::Pulse() 374*/ 375 376 377/*! 378 \fn void BTextView::WindowActivated(bool active) 379 \brief Hook method that is called when the window becomes the active window 380 or gives up that status. 381 382 \copydetails BView::WindowActivated() 383*/ 384 385 386//! @} 387 388 389/*! 390 \fn void BTextView::MakeFocus(bool focus) 391 \brief Highlight or unhighlight the selection when the text view acquires 392 or loses its focus state. 393 394 \copydetails BView::MakeFocus() 395*/ 396 397 398/*! 399 \fn BHandler* BTextView::ResolveSpecifier(BMessage* message, int32 index, 400 BMessage* specifier, int32 what, const char* property) 401 \copydoc BHandler::ResolveSpecifier() 402*/ 403 404 405/*! 406 \name SetText 407 408 The BTextView doesn't keep a reference to the \a text buffer, \a file, or 409 \a runs array you pass in, you can \c delete them after SetText() returns. 410 411 If the BTextView supports multiple character styles and a 412 \c text_run_array is passed in it will be used to set the font and color 413 formats of the new text. 414 415 If the BTextView does not support multiple character styles, then the 416 \c text_run_array parameter is ignored. 417 418 \see IsStylable() 419*/ 420 421 422//! @{ 423 424 425/*! 426 \fn void BTextView::SetText(const char* text, const text_run_array* runs) 427 \brief Copies text from the \a text buffer replacing any text currently 428 set in the BTextView with the font and color formats set by \a runs. 429 430 \param text The text to set. 431 \param runs Set the font and color formats of the new text if provided. Only 432 applies if the BTextView permits multiple character formats. 433 434 \since BeOS R3 435*/ 436 437 438/*! 439 \fn void BTextView::SetText(const char* text, int32 length, 440 const text_run_array* runs) 441 \brief Copies text from the \a text buffer up to \a length characters 442 replacing any text currently set in the BTextView with the font and 443 color formats set by \a runs. 444 445 \a text must be at least \a length characters long. \a length may be set 446 to 0 to clear the text from the BTextView. 447 448 \param text The text to set. 449 \param length The maximum number of bytes of \a text to use. 450 \param runs Set the font and color formats of the new text if provided. Only 451 applies if the BTextView permits multiple character formats. 452 453 \since BeOS R3 454*/ 455 456 457/*! 458 \fn void BTextView::SetText(BFile* file, int32 offset, int32 length, 459 const text_run_array* runs) 460 \brief Copies text from the \a file starting at the given \a offset up to 461 \a length characters replacing any text currently set in the 462 BTextView with the font and color formats set by \a runs. 463 464 \param file The file to set the text from. 465 \param offset The position in the file to start reading text. 466 \param length The number of bytes of text to read from the file. 467 \param runs Set the font and color formats of the new text if provided. Only 468 applies if the BTextView permits multiple character formats. 469 470 \since BeOS R3 471*/ 472 473 474//! @} 475 476 477/*! 478 \name Insert 479 480 The BTextView doesn't keep a reference to the \a text buffer or 481 \a runs array you pass in, you can \c delete them after Insert() returns. 482 483 If the BTextView supports multiple character styles and a 484 \c text_run_array is passed in it will be used to set the font and color 485 formats of the new text. 486 487 If the BTextView does not support multiple character styles, then the 488 \c text_run_array parameter is ignored. 489 490 \see IsStylable() 491*/ 492 493 494/*! 495 \fn void BTextView::Insert(const char* text, const text_run_array* runs) 496 \brief Inserts text from the \a text buffer at the end of the BTextView 497 with the font and color formats set by \a runs. 498 499 \param text The text to insert. 500 \param runs The text styling to set, can be \c NULL. 501 502 \since BeOS R3 503*/ 504 505 506/*! 507 \fn void BTextView::Insert(const char* text, int32 length, 508 const text_run_array* runs) 509 \brief Inserts text from the \a text buffer up to \a length characters 510 at the end of the BTextView with the font and color formats set by 511 \a runs. 512 513 \param text The text to insert. 514 \param length The number of bytes of text to insert. 515 \param runs The text styling to use, can be \c NULL. 516 517 \since BeOS R3 518*/ 519 520 521/*! 522 \fn void BTextView::Insert(int32 offset, const char* text, int32 length, 523 const text_run_array* runs) 524 \brief Inserts text starting at the given \a offset from the \a text buffer 525 up to \a length characters into the BTextView with the font and 526 color formats set by \a runs. 527 528 \param offset The position to start inserting text. 529 \param text The text to set. 530 \param length The number of bytes of text to insert. 531 \param runs The text styling to use, can be \c NULL. 532 533 \since BeOS R3 534*/ 535 536 537//! @} 538 539 540/*! 541 \name Delete 542*/ 543 544 545//! @{ 546 547 548/*! 549 \fn void BTextView::Delete() 550 \brief Deletes the text within the current selection. 551 552 \since BeOS R3 553*/ 554 555 556/*! 557 \fn void BTextView::Delete(int32 startOffset, int32 endOffset) 558 \brief Deletes the text enclosed within the given offsets. 559 560 \param startOffset The offset where the text to delete starts. 561 \param endOffset The offset where the text to delete ends. 562 563 \since BeOS R3 564*/ 565 566 567//! @} 568 569 570/*! 571 \name Text Information 572*/ 573 574 575//! @{ 576 577 578/*! 579 \fn const char* BTextView::Text() const 580 \brief Returns the BTextView text as a byte array. 581 582 \warning It is possible that the BTextView object had to do some operations 583 on the text to be able to return it as a C string. If you need to 584 call Text() repeatedly, you'd better use GetText() instead. 585 586 \returns A pointer to the text as a byte array. 587 588 \since BeOS R3 589*/ 590 591 592/*! 593 \fn int32 BTextView::TextLength() const 594 \brief Returns the text length of the BTextView text. 595 596 \return The text length of the BTextView text. 597 598 \since BeOS R3 599*/ 600 601 602/*! 603 \fn BTextView::GetText(int32 offset, int32 length, char* buffer) const 604 \brief Fills out \a buffer with the text of the BTextView starting at 605 \a offset and grabbing at most \a length bytes. 606 607 You must provide a \a buffer that is large enough to hold at least 608 \a length bytes. 609 610 \param offset Where to start grabbing text from. 611 \param length The number of bytes of text to grab. 612 \param buffer A \a buffer to write the text to. 613 614 \see BString::GetString(int32 offset, int32 length, char* buffer) 615 616 \since BeOS R3 617*/ 618 619 620/*! 621 \fn uchar BTextView::ByteAt(int32 offset) const 622 \brief Returns the character at the given offset. 623 624 \param offset The offset to the desired character. 625 626 \return The character at the given offset. 627 628 \since BeOS R3 629*/ 630 631 632/*! 633 \fn int32 BTextView::CountLines() const 634 \brief Returns the number of lines that the BTextView object contains. 635 636 \return The number of lines contained in the BTextView object. 637 638 \since BeOS R3 639*/ 640 641 642/*! 643 \fn int32 BTextView::CurrentLine() const 644 \brief Returns the index of the current line. 645 646 \return The index of the current line. 647 648 \since BeOS R3 649*/ 650 651 652/*! 653 \fn void BTextView::GoToLine(int32 index) 654 \brief Moves the caret to the specified line. 655 656 \param index The index of the line. 657 658 \since BeOS R3 659*/ 660 661 662//! @} 663 664 665/*! 666 \name Clipboard 667*/ 668 669 670//! @{ 671 672 673/*! 674 \fn void BTextView::Cut(BClipboard* clipboard) 675 \brief Moves the current selection to the clipboard. 676 677 \param clipboard The clipboard object to move the text to. 678 679 \since BeOS R3 680*/ 681 682 683/*! 684 \fn void BTextView::Copy(BClipboard* clipboard) 685 \brief Copies the current selection to the clipboard. 686 687 \param clipboard The clipboard object to copy the selected text to. 688 689 \since BeOS R3 690*/ 691 692 693/*! 694 \fn void BTextView::Paste(BClipboard* clipboard) 695 \brief Copy the text contained in the clipboard to the BTextView. 696 697 \param clipboard A pointer to the clipboard. 698 699 \since BeOS R3 700*/ 701 702 703/*! 704 \fn bool BTextView::AcceptsPaste(BClipboard* clipboard) 705 \brief Returns whether or not the BTextView can accept the 706 \a clipboard data. 707 708 \returns \c true if the BTextView can accept the pasted clipboard data, 709 \c false otherwise. 710 711 \since BeOS R3 712*/ 713 714 715/*! 716 \fn bool BTextView::AcceptsDrop(const BMessage* message) 717 \brief Returns whether or not the BTextView can accept the dropped 718 \a message data. 719 720 \returns \c true if the BTextView can accept the dropped message data, 721 \c false otherwise. 722 723 \since BeOS R3 724*/ 725 726 727//! @} 728 729 730/*! 731 \name Selection 732*/ 733 734 735//! @{ 736 737 738/*! 739 \fn void BTextView::Clear() 740 \brief Deletes the currently selected text. 741 742 \since BeOS R4 743*/ 744 745 746/*! 747 \fn void BTextView::Select(int32 startOffset, int32 endOffset) 748 \brief Selects the text contained within the given offsets. 749 750 \param startOffset The offset where the text to select starts. 751 \param endOffset The offset where the text to select ends. 752 753 \since BeOS R3 754*/ 755 756 757/*! 758 \fn void BTextView::SelectAll() 759 \brief Selects all text contained in the BTextView. 760 761 \sa Select() 762 763 \since BeOS R3 764*/ 765 766 767/*! 768 \fn void BTextView::GetSelection(int32* _start, int32* _end) const 769 \brief Fills out \a _start and \a _end with the start and end offsets of 770 the current selection. 771 772 \param _start A pointer to an int32 to contain the selection's start 773 offset. 774 \param _end A pointer to an int32 to contain the selection's end offset. 775 776 \sa Select() 777 778 \since BeOS R3 779*/ 780 781 782/*! 783 \fn text_run_array* BTextView::RunArray(int32 startOffset, int32 endOffset, 784 int32* _size) const 785 \brief Returns a \c text_run_array for the text within the given offsets. 786 787 The returned \c text_run_array belongs to the caller, so you must 788 free it once you no longer need it. 789 790 \param startOffset The text start offset. 791 \param endOffset The text end offset. 792 \param _size A pointer to an int32 to fill out the run array size. 793 794 \return A \c text_run_array for the text in the given offsets. 795 796 \sa SetRunArray() 797 798 \since BeOS R3 799*/ 800 801 802 803/*! 804 \fn int32 BTextView::LineAt(int32 offset) const 805 \brief Returns the line number of the character at the given offset. 806 807 \param offset The offset of the wanted character. 808 809 \return The line number of the character at the given offset. 810 811 \since BeOS R3 812*/ 813 814 815/*! 816 \fn int32 BTextView::LineAt(BPoint point) const 817 \brief Returns the line number for the passed point. 818 819 \param point The point to get the line number of. 820 \return The line number for the passed in point. 821 822 \since BeOS R3 823*/ 824 825 826/*! 827 \fn BPoint BTextView::PointAt(int32 offset, float* _height) const 828 \brief Returns the location of the character at the given offset. 829 830 \param offset The offset of the character. 831 \param _height A pointer to write the height of the character. 832 833 \return A BPoint object set to the location of the character. 834 835 \since BeOS R3 836*/ 837 838 839/*! 840 \fn int32 BTextView::OffsetAt(BPoint point) const 841 \brief Returns the offset at the passed in point. 842 843 \param point The desired point. 844 845 \return The offset for the passed in point. 846 847 \since BeOS R3 848*/ 849 850 851 852/*! 853 \fn int32 BTextView::OffsetAt(int32 line) const 854 \brief Returns the offset of the given line. 855 856 \param line A line number. 857 858 \return The offset of the passed line. 859 860 \since BeOS R3 861*/ 862 863 864/*! 865 \fn void BTextView::FindWord(int32 offset, int32* _fromOffset, 866 int32* _toOffset) 867 \brief Fills out \a _fromOffset and \a _toOffset for a sequence of 868 character that qualifies as a word starting at \a offset. 869 870 A word is a sequence of characters that the user can select by double- 871 clicking. 872 873 \param offset The offset where to start looking. 874 \param _fromOffset A pointer to an integer to write the starting offset. 875 \param _toOffset A pointer to an integer to write the ending offset. 876 877 \since BeOS R3 878*/ 879 880 881/*! 882 \fn bool BTextView::CanEndLine(int32 offset) 883 \brief Returns whether or not the character at the given offset can be 884 the last character of a line. 885 886 \param offset The offset of the character. 887 888 \returns \c true if the character can be the last character of a line, 889 \c false otherwise. 890 891 \since BeOS R3 892*/ 893 894 895/*! 896 \fn float BTextView::LineWidth(int32 lineNumber) const 897 \brief Returns the width of the line at the given \a lineNumber. 898 899 \param lineNumber The index of the line to get the width of, 0-indexed. 900 901 \returns The width of the line at the given \a lineNumber as a float. 902 903 \since BeOS R3 904*/ 905 906 907/*! 908 \fn float BTextView::LineHeight(int32 lineNumber) const 909 \brief Returns the height of the line at the given \a lineNumber. 910 911 \param lineNumber The index of the line to get the height of, 0-indexed. 912 913 \returns The height of the line at the given \a lineNumber as a float. 914 915 \since BeOS R3 916*/ 917 918 919/*! 920 \fn float BTextView::TextHeight(int32 startLine, int32 endLine) const 921 \brief Returns the height of the text enclosed within the given lines. 922 923 \param startLine The index of the starting line. 924 \param endLine The index of the ending line. 925 926 \returns The height height of the text enclosed within the given lines 927 as a float. 928 929 \since BeOS R3 930*/ 931 932 933/*! 934 \fn void BTextView::Highlight(int32 startOffset, int32 endOffset) 935 \brief Highlight the text enclosed within the given offsets. 936 937 \param startOffset The start offset of the text to highlight. 938 \param endOffset The end offset of the text to highlight. 939 940 \since BeOS R3 941*/ 942 943 944//! @} 945 946 947/*! 948 \name Scrolling 949*/ 950 951 952//! @{ 953 954 955/*! 956 \fn void BTextView::ScrollToOffset(int32 offset) 957 \brief Scrolls the text so that the character at \a offset is visible. 958 959 \param offset The offset of the character to scroll to. 960 961 \since BeOS R3 962*/ 963 964 965/*! 966 \fn void BTextView::ScrollToSelection() 967 \brief Scrolls the text so that the character that begins the selection 968 is visible. 969 970 \since BeOS R3 971*/ 972 973 974//! @} 975 976 977/*! 978 \name TextRect 979*/ 980 981 982//! @{ 983 984 985/*! 986 \fn void BTextView::SetTextRect(BRect rect) 987 \brief Sets the object's text frame to the passed in \a rect. 988 989 \param rect A BRect object to set the text frame to. 990 991 \since BeOS R3 992*/ 993 994 995/*! 996 \fn BRect BTextView::TextRect() const 997 \brief Returns the BTextView's text frame. 998 999 \return The BTextView's text frame. 1000 1001 \see SetTextRect() 1002 1003 \since BeOS R3 1004*/ 1005 1006 1007//! @} 1008 1009 1010/*! 1011 \name Insets 1012*/ 1013 1014 1015//! @{ 1016 1017 1018 1019/*! 1020 \fn void BTextView::SetInsets(float left, float top, float right, 1021 float bottom) 1022 \brief Sets the insets within the bounds for the object's text frame. 1023 1024 \note Insets cannot be negative, will result in 0 inset. 1025 1026 \param left The left inset to set. 1027 \param top The top inset to set. 1028 \param right The right inset to set. 1029 \param bottom The bottom inset to set. 1030 1031 \since Haiku R1 1032*/ 1033 1034 1035/*! 1036 \fn void BTextView::GetInsets(float* _left, float* _top, float* _right, 1037 float* _bottom) const 1038 \brief Fills out the parameters with the objects's text insets. 1039 1040 \param _left A pointer to set to the frame's left inset. 1041 \param _top A pointer to set to the frame's top inset. 1042 \param _right A pointer to set to the frame's right inset. 1043 \param _bottom A pointer to set to the frame's bottom inset. 1044 1045 \since BeOS R3 1046*/ 1047 1048 1049 1050//! @} 1051 1052 1053/*! 1054 \name Stylable 1055*/ 1056 1057 1058//! @{ 1059 1060 1061 1062/*! 1063 \fn void BTextView::SetStylable(bool stylable) 1064 \brief Sets whether or not the object accepts multiple font styles. 1065 1066 \param stylable \c true to accept multiple font styles, 1067 \c false to NOT accept multiple font styles. 1068 1069 \since BeOS R3 1070*/ 1071 1072 1073/*! 1074 \fn bool BTextView::IsStylable() const 1075 \brief Returns whether or not the object accepts multiple font styles. 1076 1077 \return \c true if the object is accepts multiple font styles, 1078 \c false otherwise. 1079 1080 \see SetStylable() 1081 1082 \since BeOS R3 1083*/ 1084 1085 1086//! @} 1087 1088 1089/*! 1090 \name Tab Width 1091*/ 1092 1093 1094//! @{ 1095 1096 1097 1098/*! 1099 \fn void BTextView::SetTabWidth(float width) 1100 \brief Sets the distance between tab stops in pixels. 1101 1102 \param width The distance in pixel between tab stops to set. 1103 1104 \since BeOS R3 1105*/ 1106 1107 1108/*! 1109 \fn float BTextView::TabWidth() const 1110 \brief Returns the tab width of the BTextView. 1111 1112 \return The tab width of the BTextView. 1113 1114 \see SetTabWidth() 1115 1116 \since BeOS R3 1117*/ 1118 1119 1120//! @} 1121 1122 1123/*! 1124 \name Selectable State 1125*/ 1126 1127 1128//! @{ 1129 1130 1131 1132/*! 1133 \fn void BTextView::MakeSelectable(bool selectable) 1134 \brief Sets whether or not the text is selectable. 1135 1136 \param selectable Pass in \c true to set the text to be selectable, 1137 \c false to set the text to be not selectable. 1138 1139 \since BeOS R3 1140*/ 1141 1142 1143/*! 1144 \fn bool BTextView::IsSelectable() const 1145 \brief Returns whether or not the text is selectable. 1146 1147 \return \c true if the text is selectable, 1148 \c false if the text is not selectable. 1149 1150 \see MakeSelectable() 1151 1152 \since BeOS R3 1153*/ 1154 1155 1156//! @} 1157 1158 1159/*! 1160 \name Editable State 1161*/ 1162 1163 1164//! @{ 1165 1166 1167 1168/*! 1169 \fn void BTextView::MakeEditable(bool editable) 1170 \brief Sets whether or not the text is editable. 1171 1172 \param editable Pass in \c true to set the text to be editable, 1173 \c false to set the object to be not editable. 1174 1175 \since BeOS R3 1176*/ 1177 1178 1179/*! 1180 \fn bool BTextView::IsEditable() const 1181 \brief Returns whether or not the text is editable. 1182 1183 \return \c true if the text is editable, \c false if the text is not 1184 editable. 1185 1186 \see MakeEditable() 1187 1188 \since BeOS R3 1189*/ 1190 1191 1192//! @} 1193 1194 1195/*! 1196 \name Word Wrap 1197*/ 1198 1199 1200//! @{ 1201 1202 1203 1204/*! 1205 \fn void BTextView::SetWordWrap(bool wrap) 1206 \brief Activate or deactivate word wrapping mode. 1207 1208 \param wrap Pass in \c true to turn on word wrapping mode, 1209 \c false to turn off word wrapping mode. 1210 1211 \since BeOS R3 1212*/ 1213 1214 1215/*! 1216 \fn bool BTextView::DoesWordWrap() const 1217 \brief Returns whether or not word wrapping is activated. 1218 1219 \return \c true if word wrapping is activated, \c false is word wrapping 1220 if not activated. 1221 1222 \see SetWordWrap() 1223 1224 \since BeOS R3 1225*/ 1226 1227 1228//! @} 1229 1230 1231/*! 1232 \name Max Bytes 1233*/ 1234 1235 1236//! @{ 1237 1238 1239 1240/*! 1241 \fn void BTextView::SetMaxBytes(int32 max) 1242 \brief Sets the maximum number of bytes that the BTextView can contain. 1243 1244 \param max The maximum number of bytes to set. 1245 1246 \since BeOS R3 1247*/ 1248 1249 1250/*! 1251 \fn int32 BTextView::MaxBytes() const 1252 \brief Returns the maximum number of bytes that the BTextView can contain. 1253 1254 \return the maximum number of bytes that the BTextView can contain. 1255 1256 \see SetMaxBytes() 1257 1258 \since BeOS R3 1259*/ 1260 1261 1262//! @} 1263 1264 1265/*! 1266 \name Character Filtering 1267*/ 1268 1269 1270//! @{ 1271 1272 1273 1274/*! 1275 \fn void BTextView::DisallowChar(uint32 character) 1276 \brief Adds the \a character to the disallowed characters list. 1277 1278 After this method returns, the \a character won't be accepted 1279 by the textview anymore. 1280 1281 \param character The character to disallow. 1282 1283 \see AllowChar() 1284 1285 \since BeOS R3 1286*/ 1287 1288 1289/*! 1290 \fn void BTextView::AllowChar(uint32 character) 1291 \brief Removes the \a character from the disallowed characters list. 1292 1293 After this method returns, the \a character will be accepted 1294 by the textview. 1295 1296 \param character The character to allow. 1297 1298 \see DisallowChar() 1299 1300 \since BeOS R3 1301*/ 1302 1303 1304//! @} 1305 1306 1307/*! 1308 \name Alignment 1309*/ 1310 1311 1312//! @{ 1313 1314 1315 1316/*! 1317 \fn void BTextView::SetAlignment(alignment flag) 1318 \brief Sets the way text is aligned within the frame. 1319 1320 Choices are: 1321 - \c B_ALIGN_LEFT 1322 - \c B_ALIGN_RIGHT 1323 - \c B_ALIGN_CENTER 1324 1325 \param flag The text alignment to set. 1326 1327 \since BeOS R3 1328*/ 1329 1330 1331/*! 1332 \fn alignment BTextView::Alignment() const 1333 \brief Returns the current text alignment. 1334 1335 \return The current alignment flag. 1336 1337 \see SetAlignment() 1338 1339 \since BeOS R3 1340*/ 1341 1342 1343//! @} 1344 1345 1346/*! 1347 \name Autoindent 1348*/ 1349 1350 1351//! @{ 1352 1353 1354 1355/*! 1356 \fn void BTextView::SetAutoindent(bool state) 1357 \brief Sets whether or not new lines of text are automatically indented. 1358 1359 \param state Pass in \c true to automatically indent the text, 1360 \c false to turn off automatic text indenting. 1361 1362 \since BeOS R3 1363*/ 1364 1365 1366/*! 1367 \fn bool BTextView::DoesAutoindent() const 1368 \brief Returns whether or not automatic indenting is active. 1369 1370 \return \c true if automatic indenting is activated, \c false otherwise. 1371 1372 \see SetAutoindent() 1373 1374 \since BeOS R3 1375*/ 1376 1377 1378//! @} 1379 1380 1381/*! 1382 \name Color Space 1383*/ 1384 1385 1386//! @{ 1387 1388 1389 1390/*! 1391 \fn void BTextView::SetColorSpace(color_space colors) 1392 \brief Set the color space of the offscreen BBitmap object. 1393 1394 \param colors The colorspace to set on the offscreen BBitmap object. 1395 1396 \since BeOS R3 1397*/ 1398 1399 1400/*! 1401 \fn color_space BTextView::ColorSpace() const 1402 \brief Returns the colorspace set to the offscreen BBitmap object. 1403 1404 \return The colorspace of the offscreen BBitmap object. 1405 1406 \see SetColorSpace() 1407 1408 \since BeOS R3 1409*/ 1410 1411 1412//! @} 1413 1414 1415/*! 1416 \name Resizable 1417*/ 1418 1419 1420//! @{ 1421 1422 1423 1424/*! 1425 \fn void BTextView::MakeResizable(bool resize, BView* resizeView) 1426 \brief Activates and deactivates automatic resizing. 1427 1428 The resizing mechanism is alternative to BView resizing. The container 1429 view (the one passed to this function) should not automatically resize 1430 itself when the parent is resized. 1431 1432 \param resize Pass in \c true to set the the BTextView to automatically 1433 resize itself, \c false to disable automatic resizing. 1434 \param resizeView The BTextView object's parent view that resizes itself. 1435 1436 \since BeOS R3 1437*/ 1438 1439 1440/*! 1441 \fn bool BTextView::IsResizable() const 1442 \brief Returns whether or not the object is resizable. 1443 1444 \returns \c true if the object is resizable, \c false otherwise. 1445 1446 \see MakeResizable() 1447 1448 \since BeOS R3 1449*/ 1450 1451 1452//! @} 1453 1454 1455/*! 1456 \name Undo State 1457*/ 1458 1459 1460//! @{ 1461 1462 1463 1464/*! 1465 \fn void BTextView::SetDoesUndo(bool undo) 1466 \brief Enables and disables the undo mechanism. 1467 1468 \param undo Pass in \c true to enable the undo mechanism, 1469 \c false to disable it. 1470 1471 \since BeOS R3 1472*/ 1473 1474 1475/*! 1476 \fn bool BTextView::DoesUndo() const 1477 \brief Returns whether or not the undo mechanism is enabled. 1478 1479 \return \c true if undo is enabled, \c false otherwise. 1480 1481 \see SetDoesUndo() 1482 1483 \since BeOS R3 1484*/ 1485 1486 1487//! @} 1488 1489 1490/*! 1491 \name Hide Typing 1492*/ 1493 1494 1495//! @{ 1496 1497 1498 1499/*! 1500 \fn void BTextView::HideTyping(bool enabled) 1501 \brief Enables and disables type hiding. 1502 1503 \param enabled Pass in \c true to enable type hiding, 1504 \c false to disable it. 1505 1506 \since BeOS R5 1507*/ 1508 1509 1510/*! 1511 \fn bool BTextView::IsTypingHidden() const 1512 \brief Returns whether or not typing is hidden. 1513 1514 \return \c true if typing is hidden, \c false otherwise. 1515 1516 \see HideTyping() 1517 1518 \since BeOS R5 1519*/ 1520 1521 1522//! @} 1523