1/* 2 * Copyright 2011-2015, 2019 Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * John Scipione, jscipione@gmail.com 7 * Joseph Groover, looncraz@looncraz.net 8 * 9 * Corresponds to: 10 * headers/os/interface/View.h hrev52835 11 * src/kits/interface/View.cpp hrev53446 12 */ 13 14 15/*! 16 \file View.h 17 \ingroup interface 18 \ingroup libbe 19 \brief BView class definition and support data structures. 20 21 \since BeOS R5 22*/ 23 24 25// mouse buttons 26 27 28/*! 29 \var B_PRIMARY_MOUSE_BUTTON 30 \brief Primary mouse button mask parameter. 31 32 The primary mouse button should be used for main operations (selecting, 33 dragging, or opening objects). 34 35 This maps to B_MOUSE_BUTTON(1). 36 37 \since BeOS R3 38*/ 39 40 41/*! 42 \var B_SECONDARY_MOUSE_BUTTON 43 \brief Secondary mouse button mask parameter. 44 45 The secondary button should be used for additional operations on the 46 pointed objects, such as popup menus. 47 48 This maps to B_MOUSE_BUTTON(2). 49 50 \since BeOS R3 51*/ 52 53 54/*! 55 \var B_TERTIARY_MOUSE_BUTTON 56 \brief Tertiary mouse button mask parameter. 57 58 The tertiary button should be used for clipboard paste. 59 60 This maps to B_MOUSE_BUTTON(3). 61 62 \since BeOS R3 63*/ 64 65 66/*! 67 \var B_MOUSE_BUTTON(n) 68 \brief Compute mouse button mask for button n 69 70 Buttons are numbered from 1 to 32. 71 72 Some mice may not have more than 2 buttons, so the extra buttons should 73 only be used as shortcuts for actions that can be done in alternative ways. 74 75 \since Haiku R1 76*/ 77 78 79// mouse transit 80 81 82/*! 83 \var B_ENTERED_VIEW 84 \brief Mouse transit entered view. 85 86 \since BeOS R3 87*/ 88 89 90/*! 91 \var B_INSIDE_VIEW 92 \brief Mouse transit inside view. 93 94 \since BeOS R3 95*/ 96 97 98/*! 99 \var B_EXITED_VIEW 100 \brief Mouse transit exited view. 101 102 \since BeOS R3 103*/ 104 105 106/*! 107 \var B_OUTSIDE_VIEW 108 \brief Mouse transit outside view. 109 110 \since BeOS R5 111*/ 112 113 114// event mask 115 116 117/*! 118 \var B_POINTER_EVENTS 119 \brief Mouse pointer events mask parameter. 120 121 \since BeOS R5 122*/ 123 124 125/*! 126 \var B_KEYBOARD_EVENTS 127 \brief Keyboard events mask parameter. 128 129 \since BeOS R5 130*/ 131 132 133// event mask options 134 135 136/*! 137 \var B_LOCK_WINDOW_FOCUS 138 \brief Prevents the attached window from losing its focused state while 139 the mouse is held down. 140 141 \since BeOS R5 142*/ 143 144 145/*! 146 \var B_SUSPEND_VIEW_FOCUS 147 \brief Events normally sent to the focus view are suppressed. 148 149 \since BeOS R5 150*/ 151 152 153/*! 154 \var B_NO_POINTER_HISTORY 155 \brief Send only the most recent MouseMoved() event to the view. 156 157 \note New in Haiku: unless this flag is specified, both BWindow and 158 BView::GetMouse() will filter out older mouse moved messages. 159 160 \since BeOS R5 161*/ 162 163 164/*! 165 \var B_FULL_POINTER_HISTORY 166 \brief Send all MouseMoved() events to the view. 167 168 \since Haiku R1 169*/ 170 171 172// event tracking 173 174 175/*! 176 \var B_TRACK_WHOLE_RECT 177 \brief The whole rectangle moves with the cursor. 178 179 \since BeOS R3 180*/ 181 182 183/*! 184 \var B_TRACK_RECT_CORNER 185 \brief The left top corner is fixed while the right and bottom edges 186 move with the cursor. 187 188 \since BeOS R3 189*/ 190 191 192// set font mask 193 194 195/*! 196 \var B_FONT_FAMILY_AND_STYLE 197 \brief Font family and style mask parameter. 198 199 \since BeOS R3 200*/ 201 202 203/*! 204 \var B_FONT_SIZE 205 \brief Font size mask parameter. 206 207 \since BeOS R3 208*/ 209 210 211/*! 212 \var B_FONT_SHEAR 213 \brief Font shear mask parameter. 214 215 \since BeOS R3 216*/ 217 218 219/*! 220 \var B_FONT_ROTATION 221 \brief Font rotation mask parameter. 222 223 \since BeOS R3 224*/ 225 226 227/*! 228 \var B_FONT_SPACING 229 \brief Font spacing mask parameter. 230 231 \since BeOS R3 232*/ 233 234 235/*! 236 \var B_FONT_ENCODING 237 \brief Font encoding mask parameter. 238 239 \since BeOS R3 240*/ 241 242 243/*! 244 \var B_FONT_FACE 245 \brief Font face mask parameter. 246 247 \since BeOS R3 248*/ 249 250 251/*! 252 \var B_FONT_FLAGS 253 \brief Font flags mask parameter. 254 255 \since BeOS R3 256*/ 257 258 259/*! 260 \var B_FONT_FALSE_BOLD_WIDTH 261 \brief Font false bold width mask parameter. 262 263 \since Haiku R1 264*/ 265 266 267/*! 268 \var B_FONT_ALL 269 \brief Font all properties mask parameter. 270 271 \since BeOS R3 272*/ 273 274 275// coordinate spaces 276 277 278/*! 279 \typedef coordinate_space 280 \brief A coordinate or drawing space. 281 \see \ref coordinatespaces 282 283 \since Haiku R1 284*/ 285 286 287/*! 288 \var B_CURRENT_STATE_COORDINATES 289 \brief The current drawing space. 290 291 \since Haiku R1 292*/ 293 294 295/*! 296 \var B_PREVIOUS_STATE_COORDINATES 297 \brief The drawing space of the parent state in the stack. 298 299 \since Haiku R1 300*/ 301 302 303/*! 304 \var B_VIEW_COORDINATES 305 \brief The base coordinate space of the view. 306 307 \since Haiku R1 308*/ 309 310 311/*! 312 \var B_PARENT_VIEW_DRAW_COORDINATES 313 \brief The current drawing space of the parent view. 314 315 \since Haiku R1 316*/ 317 318 319/*! 320 \var B_PARENT_VIEW_COORDINATES 321 \brief The base coordinate space of the parent view. 322 323 \since Haiku R1 324*/ 325 326 327/*! 328 \var B_WINDOW_COORDINATES 329 \brief The coordinate space of the owning window. 330 331 \since Haiku R1 332*/ 333 334 335/*! 336 \var B_SCREEN_COORDINATES 337 \brief The coordinate space of the screen. 338 339 \since Haiku R1 340*/ 341 342 343// view flags 344 345 346/*! 347 \var B_FULL_UPDATE_ON_RESIZE 348 \brief Redraw the entire view on resize. 349 350 \since BeOS R3 351*/ 352 353 354/*! 355 \var _B_RESERVED1_ 356 \brief Reserved for future use. 357 358 \since Haiku R1 359*/ 360 361 362/*! 363 \var B_WILL_DRAW 364 \brief Indicates that the view will do its own drawing. 365 366 \since BeOS R3 367*/ 368 369 370/*! 371 \var B_PULSE_NEEDED 372 \brief Indicates that the view accepts Pulse() messages. 373 374 \since BeOS R3 375*/ 376 377 378/*! 379 \var B_NAVIGABLE_JUMP 380 \brief Indicates this is the default keyboard navigation view. 381 382 \since BeOS R3 383*/ 384 385/*! 386 \var B_FRAME_EVENTS 387 \brief View responds to frame move and resize events. 388 389 \since BeOS R3 390*/ 391 392 393/*! 394 \var B_NAVIGABLE 395 \brief The view is able to receive focus for keyboard navigation. 396 Typically focus is indicated by drawing a blue rectangle around the view. 397 398 \since BeOS R3 399*/ 400 401 402/*! 403 \var B_SUBPIXEL_PRECISE 404 \brief The view draws with sub-pixel precision. 405 406 If this flag is not specified, drawing coordinates will be rounded 407 to the nearest integer. 408 409 \since BeOS R5 410*/ 411 412 413/*! 414 \var B_DRAW_ON_CHILDREN 415 \brief Indicates that the view responds to the DrawAfterChildren() hook 416 method. 417 418 \since BeOS R5 419*/ 420 421 422/*! 423 \var B_INPUT_METHOD_AWARE 424 \brief Indicates the view understands input method add-ons, as used 425 for complex text input in CJK and other languages. 426 427 \since BeOS R5 428*/ 429 430 431/*! 432 \var B_SCROLL_VIEW_AWARE 433 \brief Indicates the view will properly manage scrollbars that 434 have been targeted to it, i.e. update their ranges and proportions. 435 436 \since Haiku R1 437*/ 438 439 440/*! 441 \var B_SUPPORTS_LAYOUT 442 \brief The view supports the layout APIs, i.e. it doesn't require an 443 frame rectangle to be specified. 444 445 \since Haiku R1 446*/ 447 448 449/*! 450 \var B_INVALIDATE_AFTER_LAYOUT 451 \brief Indicates that the view should be redraw after being added to 452 a layout. 453 454 \since Haiku R1 455*/ 456 457 458// resize mask variables, internal variables but are in a public header. 459 460 461/*! 462 \var _RESIZE_MASK_ 463 \brief Resize mask. Do not use. 464 465 \since Haiku R1 466*/ 467 468 469/*! 470 \var _VIEW_TOP_ 471 \brief View top mask variable. Do not use. 472 473 \since Haiku R1 474*/ 475 476 477/*! 478 \var _VIEW_LEFT_ 479 \brief View left mask variable. Do not use. 480 481 \since Haiku R1 482*/ 483 484 485/*! 486 \var _VIEW_BOTTOM_ 487 \brief View bottom mask variable. Do not use. 488 489 \since Haiku R1 490*/ 491 492 493/*! 494 \var _VIEW_RIGHT_ 495 \brief View right mask variable. Do not use. 496 497 \since Haiku R1 498*/ 499 500 501/*! 502 \var _VIEW_CENTER_ 503 \brief View center mask variable. Do not use. 504 505 \since Haiku R1 506*/ 507 508 509/*! 510 \fn inline uint32 _rule_(uint32 r1, uint32 r2, uint32 r3, uint32 r4) 511 \brief Internal function, do not use. 512 513 \since Haiku R1 514*/ 515 516 517// resize mask 518 519 520/*! 521 \var B_FOLLOW_NONE 522 \brief Follow none resize mask parameter. Equivalent to 523 \c B_FOLLOW_LEFT | \c B_FOLLOW_TOP. The view maintains its position 524 in its parent's coordinate system but not in the screen coordinate 525 system. 526 527 \since BeOS R3 528*/ 529 530 531/*! 532 \var B_FOLLOW_ALL_SIDES 533 \brief Follow all sides resize mask parameter. Equivalent to 534 \c B_FOLLOW_LEFT_RIGHT | \c B_FOLLOW_TOP_BOTTOM. The view will be resized 535 with its parent view both horizontally and vertically. 536 537 \since BeOS R3 538*/ 539 540 541/*! 542 \var B_FOLLOW_ALL 543 \brief Equivalent to \c B_FOLLOW_ALL_SIDES. 544 545 \since BeOS R3 546*/ 547 548 549// horizontal resize mask 550 551 552/*! 553 \var B_FOLLOW_LEFT 554 \brief The margin between the left side of the view and the left side 555 of its parent remains constant. 556 557 \since BeOS R3 558*/ 559 560 561/*! 562 \var B_FOLLOW_RIGHT 563 \brief The margin between the right side of the view and the right side 564 of its parent remains constant. 565 566 \since BeOS R3 567*/ 568 569 570/*! 571 \var B_FOLLOW_LEFT_RIGHT 572 \brief The margin between the left and right sides of the view and the left 573 and right sides of its parent both remain constant. 574 575 \since BeOS R3 576*/ 577 578 579/*! 580 \var B_FOLLOW_H_CENTER 581 \brief The view maintains a constant relationship to the horizontal center 582 of its parent view. 583 584 \since BeOS R3 585*/ 586 587 588// vertical resize mask 589 590 591/*! 592 \var B_FOLLOW_TOP 593 \brief The margin between the top of the view and the top of its parent 594 remains constant. 595 596 \since BeOS R3 597*/ 598 599 600/*! 601 \var B_FOLLOW_BOTTOM 602 \brief The margin between the bottom of the view and the bottom of its 603 parent remains constant. 604 605 \since BeOS R3 606*/ 607 608 609/*! 610 \var B_FOLLOW_TOP_BOTTOM 611 \brief The margin between the top and bottom sides of the view and the 612 top and bottom sides of its parent both remain constant. 613 614 \since BeOS R3 615*/ 616 617 618/*! 619 \var B_FOLLOW_V_CENTER 620 \brief The view maintains a constant relationship to the vertical center 621 of its parent view. 622 623 \since BeOS R3 624*/ 625 626 627/*! 628 \var B_FOLLOW_LEFT_TOP 629 \brief The margins between the left and top sides of the view and the left 630 and top sides of its parent remain constant. 631 632 \since Haiku R1 633*/ 634 635 636/*! 637 \class BView 638 \ingroup interface 639 \ingroup libbe 640 \brief View base class. 641 642 A BView is a rectangular area within a window that responds to mouse clicks 643 and key presses, and acts as a surface for you to draw on. 644 645 Most Interface Kit classes, with the notable exception of BWindow inherit from 646 BView. Some of the time you might use a BView object as is, but most of the 647 time you subclass BView to do something unique. 648 649 To create a subclass of BView you generally override one or more of BView's 650 hook methods to respond to user events such as MouseDown() or FrameMoved(). 651 By default a BView does nothing in its hook methods unless otherwise stated, 652 it's up to you to define what happens. To override the look of a BView you 653 should override the Draw() or DrawAfterChildren() methods. See the section on 654 Hook Methods below for more details. 655 656 When a BView object is first created it has no parent or child views. How you 657 add a view to the view hierarchy depends on if you want to use a standard 658 view with a defined frame rectangle or to use the Layout APIs to position and 659 size your view instead. 660 661 If you create a standard view you need to add it to a window or another view 662 using the AddChild() method, if you create a layout view you need to add your 663 view to a layout using BLayout::AddView() or by adding it to a layout builder. 664 665 Views are not very interesting until they, or one of their parents, are 666 attached to a window as many of BView's methods depend on a connection to the 667 App Server to do their work. In order to prevent multiple views from altering 668 the window simultaneously though locking is required. To perform an action 669 while the window is locked you issue the following code: 670 671\code 672if (Window()->LockLooper()) { 673 ... 674 Window()->UnlockLooper() 675} 676\endcode 677 678 Whenever App Server calls a hook method it automatically locks the BWindow for 679 you. 680 681 Only one view attached to a window is able to receive keyboard events at a 682 time. The view that is able to receive keyboard events such as KeyDown() is 683 called the "focus view". MakeFocus() gives or removes focus from a view. 684 Call IsFocus() to determine whether or not the view is the window's current 685 focus view. 686 687 When a view has focus an indicator should be drawn to inform the user. Typically 688 the view is surrounded by a blue rectangle to indicate that it is the window's 689 focus view. The color can be queried using the keyboard_navigation_color() 690 function in InterfaceDefs.h 691 692 Each view has its own coordinate system with the origin point (0.0, 0.0) 693 located at the top left corner. You can convert a BPoint or BRect to or from 694 the view's coordinate system to the coordinate system of its parent, or 695 of the screen's coordinate system. See the section on Coordinate Conversion 696 Methods for more details. 697 698 The Application Server clips a BView to the region where it's permitted to 699 draw which is never larger than the view's bound rectangle. A view can never 700 draw outside its bounds nor can it draw outside of the bounds rectangle of any 701 parent view. 702 703 You may limit the clipping region further by passing a BRegion object to 704 ConstrainClippingRegion(). You can obtain the current clipping region by 705 calling GetClippingRegion(). 706 707 Each view has a ViewColor() that fills the frame rectangle before the 708 view does any drawing of its own. The default view color is white, you may 709 change the view color by calling SetViewColor() or, as of Haiku R1, 710 SetViewUIColor(). A commonly used view color is \c B_PANEL_BACKGROUND_COLOR 711 which is a user-defined color used as the view color of most applications. 712 If you set the view color to \c B_TRANSPARENT_COLOR then the Application Server 713 won't erase the clipping region of the view before updating, this should only 714 be used if the view erases itself by drawing on every pixel in the clipping 715 region. 716 717 If you want to set the view color of a view to be the same as its parent you 718 need to set it within the AttachedToWindow() method of the view like so: 719 720\code 721SetViewColor(Parent()->ViewColor()); 722\endcode 723 724 \since BeOS R3 725*/ 726 727 728 729/*! 730 \fn BView::BView(const char* name, uint32 flags, BLayout* layout) 731 \brief Layout constructor. 732 733 To be used as part of a BLayout. You may use the Layout Methods found below 734 to set the size and alignment constraints of the view. 735 736 \c B_SUPPORTS_LAYOUT is automatically set to the view. The view flags can be 737 set after the view has been constructed by calling the SetFlags() methods. 738 739 \param name The name of the view, can be \c NULL. 740 \param flags The view flags, a mask of one or more of the following: 741 - \c B_FULL_UPDATE_ON_RESIZE Redraw the entire view on resize. 742 - \c B_WILL_DRAW Indicates that the view will do its own drawing. 743 - \c B_PULSE_NEEDED The view accepts Pulse() messages. 744 - \c B_NAVIGABLE_JUMP Default for keyboard navigation. 745 - \c B_FRAME_EVENTS Responds to move and resize events. 746 - \c B_NAVIGABLE Able to receive keyboard navigation focus. 747 - \c B_SUBPIXEL_PRECISE Draws with sub-pixel precision. 748 - \c B_DRAW_ON_CHILDREN Responds to DrawAfterChildren(). 749 - \c B_INPUT_METHOD_AWARE Allows access input method add-ons. 750 - \c B_SUPPORTS_LAYOUT Supports the layout APIs, i.e. it doesn't 751 use a frame rectangle. 752 - \c B_INVALIDATE_AFTER_LAYOUT Is redraw after added to a layout. 753 \param layout A \a layout to set the view to. 754 755 \since Haiku R1 756*/ 757 758 759/*! 760 \fn BView::BView(BRect frame, const char* name, uint32 resizingMode, 761 uint32 flags) 762 \brief Standard constructor. 763 764 A newly constructed BView object has no parent, you must assign it one by 765 passing it into the AddChild() method of another view or window. Once the 766 view or a parent view has been attached to a window the view becomes part of 767 that window's view hierarchy. 768 769 When the BView object is added as a child the \a frame values are interpreted 770 in the parent's coordinate system. The frame rectangle should be specified in 771 integral values to align on pixel boundaries, decimal values will be rounded. 772 773 The resizing mode flags and view flags can be set after the view has been 774 constructed by calling the SetResizingMode() and SetFlags() methods. 775 776 \param frame The \a frame rectangle of the view. 777 \param name The name of the view, can be \c NULL. 778 \param resizingMode Defines the view's behavior when its parent is resized. 779 \n\n It combines one of the following horizontal resizing constants: 780 \li \c B_FOLLOW_TOP The margin between the top of the view and the top 781 of its parent remains constant. 782 \li \c B_FOLLOW_BOTTOM The margin between the bottom of the view and 783 the bottom of its parent remains constant. 784 \li \c B_FOLLOW_TOP_BOTTOM The margin between the top and bottom sides 785 of the view and the top and bottom sides of the parent both remain 786 constant. 787 \li \c B_FOLLOW_V_CENTER Maintains a constant relationship to the 788 vertical center of the parent view. 789 790 with one of the following vertical resizing constants: 791 \li \c B_FOLLOW_LEFT The margin between the left side of the view and 792 the left side of its parent remains constant. 793 \li \c B_FOLLOW_RIGHT The margin between the right side of the view and 794 the right side of the parent remains constant. 795 \li \c B_FOLLOW_LEFT_RIGHT The margin between the left and right sides 796 of the view and the left and right sides of its parent both remain 797 constant. 798 \li \c B_FOLLOW_H_CENTER The view maintains a constant relationship to 799 the horizontal center of the parent view. 800 801 or use one of the following combined horizontal/vertical constants: 802 \li \c B_FOLLOW_NONE Equivalent to \c B_FOLLOW_LEFT | \c B_FOLLOW_TOP. 803 \li \c B_FOLLOW_ALL_SIDES Equivalent to 804 \c B_FOLLOW_LEFT_RIGHT | \c B_FOLLOW_TOP_BOTTOM. 805 \param flags The view flags, a mask of one or more of the following: 806 - \c B_FULL_UPDATE_ON_RESIZE Redraw the entire view on resize. 807 - \c B_WILL_DRAW Indicates that the view will do its own drawing. 808 - \c B_PULSE_NEEDED The view accepts Pulse() messages. 809 - \c B_NAVIGABLE_JUMP Default for keyboard navigation. 810 - \c B_FRAME_EVENTS Responds to move and resize events. 811 - \c B_NAVIGABLE Able to receive keyboard navigation focus. 812 - \c B_SUBPIXEL_PRECISE Draws with sub-pixel precision. 813 - \c B_DRAW_ON_CHILDREN Responds to DrawAfterChildren(). 814 - \c B_INPUT_METHOD_AWARE Allows access input method add-ons. 815 - \c B_SUPPORTS_LAYOUT Supports the layout APIs, i.e. it doesn't 816 use a frame rectangle. 817 - \c B_INVALIDATE_AFTER_LAYOUT Is redraw after added to a layout. 818 819 \since BeOS R3 820*/ 821 822 823/*! 824 \fn BView::BView(BMessage* archive) 825 \brief Archive constructor. 826 827 \param archive The message data to construct the view from. 828 829 \since BeOS R3 830*/ 831 832 833/*! 834 \fn BView::~BView() 835 \brief Destructor method. 836 837 Deletes the view and all children freeing any memory used. 838 839 \since BeOS R3 840*/ 841 842 843/*! 844 \name Archiving 845*/ 846 847 848//! @{ 849 850 851/*! 852 \fn BArchivable* BView::Instantiate(BMessage* data) 853 \brief Creates a new BView object from the \a data message. 854 855 \returns A newly created BView object or \c NULL if the message doesn't 856 contain an archived BView. 857 858 \since BeOS R3 859*/ 860 861 862/*! 863 \fn status_t BView::Archive(BMessage* data, bool deep) const 864 \brief Archives the object into the \a data message. 865 866 \param data A pointer to the BMessage object to archive the object into. 867 \param deep Whether or not to archive child views as well. 868 869 \return A status code, \c B_OK if everything went well or an error code 870 otherwise. 871 \retval B_OK The object was archived successfully. 872 \retval B_NO_MEMORY Ran out of memory while archiving the object. 873 874 \since BeOS R3 875*/ 876 877 878//! @} 879 880 881/*! 882 \name Hook Methods 883*/ 884 885 886//! @{ 887 888 889/*! 890 \fn status_t BView::AllUnarchived(const BMessage* from) 891 \brief Hook method called when all views have been unarchived. 892 893 \since BeOS R3 894*/ 895 896 897/*! 898 \fn status_t BView::AllArchived(BMessage* into) const 899 \brief Hook method called when all views have been archived. 900 901 \since BeOS R3 902*/ 903 904 905/*! 906 \fn void BView::AllAttached() 907 \brief Similar to AttachedToWindow() but this method is triggered after 908 all child views have already been attached to a window. 909 910 \since BeOS R3 911*/ 912 913 914/*! 915 \fn void BView::DetachedFromWindow() 916 \brief Hook method called when the object is detached from a window. 917 918 \since BeOS R3 919*/ 920 921 922/*! 923 \fn void BView::AttachedToWindow() 924 \brief Hook method called when the object is attached to a window. 925 926 \since BeOS R3 927*/ 928 929 930/*! 931 \fn void BView::AllDetached() 932 \brief Similar to AttachedToWindow() but this method is triggered after 933 all child views have already been detached from a window. 934 935 \since BeOS R3 936*/ 937 938 939/*! 940 \fn void BView::Draw(BRect updateRect) 941 \brief Draws the area of the view that intersects \a updateRect. 942 943 Derived classes should override this method to draw their view. 944 945 \remark This is an hook method called by the Interface Kit, you don't have to 946 call it yourself. If you need to forcefully redraw the view consider 947 calling Invalidate() instead. 948 949 \param updateRect The rectangular area to be drawn. 950 951 \since BeOS R3 952*/ 953 954 955/*! 956 \fn void BView::DrawAfterChildren(BRect updateRect) 957 \brief Perform any drawing that needs to be done after child view have 958 already been drawn. 959 960 \param updateRect The rectangular area to drawn in. 961 962 \since BeOS R5 963*/ 964 965 966/*! 967 \fn void BView::FrameMoved(BPoint newPosition) 968 \brief Hook method called when the view is moved. 969 970 \param newPosition The point of the top left corner of the frame 971 that the view has been moved to. 972 973 \since BeOS R3 974*/ 975 976 977/*! 978 \fn void BView::FrameResized(float newWidth, float newHeight) 979 \brief Hook method called when the view is resized. 980 981 \param newWidth The new width of the view. 982 \param newHeight The new height of the view. 983 984 \since BeOS R3 985*/ 986 987 988/*! 989 \fn void BView::KeyDown(const char* bytes, int32 numBytes) 990 \brief Hook method called when a keyboard key is pressed. 991 992 \param bytes The bytes of the key combination pressed. 993 \param numBytes The number of bytes in \a bytes. 994 995 \since BeOS R3 996*/ 997 998 999/*! 1000 \fn void BView::KeyUp(const char* bytes, int32 numBytes) 1001 \brief Hook method called when a keyboard key is released. 1002 1003 \param bytes The bytes of the key combination pressed. 1004 \param numBytes The number of bytes in \a bytes. 1005 1006 \since BeOS R3 1007*/ 1008 1009 1010/*! 1011 \fn virtual void BView::LayoutChanged() 1012 \brief Hook function that is called when the layout if this view, or one of 1013 its children, has changed. 1014 1015 \since Haiku R1 1016*/ 1017 1018 1019/*! 1020 \fn void BView::LayoutInvalidated(bool descendants) 1021 \brief Hook method called when the layout is invalidated. 1022 1023 \param descendants Whether or not child views have also been invalidated. 1024 1025 \since Haiku R1 1026*/ 1027 1028 1029/*! 1030 \fn void BView::MessageReceived(BMessage* message) 1031 \brief Handle \a message received by the associated looper. 1032 1033 \param message The \a message received by the associated looper. 1034 1035 \see BHandler::MessageReceived() 1036 1037 \since BeOS R3 1038*/ 1039 1040 1041/*! 1042 \fn void BView::MouseDown(BPoint where) 1043 \brief Hook method called when a mouse button is pressed. 1044 1045 \param where The point on the screen where the mouse pointer is when 1046 the mouse button is pressed. 1047 1048 \since BeOS R3 1049*/ 1050 1051 1052/*! 1053 \fn void BView::MouseUp(BPoint where) 1054 \brief Hook method called when a mouse button is released. 1055 1056 \param where The point on the screen where the mouse pointer is when 1057 the mouse button is released. 1058 1059 \note Calling GetMouse() in MouseUp() will return the new state of the mouse buttons 1060 (after the mouse button was released). If you want to know which button was released, 1061 you have to compare that with the previous state of the buttons, that you can memorize 1062 for example by calling GetMouse() in MouseDown(). 1063 1064 \since BeOS R3 1065*/ 1066 1067 1068/*! 1069 \fn void BView::MouseMoved(BPoint where, uint32 code, 1070 const BMessage* dragMessage) 1071 \brief Hook method called when the mouse is moved. 1072 1073 \param where The new location of the mouse in the view's coordinate system. 1074 \param code One of the following: 1075 - \c B_ENTERED_VIEW The cursor has just entered the view. 1076 - \c B_INSIDE_VIEW The cursor is inside the view. 1077 - \c B_EXITED_VIEW The cursor has left the view's bounds. This only gets sent 1078 if the scope of the mouse events that the view can receive has been 1079 expanded by SetEventMask() or SetMouseEventMask(). 1080 - \c B_OUTSIDE_VIEW The cursor is outside the view. This only gets sent if the 1081 scope of the mouse events that the view can receive has been expanded by 1082 SetEventMask() or SetMouseEventMask(). 1083 \param dragMessage If a drag-and-drop operation is taking place this is a 1084 pointer to a BMessage that holds the drag information, otherwise the 1085 pointer is \c NULL. 1086 1087 \sa SetEventMask(), SetMouseEventMask() 1088 \sa DragMessage() 1089 1090 \since BeOS R3 1091*/ 1092 1093 1094/*! 1095 \fn void BView::Pulse() 1096 \brief Hook method called when the view receives a \c B_PULSE 1097 message. 1098 1099 An action is performed each time the App Server calls the Pulse() method. 1100 The pulse rate is set by SetPulseRate(). You can implement Pulse() to do 1101 anything you want. The default version does nothing. The pulse granularity 1102 is no better than once per 100,000 microseconds. 1103 1104 \sa SetPulseRate() 1105 1106 \since BeOS R3 1107*/ 1108 1109 1110/*! 1111 \fn void BView::TargetedByScrollView(BScrollView* scrollView) 1112 \brief Hook method called when the view becomes the target of 1113 \a scrollView. 1114 1115 \param scrollView The BScrollView object that has targeted the view. 1116 1117 \since Haiku R1 1118*/ 1119 1120 1121/*! 1122 \fn void BView::WindowActivated(bool active) 1123 \brief Hook method called when the attached window is activated or 1124 deactivated. 1125 1126 \param active \c true when the window becomes activated, \c false when the 1127 window becomes deactivated. 1128 1129 \since BeOS R3 1130*/ 1131 1132 1133//! @} 1134 1135 1136/*! 1137 \fn BRect BView::Bounds() const 1138 \brief Returns the view's frame rectangle in the view's coordinate system. 1139 1140 \return The view's bounding rectangle in the view's coordinate system. 1141 1142 \since BeOS R3 1143*/ 1144 1145 1146/*! 1147 \fn BRect BView::Frame() const 1148 \brief Returns the view's frame rectangle in the parent's coordinate system. 1149 1150 \returns The view's frame rectangle in the parent's coordinate system. 1151 1152 \since BeOS R3 1153*/ 1154 1155 1156/*! 1157 \name Coordinate Conversions 1158*/ 1159 1160 1161//! @{ 1162 1163 1164/*! 1165 \fn void BView::ConvertToParent(BPoint* point) const 1166 \brief Convert \a point to the parent's coordinate system in place. 1167 1168 \param point A pointer to a BPoint object to convert. 1169 1170 \since BeOS R3 1171*/ 1172 1173 1174/*! 1175 \fn BPoint BView::ConvertToParent(BPoint point) const 1176 \brief Returns \a point converted to the parent's coordinate system. 1177 1178 \param point A BPoint object to convert. 1179 1180 \return A new BPoint object in the parent's coordinate system. 1181 1182 \since BeOS R3 1183*/ 1184 1185 1186/*! 1187 \fn void BView::ConvertFromParent(BPoint* point) const 1188 \brief Convert \a point from the parent's coordinate system to the 1189 view's coordinate system in place. 1190 1191 \param point A pointer to a BPoint object to convert. 1192 1193 \since BeOS R3 1194*/ 1195 1196 1197/*! 1198 \fn BPoint BView::ConvertFromParent(BPoint point) const 1199 \brief Returns \a point converted from the parent's coordinate system to 1200 the view's coordinate system. 1201 1202 \param point A BPoint object to convert. 1203 1204 \return A new BPoint object in the view's coordinate system. 1205 1206 \since BeOS R3 1207*/ 1208 1209 1210/*! 1211 \fn void BView::ConvertToParent(BRect* rect) const 1212 \brief Convert \a rect to the parent's coordinate system in place. 1213 1214 \param rect A pointer to a BRect object to convert. 1215 1216 \since BeOS R3 1217*/ 1218 1219 1220/*! 1221 \fn BRect BView::ConvertToParent(BRect rect) const 1222 \brief Returns \a rect converted to the parent's coordinate system. 1223 1224 \param rect A BRect object to convert. 1225 1226 \return A new BRect object in the parent's coordinate system. 1227 1228 \since BeOS R3 1229*/ 1230 1231 1232/*! 1233 \fn void BView::ConvertFromParent(BRect* rect) const 1234 \brief Convert \a rect from the parent's coordinate system to the 1235 view's coordinate system in place. 1236 1237 \param rect A pointer to a BRect object to convert. 1238 1239 \since BeOS R3 1240*/ 1241 1242 1243/*! 1244 \fn BRect BView::ConvertFromParent(BRect rect) const 1245 \brief Returns \a rect converted from the parent's coordinate system to the 1246 view's coordinate system. 1247 1248 \param rect A BRect object to convert. 1249 1250 \return A new BRect object in the view's coordinate system. 1251 1252 \since BeOS R3 1253*/ 1254 1255 1256/*! 1257 \fn void BView::ConvertToScreen(BPoint* point) const 1258 \brief Convert \a point to the screen's coordinate system in place. 1259 1260 \param point A pointer to a BPoint object to convert. 1261 1262 \since BeOS R3 1263*/ 1264 1265 1266/*! 1267 \fn BPoint BView::ConvertToScreen(BPoint point) const 1268 \brief Returns \a point converted to the screen's coordinate system. 1269 1270 \param point A BPoint object to convert. 1271 1272 \return A new BPoint object in the screen's coordinate system. 1273 1274 \since BeOS R3 1275*/ 1276 1277 1278/*! 1279 \fn void BView::ConvertFromScreen(BPoint* point) const 1280 \brief Convert \a point from the screen's coordinate system to the 1281 view's coordinate system in place. 1282 1283 \param point A pointer to a BPoint object to convert. 1284 1285 \since BeOS R3 1286*/ 1287 1288 1289/*! 1290 \fn BPoint BView::ConvertFromScreen(BPoint point) const 1291 \brief Returns \a point converted from the screen's coordinate system to 1292 the view's coordinate system. 1293 1294 \param point A BPoint object to convert. 1295 1296 \return A new BPoint object in the view's coordinate system. 1297 1298 \since BeOS R3 1299*/ 1300 1301 1302/*! 1303 \fn void BView::ConvertToScreen(BRect* rect) const 1304 \brief Convert \a rect to the screen's coordinate system in place. 1305 1306 \param rect A pointer to a BRect object to convert. 1307 1308 \since BeOS R3 1309*/ 1310 1311 1312/*! 1313 \fn BRect BView::ConvertToScreen(BRect rect) const 1314 \brief Returns \a rect converted to the screen's coordinate system. 1315 1316 \param rect A BRect object to convert. 1317 1318 \return A new BRect object in the screen's coordinate system. 1319 1320 \since BeOS R3 1321*/ 1322 1323 1324/*! 1325 \fn void BView::ConvertFromScreen(BRect* rect) const 1326 \brief Convert \a rect from the screen's coordinate system to the 1327 view's coordinate system in place. 1328 1329 \param rect A pointer to a BRect object to convert. 1330 1331 \since BeOS R3 1332*/ 1333 1334 1335/*! 1336 \fn BRect BView::ConvertFromScreen(BRect rect) const 1337 \brief Returns \a rect converted from the screen's coordinate system to the 1338 view's coordinate system. 1339 1340 \param rect A BRect object to convert. 1341 1342 \return A new BRect object in the view's coordinate system. 1343 1344 \since BeOS R3 1345*/ 1346 1347 1348/*! 1349 \fn uint32 BView::Flags() const 1350 \brief Return the view flags set in the constructor or by SetFlags(). 1351 1352 \return The view flags as a uint32 mask. 1353 1354 \sa SetFlags() 1355 1356 \since BeOS R3 1357*/ 1358 1359 1360/*! 1361 \fn void BView::SetFlags(uint32 flags) 1362 \brief Sets the view flags to the \a flags mask. 1363 1364 \param flags The view flags to set as a uint32 mask. 1365 1366 \sa Flags() 1367 1368 \since BeOS R3 1369*/ 1370 1371 1372//! @} 1373 1374 1375/*! 1376 \fn void BView::Hide() 1377 \brief Hides the view without removing it from the view hierarchy. 1378 1379 Calls to Hide() and Show() are cumulative. A visible view becomes hidden 1380 once the number of Hide() calls exceeds the number of Show() calls. 1381 1382 \sa Show() 1383 \sa BWindow::Hide() 1384 \sa IsHidden() 1385 1386 \since BeOS R3 1387*/ 1388 1389 1390/*! 1391 \fn void BView::Show() 1392 \brief Shows the view making it visible. 1393 1394 Calls to Hide() and Show() are cumulative. A hidden view becomes visible 1395 again once the number of Show() calls matches the number of Hide() calls. 1396 1397 \sa Hide() 1398 \sa BWindow::Show() 1399 \sa IsHidden() 1400 1401 \since BeOS R3 1402*/ 1403 1404 1405/*! 1406 \fn bool BView::IsFocus() const 1407 \brief Returns whether or not the view is the window's current focus view. 1408 1409 The focus view changes as the user moves from one view to another either 1410 by pushing the tab key or by clicking a new view with the mouse. The change 1411 can be made programmatically via the MakeFocus() method. 1412 1413 \returns \c true if the view is the current focus view, \c false otherwise. 1414 1415 \sa MakeFocus() 1416 \sa BWindow::CurrentFocus() 1417 1418 \since BeOS R3 1419*/ 1420 1421 1422/*! 1423 \fn bool BView::IsHidden(const BView* lookingFrom) const 1424 \brief Returns whether or not the view is hidden from the perspective of 1425 \a lookingFrom. 1426 1427 A view is considered hidden if it, any of its parent views, or the window 1428 it's attached to has had the Hide() method called on it. This method 1429 allows you to determine the hidden status of a view from a different point 1430 on the view hierarchy. 1431 1432 \param lookingFrom The view used as a base when determining the hidden 1433 status of the BView object. 1434 1435 \return \c true if the view was hidden via the Hide() method, \c false 1436 otherwise. 1437 1438 \since Haiku R1 1439*/ 1440 1441 1442/*! 1443 \fn bool BView::IsHidden() const 1444 \brief Returns whether or not the view is hidden. 1445 1446 A view can be hidden either by calling Hide() on the view, calling Hide() 1447 on a parent view or calling Hide() on the window that the view is attached 1448 to. When a BWindow or BView is hidden, all its descendants are also hidden. 1449 1450 This method only returns whether the view or an ancestor view has had the 1451 Hide() method called on it, it doesn't consider if the view is obscured 1452 by another view or is off-screen. A BView is not hidden by default. 1453 1454 \return \c true if the view was hidden via the Hide() method, \c false 1455 otherwise. 1456 1457 \since BeOS R3 1458*/ 1459 1460 1461/*! 1462 \fn bool BView::IsPrinting() const 1463 \brief Returns whether or not the view is drawing to a printer. 1464 1465 This method should only be called from the Draw() or DrawAfterChildren() 1466 methods. If called from any other method this method returns \c false. 1467 1468 The view may choose different fonts, images, or colors when drawing to a 1469 printer vs. when drawing to the screen. 1470 1471 \return Returns \c true if drawing to a printer, \c false otherwise. 1472 1473 \since BeOS R3 1474*/ 1475 1476 1477/*! 1478 \fn BPoint BView::LeftTop() const 1479 \brief Returns the left top corner point. 1480 1481 \return The left top corner of the view as a BPoint object. 1482 1483 \since BeOS R3 1484*/ 1485 1486 1487/*! 1488 \fn void BView::SetResizingMode(uint32 mode) 1489 \brief Sets the resizing mode of the view according to the \a mode mask. 1490 1491 The resizing mode is first set in the BView constructor. 1492 1493 \sa ResizingMode() 1494 1495 \since BeOS R3 1496*/ 1497 1498 1499/*! 1500 \fn uint32 BView::ResizingMode() const 1501 \brief Returns the resizing mode flags mask set in the constructor or by 1502 SetResizingMode(). 1503 1504 \returns the current resizing mode flags as a uint32 mask. 1505 1506 \sa SetResizingMode() 1507 1508 \since BeOS R3 1509*/ 1510 1511 1512/*! 1513 \fn void BView::SetViewCursor(const BCursor* cursor, bool sync) 1514 \brief Assigns \a cursor to the view. 1515 1516 This cursor will be displayed when the mouse is positioned inside the view. 1517 1518 \param cursor The BCursor object to assign to the view. 1519 \param sync If \c true App Server is synchronized immediately forcing the 1520 change to occur. If \c false, the change will be put in the queue and 1521 will take effect when the pending requests are processed. 1522 1523 \since BeOS R5 1524*/ 1525 1526 1527/*! 1528 \fn void BView::Flush() const 1529 \brief Flushes the attached window's connection to App Server. 1530 1531 \note If the view isn't attached to a window, Flush() does nothing. 1532 1533 \since BeOS R3 1534*/ 1535 1536 1537/*! 1538 \fn void BView::Sync() const 1539 \brief Synchronizes the attached window's connection to App Server. 1540 1541 \warning If the view isn't attached to a window, Sync() might crash the 1542 application. 1543 1544 \since BeOS R3 1545*/ 1546 1547 1548/*! 1549 \fn BWindow* BView::Window() const 1550 \brief Returns the window the view is attached to. 1551 1552 \return The window the view is attached to or \c NULL if the view isn't 1553 attached to a window. 1554 1555 \since BeOS R3 1556*/ 1557 1558 1559/*! 1560 \fn void BView::GetPreferredSize(float* _width, float* _height) 1561 \brief Fill out the preferred width and height of the view 1562 into the \a _width and \a _height parameters. 1563 1564 Derived classes should override this method to set the preferred 1565 size of object. 1566 1567 \remark Either the \a _width or \a _height parameter may be set to \c NULL 1568 if you only want to get the other one. 1569 1570 \param[out] _width Pointer to a float to store the width of the view. 1571 \param[out] _height Pointer to a float to store the height of the view. 1572 1573 \since BeOS R3 1574*/ 1575 1576 1577/*! 1578 \fn void BView::ResizeToPreferred() 1579 \brief Resizes the view to its preferred size keeping the position of the 1580 left top corner constant. 1581 1582 \warning It is not recommended to use this method for views that are part 1583 of a BLayout. 1584 1585 \since BeOS R3 1586*/ 1587 1588 1589/*! 1590 \name Input Related 1591*/ 1592 1593 1594//! @{ 1595 1596 1597/*! 1598 \fn void BView::BeginRectTracking(BRect startRect, uint32 style) 1599 \brief Displays an outline rectangle on the view and initiates tracking. 1600 1601 This method is typically called from the MouseDown() while EndRectTracking() 1602 is typically called from the MouseUp method(). 1603 1604 \param startRect The initial frame in the view's coordinate system. 1605 \param style This parameter is set to one of the following: 1606 - \c B_TRACK_WHOLE_RECT The position of the rect changes with the cursor 1607 while its size remains the same. 1608 - \c B_TRACK_RECT_CORNER The left top corner is fixed while the right and 1609 bottom edges move with the cursor. 1610 1611 \since BeOS R3 1612*/ 1613 1614 1615/*! 1616 \fn void BView::EndRectTracking() 1617 \brief Ends tracking removing the outline rectangle from the view. 1618 1619 BeginRectTracking() is typically called from the MouseDown() while this 1620 method is typically called from the MouseUp() method. 1621 1622 \since BeOS R3 1623*/ 1624 1625 1626/*! 1627 \fn void BView::DragMessage(BMessage* message, BRect dragRect, 1628 BHandler* replyTo) 1629 \brief Initiates a drag-and-drop session. 1630 1631 \warning This method only works if the BView objects are attached to a 1632 window. 1633 1634 \param message Contains data to be dragged and dropped on the destination 1635 view. The caller retains responsibility for this object. 1636 \param dragRect An outline rectangle used in place of a bitmap image set in 1637 the view's coordinate system. 1638 \param replyTo The target set to handle the message sent in reply to the 1639 dragged message. If \c NULL the reply is instead directed to the 1640 BView object that initiated the drag-and-drop session. 1641 1642 \since BeOS R3 1643*/ 1644 1645 1646/*! 1647 \fn void BView::DragMessage(BMessage* message, BBitmap* image, 1648 BPoint offset, BHandler* replyTo) 1649 \brief Initiates a drag-and-drop session of an \a image. 1650 1651 \warning This method only works if the BView objects are attached to a 1652 window. 1653 1654 \param message Contains data to be dragged and dropped on the destination 1655 view. The caller retains responsibility for this object. 1656 \param image Bitmap image dragged by the user. The memory used by the bitmap 1657 is freed automatically when the message is dropped. 1658 \param offset The offset to the hotspot within the image in the bitmap's 1659 coordinate system. 1660 \param replyTo The target set to handle the message sent in reply to the 1661 dragged message. If \c NULL the reply is instead directed to the 1662 BView object that initiated the drag-and-drop session. 1663 1664 \since BeOS R3 1665*/ 1666 1667 1668/*! 1669 \fn void BView::DragMessage(BMessage* message, BBitmap* image, 1670 drawing_mode dragMode, BPoint offset, BHandler* replyTo) 1671 \brief Initiates a drag-and-drop session of an \a image with drawing_mode 1672 set by \a dragMode. 1673 1674 \warning This method only works if the BView objects are attached to a 1675 window. 1676 1677 \param message Contains data to be dragged and dropped on the destination 1678 view. The caller retains responsibility for this object. 1679 \param image Bitmap image dragged by the user. The memory used by the bitmap 1680 is freed automatically when the message is dropped. 1681 \param dragMode Sets the drawing_mode used to draw the dragged image. Set to 1682 \c B_OP_ALPHA to drag-and-drop partially transparent images. 1683 \param offset The offset to the hotspot within the image in the bitmap's 1684 coordinate system. 1685 \param replyTo The target set to handle the message sent in reply to the 1686 dragged message. If \c NULL the reply is instead directed to the 1687 BView object that initiated the drag-and-drop session. 1688 1689 \since BeOS R5 1690*/ 1691 1692 1693/*! 1694 \fn void BView::GetMouse(BPoint* _location, uint32* _buttons, 1695 bool checkMessageQueue) 1696 \brief Fills out the cursor location and the current state of the mouse 1697 buttons. 1698 1699 The cursor doesn't have to be located within the view for this method to work, 1700 however, the view must be attached to a window. Don't use this method to track 1701 the mouse in your derived view, implement MouseMoved() instead. 1702 1703 \param[out] _location Filled out with the cursor location in the view's 1704 coordinate system. 1705 \param[out] _buttons Filled out with a mask of the following values: 1706 - \c B_PRIMARY_MOUSE_BUTTON 1707 - \c B_SECONDARY_MOUSE_BUTTON 1708 - \c B_TERTIARY_MOUSE_BUTTON 1709 \param checkMessageQueue If \c true pull from any pending MouseMoved() or 1710 MouseUp() events in the message queue top down before filling out 1711 the current mouse cursor state. 1712 1713 \since BeOS R3 1714*/ 1715 1716 1717/*! 1718 \fn void BView::MakeFocus(bool focus) 1719 \brief Makes the view the current focus view of the window or gives up 1720 being the window's focus view. 1721 1722 The focus view handles selections and KeyDown events when the the attached 1723 window is active. There can be only one focus view at a time per window. 1724 1725 When called with \a focus set to \c true this method first calls 1726 MakeFocus() on the previously focused view with \a focus set to 1727 \c false. 1728 1729 The focus doesn't automatically change when MouseDown() is called so calling 1730 MakeFocus() is the only way to make a view the focus view of a window. 1731 Classes derived from BView that can display the current selection, or that 1732 can accept pasted data should call MakeFocus() in their MouseDown() method 1733 to update the focus view of the window on click. 1734 1735 If the view isn't attached to a window this method has no effect. 1736 1737 \param focus \a true to set focus, \a false to remove it. 1738 1739 \since BeOS R3 1740*/ 1741 1742 1743/*! 1744 \fn BScrollBar* BView::ScrollBar(orientation posture) const 1745 \brief Returns the BScrollBar object that has the BView set as its target. 1746 1747 \param posture Either \c B_VERTICAL to get the vertical scroll bar or 1748 \c B_HORIZONTAL to get the horizontal scroll bar. 1749 1750 \returns the Scrollbar object requested or \c NULL if none found. 1751 1752 \see BScrollBar::SetTarget() 1753 1754 \since BeOS R3 1755*/ 1756 1757 1758/*! 1759 \fn void BView::ScrollBy(float deltaX, float deltaY) 1760 \brief Scroll the view by \a deltaX horizontally and \a deltaY vertically. 1761 1762 \param deltaX The amount to scroll horizontally. 1763 \param deltaY The amount to scroll vertically. 1764 1765 \since BeOS R3 1766*/ 1767 1768 1769/*! 1770 \fn void BView::ScrollTo(float x, float y) 1771 \brief Scroll the view to the point specified by coordinates. 1772 1773 \param x The x-coordinate to scroll the view to. 1774 \param y The y-coordinate to scroll the view to. 1775 1776 \since BeOS R3 1777*/ 1778 1779 1780/*! 1781 \fn virtual void BView::ScrollTo(BPoint where) 1782 \brief Scroll the view to the point specified by \a where. 1783 1784 \param where The location to scroll the view to. 1785 1786 \since BeOS R3 1787*/ 1788 1789 1790/*! 1791 \fn void BView::ScrollWithMouseWheelDelta(BScrollBar* scrollBar, 1792 float delta) 1793 \brief Handle the scroll wheel changing over scrollbars. 1794 1795 - Extract the scrollbar change based on the mouse wheel \a delta into a 1796 protected method of BView. 1797 - The method is called from the MessageReceived() method of BScrollBar. 1798 1799 With this change it is now a bit easier to scroll horizontally around the 1800 system by putting the mouse cursor over a horizontal scrollbar and using 1801 the wheel. 1802 1803 \since Haiku R1 1804*/ 1805 1806 1807/*! 1808 \fn status_t BView::SetEventMask(uint32 mask, uint32 options) 1809 \brief Sets whether or not the view can accept mouse and keyboard 1810 events when not in focus. 1811 1812 If \a mask includes \c B_POINTER_EVENTS then the view will receive mouse 1813 events even when the mouse isn't over the view and if it includes 1814 \c B_KEYBOARD_EVENTS the view will receive keyboard events even if it 1815 isn't in focus. 1816 1817 The \a options mask options are as follows: 1818 - \c B_NO_POINTER_HISTORY Tells App Server to only send the most recent 1819 MouseMoved() event to the view sacrificing some granularity. 1820 - \c B_FULL_POINTER_HISTORY Tells App Server to send all MouseMoved() 1821 events to the view. 1822 1823 \param mask The \a mask of \c B_POINTER_EVENTS and \c B_KEYBOARD_EVENTS 1824 to set. 1825 \param options Sets other event-handling options. 1826 1827 \return \c B_OK if everything went fine or an error code, usually 1828 \c B_ERROR if something went wrong. 1829 1830 \sa EventMask() 1831 1832 \since BeOS R5 1833*/ 1834 1835 1836/*! 1837 \fn uint32 BView::EventMask() 1838 \brief Returns the current event mask. 1839 1840 \return The current event mask as a uint32. 1841 1842 \sa SetEventMask() 1843 1844 \since BeOS R5 1845*/ 1846 1847 1848/*! 1849 \fn status_t BView::SetMouseEventMask(uint32 mask, uint32 options) 1850 \brief Sets whether or not the view can accept mouse and keyboard 1851 events when not in focus from within MouseDown() until the 1852 following MouseUp() event. 1853 1854 The \a options mask options are as follows: 1855 - \c B_NO_POINTER_HISTORY Tells App Server to send only the most recent 1856 MouseMoved() event to the view sacrificing mouse movement granularity. 1857 - \c B_FULL_POINTER_HISTORY Tells App Server to send all MouseMoved() 1858 events to the view. 1859 - \c B_SUSPEND_VIEW_FOCUS Events normally sent to the focus view are 1860 suppressed. While the mouse is held down, the keyboard is ignored. 1861 The view receiving the MouseDown() messages doesn't have to be the 1862 focus view to suppress focused messages. 1863 - \c B_LOCK_WINDOW_FOCUS Prevents the attached window from losing its 1864 focused state while the mouse is held down, even if the mouse leaves 1865 the bounds of the window. 1866 1867 \param mask The \a mask of \c B_POINTER_EVENTS and \c B_KEYBOARD_EVENTS 1868 to set. 1869 \param options Sets other event-handling options. 1870 1871 \return \c B_OK if everything went fine or an error code, usually 1872 \c B_ERROR if something went wrong. 1873 1874 \since BeOS R5 1875*/ 1876 1877 1878//! @} 1879 1880 1881/*! 1882 \name Graphics State 1883*/ 1884 1885 1886//! @{ 1887 1888 1889/*! 1890 \fn void BView::PushState() 1891 \brief Saves the drawing state to the stack. 1892 1893 The drawing state contains the following elements: 1894 - local and global origins 1895 - local and global scales 1896 - local and global clipping regions 1897 - the current drawing mode 1898 - pen size and location 1899 - the font context 1900 - foreground and background color 1901 - line cap and join modes 1902 - miter limit 1903 - stipple pattern 1904 1905 A new state context is created after PushState() is called with a local scale 1906 at 0, a local origin at (0, 0), and no clipping region. 1907 1908 \since BeOS R3 1909*/ 1910 1911 1912/*! 1913 \fn void BView::PopState() 1914 \brief Restores the drawing state from the stack. 1915 1916 \since BeOS R3 1917*/ 1918 1919 1920/*! 1921 \fn void BView::SetOrigin(BPoint where) 1922 \brief Sets the origin in the view's coordinate system. 1923 1924 \param where The point to set the origin to. 1925 1926 \sa Origin() 1927 1928 \since BeOS R3 1929*/ 1930 1931 1932/*! 1933 \fn void BView::SetOrigin(float x, float y) 1934 \brief Sets the origin in the view's coordinate system. 1935 1936 \param x The x-coordinate to set the origin to. 1937 \param y The y-coordinate to set the origin to. 1938 1939 \sa Origin() 1940 1941 \since BeOS R3 1942*/ 1943 1944 1945/*! 1946 \fn BPoint BView::Origin() const 1947 \brief Returns the origin point in the view's coordinate system. 1948 1949 \return The local origin point in the view's coordinate system. 1950 1951 \sa SetOrigin() 1952 1953 \since BeOS R3 1954*/ 1955 1956 1957/*! 1958 \fn void BView::SetTransform(BAffineTransform transform) 1959 \brief Sets a BAffineTransform to transform the coordinate system 1960 1961 \sa See Transform() to get the current transformations, and TranslateBy(), 1962 ScaleBy() and RotateBy() for additional transformation options. 1963 1964 \since Haiku R1 1965*/ 1966 1967 1968/*! 1969 \fn BAffineTransform BView::Transform() const 1970 \brief Returns the current BAffineTransform that is applied to the 1971 coordinate system 1972 1973 \sa SetTransform() 1974 1975 \since Haiku R1 1976*/ 1977 1978 1979/*! 1980 \fn BAffineTransform BView::TransformTo(coordinate_space basis) const 1981 \brief Return the BAffineTransform to convert from the current drawing 1982 space to \a basis. 1983 1984 \c B_PREVIOUS_STATE_COORDINATES is equivalent to 1985 \c B_CURRENT_STATE_COORDINATES when there is no parent state. 1986 1987 \c B_PARENT_VIEW_DRAW_COORDINATES and \c B_PARENT_VIEW_COORDINATES are 1988 equivalent to \c B_WINDOW_COORDINATES when used on a root view. 1989 1990 \c B_WINDOW_COORDINATES works as \c B_SCREEN_COORDINATES for unattached 1991 views. 1992 1993 \sa Transform() 1994 \sa \ref coordinatespaces 1995 1996 \since Haiku R1 1997*/ 1998 1999 2000/*! 2001 \fn void BView::TranslateBy(double x, double y) 2002 \brief Translate the current view by coordinates. 2003 2004 The translation of \a x and \a y are applied to the current transformation, 2005 not instead of, so it is an additive action. 2006 2007 \sa See Transform() to get the current transformations, SetTransform(), 2008 ScaleBy() and RotateBy() for additional transformation options. 2009 2010 \since Haiku R1 2011*/ 2012 2013 2014/*! 2015 \fn void BView::ScaleBy(double x, double y) 2016 \brief Scale the current view by factors \a x and \a y. 2017 2018 The scaling with factors \a x and \a y are applied to the current 2019 transformation, not instead of, so it is an additive action. 2020 2021 \sa See Transform() to get the current transformations, SetTransform(), 2022 TranslateBy() and RotateBy() for additional transformation options. 2023 2024 \since Haiku R1 2025*/ 2026 2027 2028/*! 2029 \fn void BView::RotateBy(double angleRadians) 2030 \brief Rotate the current view by \a angleRadians. 2031 2032 The rotation is applied to the current transformation, not instead of, so 2033 it is an additive action. 2034 2035 \sa See Transform() to get the current transformations, SetTransform(), 2036 ScaleBy() and TranslateBy() for additional transformation options. 2037 2038 \since Haiku R1 2039*/ 2040 2041 2042/*! 2043 \fn void BView::SetScale(float scale) const 2044 \brief Sets the scale of the coordinate system the view uses for drawing. 2045 2046 The default scale is 1.0. A \a scale value lower than 1.0 reduces the size of 2047 the drawing coordinate system, a \a scale value greater than 1.0 magnifies 2048 the coordinate system; for example, a \a scale value of 0.5 cuts the drawing 2049 drawing area in half moving the drawing closer to the origin while a \a scale 2050 value of 2.0 doubles the drawing area and moving it away from the origin. 2051 2052 Updating the \a scale of view won't update previously drawn elements. 2053 2054 SetScale() calls are not commutative unless you call them across different 2055 drawing states as the following: 2056 2057\code 2058 view->SetScale(2); 2059 view->SetScale(2); 2060 // view's scale is 2 2061 2062 view2->SetScale(2); 2063 view2->PushState(); 2064 view2->SetScale(2); 2065 // view2's scale is 4 2066\endcode 2067 2068 \param scale The scale factor to set. 2069 2070 \since BeOS R3 2071*/ 2072 2073 2074/*! 2075 \fn float BView::Scale() const 2076 \brief Return the current drawing scale. 2077 2078 \return The current drawing scale. 2079 2080 \since BeOS R3 2081*/ 2082 2083 2084/*! 2085 \fn void BView::SetLineMode(cap_mode lineCap, join_mode lineJoin, 2086 float miterLimit) 2087 \brief Set line mode to use PostScript-style line cap and join modes. 2088 2089 \a lineCap determines the shape of the endpoints of stroked paths while 2090 \a lineJoin determines the shape of the corners where two lines meet. 2091 2092 The default miter limit is 10.0 which gives an angle of 11.478341°. 2093 2094 \param lineCap One of the following: 2095 - \c B_ROUND_CAP A semicircle with diameter of line width is drawn at the 2096 endpoint. 2097 - \c B_BUTT_CAP A straight edge is drawn without extending beyond the endpoint. 2098 - \c B_SQUARE_CAP A straight edge is drawn extending past the endpoint by half 2099 the line width. 2100 \param lineJoin One of the following: 2101 - \c B_ROUND_JOIN Same as \c B_ROUND_CAP but for a join. 2102 - \c B_MITER_JOIN The lines are extended until they meet. If angle that they 2103 meet at is greater than the 2*arcsin(1/\a miterLimit) than a bevel join 2104 is used instead. 2105 - \c B_BEVEL_JOIN The area between the caps is filled with a triangle. 2106 - \c B_BUTT_JOIN Same as \c B_BUTT_CAP but for a join. 2107 - \c B_SQUARE_JOIN Same as \c B_SQUARE_CAP but for a join. 2108 \param miterLimit Sets the cut off angle before a miter join becomes a bevel 2109 join calculated by 2*arcsin(1/\a miterLimit). 2110 2111 \since BeOS R3 2112*/ 2113 2114 2115/*! 2116 \fn join_mode BView::LineJoinMode() const 2117 \brief Returns the current line join mode. 2118 2119 \return The current line join mode set to the view. 2120 2121 \since BeOS R3 2122*/ 2123 2124 2125/*! 2126 \fn cap_mode BView::LineCapMode() const 2127 \brief Returns the current line cap mode. 2128 2129 \return The current line cap mode set to the view. 2130 2131 \since BeOS R3 2132*/ 2133 2134 2135/*! 2136 \fn float BView::LineMiterLimit() const 2137 \brief Returns the miter limit used for \c B_MITER_JOIN join mode. 2138 2139 \return The current miter limit set to the view. 2140 2141 \since BeOS R3 2142*/ 2143 2144 2145/*! 2146 \fn void BView::SetFillRule(int32 rule) 2147 \brief Sets the fill rule for the view. 2148 2149 A fill rule is a rule that describes an algorithm that is used to find out 2150 what the inside of a shape is. The concept comes from the SVG format. 2151 2152 See <a href="https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/fill-rule"> 2153 the Mozilla documentation on the fill property of SVG</a> for more 2154 information. 2155 2156 \param rule There are two algorithms: the \c B_NONZERO and the 2157 \c B_EVEN_ODD algorithm. 2158 2159 \since Haiku R1 2160*/ 2161 2162 2163/*! 2164 \fn int32 BView::FillRule() const 2165 \brief Return the current fill mode. 2166 2167 See BView::SetFillRule() for more information. 2168 2169 \returns Returns \c 0 if no fill rule is applied, \c B_EVEN_ODD when the 2170 even-odd algorithm is applied, and \c B_NONZERO if the nonzero 2171 algorithm is applied. 2172 2173 \since Haiku R1 2174*/ 2175 2176 2177/*! 2178 \fn void BView::SetDrawingMode(drawing_mode mode) 2179 \brief Sets the drawing mode of the view. 2180 2181 The default drawing mode is \c B_OP_COPY. 2182 2183 \param mode Set to one of the following: 2184 - \c B_OP_COPY 2185 - \c B_OP_OVER 2186 - \c B_OP_ERASE 2187 - \c B_OP_INVERT 2188 - \c B_OP_SELECT 2189 - \c B_OP_ALPHA 2190 - \c B_OP_MIN 2191 - \c B_OP_MAX 2192 - \c B_OP_ADD 2193 - \c B_OP_SUBTRACT 2194 - \c B_OP_BLEND 2195 2196 \since BeOS R3 2197*/ 2198 2199 2200/*! 2201 \fn drawing_mode BView::DrawingMode() const 2202 \brief Return the current drawing_mode. 2203 2204 \return The current drawing_mode. 2205 2206 \since BeOS R3 2207*/ 2208 2209 2210/*! 2211 \fn void BView::SetBlendingMode(source_alpha srcAlpha, 2212 alpha_function alphaFunc) 2213 \brief Set the blending mode which controls how transparency is used. 2214 2215 \param srcAlpha Set to one of the following: 2216 - \c B_CONSTANT_ALPHA Use the high color's alpha channel. 2217 - \c B_PIXEL_ALPHA Use the alpha value of each pixel when drawing a bitmap. 2218 \param alphaFunc Set to one of the following: 2219 - \c B_ALPHA_OVERLAY Used for drawing a image with transparency over an opaque 2220 background. 2221 - \c B_ALPHA_COMPOSITE_* Used to composite two or more transparent images 2222 together offscreen to produce a new image drawn using 2223 \c B_ALPHA_OVERLAY mode. 2224 \note Modes other than \c B_ALPHA_OVERLAY and \c B_ALPHA_COMPOSITE work 2225 only with \c B_PIXEL_ALPHA. 2226 2227 \since BeOS R5 2228*/ 2229 2230 2231/*! 2232 \fn void BView::GetBlendingMode(source_alpha* srcAlpha, 2233 alpha_function* alphaFunc) const 2234 \brief Fill out \a srcAlpha and \a alphaFunc with the alpha mode and 2235 alpha function of the view. 2236 2237 \param[out] srcAlpha The alpha mode to fill out. 2238 \param[out] alphaFunc The alpha function to fill out. 2239 2240 \since BeOS R5 2241*/ 2242 2243 2244/*! 2245 \fn void BView::MovePenTo(BPoint point) 2246 \brief Move the pen to \a point in the view's coordinate system. 2247 2248 \param point the location to move the pen to. 2249 2250 \since BeOS R3 2251*/ 2252 2253 2254/*! 2255 \fn void BView::MovePenTo(float x, float y) 2256 \brief Move the pen to the point specified by \a x and \a y in the view's 2257 coordinate system. 2258 2259 \param x The horizontal coordinate to move the pen to. 2260 \param y The vertical coordinate to move the pen to. 2261 2262 \since BeOS R3 2263*/ 2264 2265 2266/*! 2267 \fn void BView::MovePenBy(float x, float y) 2268 \brief Move the pen by \a x pixels horizontally and \a y pixels vertically. 2269 2270 \param x The number of pixels to move the pen horizontally. 2271 \param y The number of pixels to move the pen vertically. 2272 2273 \since BeOS R3 2274*/ 2275 2276 2277/*! 2278 \fn BPoint BView::PenLocation() const 2279 \brief Return the current pen location as a BPoint object. 2280 2281 \return The current pen location in the view's coordinate system. 2282 2283 \sa MovePenTo(BPoint) 2284 \sa MovePenTo(float, float) 2285 \sa MovePenBy(float, float) 2286 2287 \since BeOS R3 2288*/ 2289 2290 2291/*! 2292 \fn void BView::SetPenSize(float size) 2293 \brief Set the pen size to \a size. 2294 2295 \param size The pen size to set. 2296 2297 \since BeOS R3 2298*/ 2299 2300 2301/*! 2302 \fn float BView::PenSize() const 2303 \brief Return the current pen size. 2304 2305 \return The current pen size as a float. 2306 2307 \sa SetPenSize() 2308 2309 \since BeOS R3 2310*/ 2311 2312 2313/*! 2314 \fn bool BView::HasDefaultColors() const 2315 \brief Tests if the view has any colors set. 2316 2317 \return Boolean value, true if colors are not set. 2318 2319 \since Haiku R1 2320*/ 2321 2322 2323/*! 2324 \fn bool BView::HasSystemColors() const 2325 \brief Tests if the view is using system "panel" colors. 2326 B_PANEL_BACKGROUND_COLOR for ViewUIColor() 2327 B_PANEL_BACKGROUND_COLOR for LowUIColor() 2328 B_PANEL_TEXT_COLOR for HighUIColor() 2329 2330 \return Boolean value, true if colors are as described. 2331 2332 \since Haiku R1 2333*/ 2334 2335 2336/*! 2337 \fn void BView::AdoptParentColors() 2338 \brief Attempts to use the colors of any parent view. 2339 Will adopt view, low, and high colors. 2340 Should be called in AttachedToWindow() or AllAttached(). 2341 2342 \since Haiku R1 2343*/ 2344 2345 2346/*! 2347 \fn void BView::AdoptSystemColors() 2348 \brief Instructs view to use standard system "panel" colors. 2349 B_PANEL_BACKGROUND_COLOR for ViewUIColor() 2350 B_PANEL_BACKGROUND_COLOR for LowUIColor() 2351 B_PANEL_TEXT_COLOR for HighUIColor() 2352 2353 \since Haiku R1 2354*/ 2355 2356 2357/*! 2358 \fn void BView::AdoptViewColors(BView* view) 2359 \brief Attempts to use the colors of a given view. 2360 Will adopt view, low, and high colors. 2361 2362 \since Haiku R1 2363*/ 2364 2365 2366/*! 2367 \fn void BView::SetHighColor(rgb_color color) 2368 \brief Set the high color of the view. 2369 2370 \param color The color to set. 2371 2372 \since BeOS R3 2373*/ 2374 2375 2376/*! 2377 \fn void BView::SetHighColor(uchar red, uchar green, uchar blue, 2378 uchar alpha) 2379 \brief Set the high color of the view. 2380 2381 \param red The \a red component of the high color. 2382 \param green The \a green component of the high color. 2383 \param blue The \a blue component of the high color. 2384 \param alpha The \a alpha component of the high color. 2385 2386 \since BeOS R3 2387*/ 2388 2389 2390/*! 2391 \fn void BView::SetHighUIColor(color_which which, float tint) 2392 \brief Set the high color of the view to a system constant. 2393 The color will update live with user changes. 2394 2395 \param which The color_which constant to set. 2396 \param tint Optional tint value to use. 2397 2398 \since Haiku R1 2399*/ 2400 2401 2402/*! 2403 \fn rgb_color BView::HighColor() const 2404 \brief Return the current high color. 2405 2406 \return The current high color as an rgb_color struct. 2407 2408 \sa SetHighColor(rgb_color) 2409 \sa SetHighColor(uchar, uchar, uchar, uchar) 2410 2411 \since BeOS R3 2412*/ 2413 2414 2415/*! 2416 \fn color_which BView::HighUIColor(float* tint) const 2417 \brief Return the current high color constant being used. 2418 2419 \param tint Optional float pointer in which to store the tint 2420 value used to modify the system color constant. 2421 \return The current high color constant. 2422 2423 \sa SetHighUIColor(color_which, float) 2424 2425 \since Haiku R1 2426*/ 2427 2428 2429/*! 2430 \fn void BView::SetLowColor(rgb_color color) 2431 \brief Set the low color of the view. 2432 2433 \param color The color to set. 2434 2435 \since BeOS R3 2436*/ 2437 2438 2439/*! 2440 \fn void BView::SetLowColor(uchar red, uchar green, uchar blue, uchar alpha) 2441 \brief Set the low color of the view. 2442 2443 \param red The \a red component of the low color. 2444 \param green The \a green component of the low color. 2445 \param blue The \a blue component of the low color. 2446 \param alpha The \a alpha component of the low color. 2447 2448 \since BeOS R3 2449*/ 2450 2451 2452/*! 2453 \fn void BView::SetLowUIColor(color_which which, float tint) 2454 \brief Set the low color of the view to a system constant. 2455 The color will update live with user changes. 2456 2457 \param which The color_which constant to set. 2458 \param tint Optional tint value to use. 2459 2460 \since Haiku R1 2461*/ 2462 2463 2464/*! 2465 \fn rgb_color BView::LowColor() const 2466 \brief Return the current low color. 2467 2468 \return The current low color as an rgb_color struct. 2469 2470 \sa SetLowColor(rgb_color) 2471 \sa SetLowColor(uchar, uchar, uchar, uchar) 2472 2473 \since BeOS R3 2474*/ 2475 2476 2477/*! 2478 \fn color_which BView::LowUIColor(float* tint) const 2479 \brief Return the current low color constant being used. 2480 2481 \param tint Optional float pointer in which to store the tint 2482 value used to modify the system color constant. 2483 \return The current low color constant. 2484 2485 \sa SetLowUIColor(color_which, float) 2486 2487 \since Haiku R1 2488*/ 2489 2490 2491/*! 2492 \fn void BView::SetViewColor(rgb_color color) 2493 \brief Set the view color of the view. 2494 2495 \param color The color to set. 2496 2497 \since BeOS R3 2498*/ 2499 2500 2501/*! 2502 \fn void BView::SetViewColor(uchar red, uchar green, uchar blue, 2503 uchar alpha) 2504 \brief Set the view color of the view. 2505 2506 \param red The \a red component of the view color. 2507 \param green The \a green component of the view color. 2508 \param blue The \a blue component of the view color. 2509 \param alpha The \a alpha component of the view color. 2510 2511 \since BeOS R3 2512*/ 2513 2514 2515/*! 2516 \fn void BView::SetViewUIColor(color_which which, float tint) 2517 \brief Set the view color of the view to a system constant. 2518 The color will update live with user changes. 2519 2520 \param which The color_which constant to set. 2521 \param tint Optional tint value to use. 2522 2523 \since Haiku R1 2524*/ 2525 2526 2527/*! 2528 \fn rgb_color BView::ViewColor() const 2529 \brief Return the current view color. 2530 2531 \return The current view color as an rgb_color struct. 2532 2533 \sa SetViewColor(rgb_color) 2534 \sa SetViewColor(uchar, uchar, uchar, uchar) 2535 2536 \since BeOS R3 2537*/ 2538 2539 2540/*! 2541 \fn color_which BView::ViewUIColor(float* tint) const 2542 \brief Return the current view color constant being used. 2543 2544 \param tint Optional float pointer in which to store the tint 2545 value used to modify the system color constant. 2546 \return The current view color constant. 2547 2548 \sa SetViewUIColor(color_which, float) 2549 2550 \since Haiku R1 2551*/ 2552 2553 2554/*! 2555 \fn void BView::ForceFontAliasing(bool enable) 2556 \brief Turn anti-aliasing on and off when printing. 2557 2558 Typically want to turn font anti-aliasing off when printing by passing 2559 \c true to this method and then turn it on again by passing in \c false. 2560 2561 This method does not affect characters drawn to the screen. 2562 2563 \param enable If \c true turn off anti-aliasing, if \c false turn on 2564 anti-aliasing. 2565 2566 \since BeOS R5 2567*/ 2568 2569 2570/*! 2571 \fn void BView::SetFont(const BFont* font, uint32 mask) 2572 \brief Set the font of the view. 2573 2574 By passing \c B_FONT_ALL to the \a mask parameter as is the default all 2575 font properties from \a font are set on the view. 2576 2577 \param font A pointer to a const BFont object to set on the view. 2578 \param mask A mask to determine what font properties to set, either pass 2579 in \c B_FONT_ALL to set all font properties or create a mask 2580 containing one or more of the following values to set: 2581 - \c B_FONT_FAMILY_AND_STYLE 2582 - \c B_FONT_SPACING 2583 - \c B_FONT_SIZE 2584 - \c B_FONT_ENCODING 2585 - \c B_FONT_SHEAR 2586 - \c B_FONT_FACE 2587 - \c B_FONT_ROTATION 2588 - \c B_FONT_FLAGS 2589 2590 \see BFont for more details. 2591 2592 \since BeOS R3 2593*/ 2594 2595 2596/*! 2597 \fn void BView::GetFont(BFont* font) const 2598 \brief Fill out \a font with the font set to the view. 2599 2600 \param[out] font The BFont object to fill out. 2601 2602 \since BeOS R3 2603*/ 2604 2605 2606/*! 2607 \fn void BView::GetFontHeight(font_height* height) const 2608 \brief Fill out the font_height struct with the view font. 2609 2610 \param[out] height The font_height struct to fill out. 2611 2612 \since BeOS R3 2613*/ 2614 2615 2616/*! 2617 \fn void BView::SetFontSize(float size) 2618 \brief Set the size of the view's font to \a size. 2619 2620 \param size The font size to set to the view in points. 2621 2622 \since BeOS R3 2623*/ 2624 2625 2626/*! 2627 \fn float BView::StringWidth(const char* string) const 2628 \brief Return the width of \a string set in the font of the view. 2629 2630 \param string The \a string to get the width of. 2631 2632 \return The width of the string in the view's font as a float. 2633 2634 \since BeOS R3 2635*/ 2636 2637 2638/*! 2639 \fn float BView::StringWidth(const char* string, int32 length) const 2640 \brief Return the width of \a string set in the font of the view up to 2641 \a length characters. 2642 2643 \param string The \a string to get the width of. 2644 \param length The maximum number of characters in \a string to consider. 2645 2646 \return The width of the string in the view's font as a float. 2647 2648 \since BeOS R3 2649*/ 2650 2651 2652/*! 2653 \fn void BView::GetStringWidths(char* stringArray[], int32 lengthArray[], 2654 int32 numStrings, float widthArray[]) const 2655 \brief Fill out widths of the strings in \a stringArray set in the font 2656 of the view into \a widthArray. 2657 2658 \param stringArray The array of strings to get the lengths of. 2659 \param lengthArray The number of characters of the strings in \a stringArray 2660 to consider. 2661 \param numStrings The number of strings in \a stringArray. 2662 \param widthArray The array to store the widths of the strings in 2663 \a stringArray. 2664 2665 \since BeOS R3 2666*/ 2667 2668 2669/*! 2670 \fn void BView::TruncateString(BString* string, uint32 mode, float width) const 2671 \brief Truncate \a string with truncation mode \a mode so that it is no wider 2672 than \a width set in the view's font. 2673 2674 When the string is truncated the missing characters are replaced by a 2675 horizontal ellipses. 2676 2677 \param string The string to truncate in place. 2678 \param mode The truncation mode to use, one of the following: 2679 - \c B_TRUNCATE_BEGINNING Truncate from the beginning of the string. 2680 - \c B_TRUNCATE_MIDDLE Truncate from the middle of the string. 2681 - \c B_TRUNCATE_END Truncate from the end of the string. 2682 - \c B_TRUNCATE_SMART Truncate from anywhere based on the string content. 2683 Not currently implemented. 2684 \param width The maximum width to truncate the string to. 2685 2686 \since BeOS R5 2687*/ 2688 2689 2690/*! 2691 \fn void BView::ClipToPicture(BPicture* picture, BPoint where, bool sync) 2692 \brief Intersects the current clipping region of the view with the pixels 2693 of \a picture. 2694 2695 BPicture instances are resolution independent, \a picture is effectively 2696 drawn at the view's resolution and the bitmap produced is used to modify the 2697 clipping region. 2698 2699 The pixels that are at least partially opaque are the ones drawn by 2700 \a picture. 2701 2702 \param picture The BPicture object to intersect with. 2703 \param where Offset in the view's coordinate system. 2704 \param sync If \c false, this method will execute asynchronously. 2705 2706 \since BeOS R5 2707*/ 2708 2709 2710/*! 2711 \fn void BView::ClipToInversePicture(BPicture* picture, BPoint where, 2712 bool sync) 2713 \brief Intersects the current clipping region of the view with the pixels 2714 outside of \a picture. 2715 2716 \param picture The BPicture object to intersect with. 2717 \param where Offset in the view's coordinate system. 2718 \param sync If \c false, this method will execute asynchronously. 2719 2720 \see ClipToPicture() 2721 2722 \since BeOS R5 2723*/ 2724 2725 2726/*! 2727 \fn void BView::ClipToRect(BRect rect) 2728 \brief Intersects the current clipping region of the view with the pixels 2729 of \a rect. 2730 2731 \param rect The BRect that describes the rectangle to intersect with. 2732 2733 \since Haiku R1 2734*/ 2735 2736 2737/*! 2738 \fn void BView::ClipToInverseRect(BRect rect) 2739 \brief Intersects the current clipping region of the view with the pixels 2740 outside of \a rect. 2741 2742 \param rect The BRect that describes the rectangle to intersect with. 2743 2744 \see ClipToRect() 2745 2746 \since Haiku R1 2747*/ 2748 2749 2750/*! 2751 \fn void BView::ClipToShape(BShape* shape) 2752 \brief Intersects the current clipping region of the view with the pixels 2753 of \a shape. 2754 2755 \param shape The BShape that describes the area to intersect with. 2756 2757 \since Haiku R1 2758*/ 2759 2760 2761/*! 2762 \fn void BView::ClipToInverseShape(BShape* shape) 2763 \brief Intersects the current clipping region of the view with the pixels 2764 outside of \a shape. 2765 2766 \param shape The BShape that describes the area to intersect with. 2767 2768 \see ClipToShape() 2769 2770 \since Haiku R1 2771*/ 2772 2773 2774/*! 2775 \fn void BView::GetClippingRegion(BRegion* region) const 2776 \brief Fill out \a region with the view's clipping region. 2777 2778 \param[out] region The BRegion object to fill out. 2779 2780 Get the current clipping region, which is an intersection of the view 2781 visible region on screen (which depends on the view bounds, any child view 2782 hiding parts of it, and overlapping windows) and the constrained clipping 2783 regions set by calls to ConstrainClippingRegion() in the current stack of 2784 drawing states. 2785 2786 \since BeOS R3 2787*/ 2788 2789 2790/*! 2791 \fn void BView::ConstrainClippingRegion(BRegion* region) 2792 \brief Set the clipping region the \a region restricting the area that the 2793 view can draw in. 2794 2795 The Application Server keeps track of the clipping region for each view 2796 attached to a window so that the view can't draw outside of it, 2797 consequently this method works only for views that are attached to a window. 2798 2799 The default clipping region contains the visible area of the view. By 2800 passing a region to this method the clipping area is further restricted. 2801 Passing in \c NULL resets the clipping region back to the default. 2802 2803 Calls to ConstrainClippingRegion() are not cumulative, each time this 2804 method is called it replaces the old clipping region. However, clipping 2805 regions from previous states are intersected to compute the effective 2806 clipping. 2807 2808 Region-based clipping is not affected by the view transform. If you need to 2809 constrain drawing to a transformed region, use ClipToPicture() and 2810 FillRegion() instead. 2811 2812 \param region The region to set the clipping region to or \c NULL 2813 to reset to default. 2814 2815 \since BeOS R3 2816*/ 2817 2818 2819//! @} 2820 2821 2822/*! 2823 \name Drawing Related 2824 2825 The view must be attached to the window for these methods to work unless 2826 otherwise stated. Notes on specific methods are provided below: 2827 2828 DrawBitmap() 2829 DrawTiledBitmap() 2830 2831 DrawBitmap() scales the image to fit if the image has different size than 2832 the destination rectangle. 2833 2834 DrawTiledBitmap() fills the destination rectangle with copies of the source 2835 image, without changing its size. 2836 2837 The asynchronous versions pass the image to Application Server and return 2838 immediately. 2839 2840 This can be more efficient in some cases for example to draw several bitmaps 2841 at once and then call Sync() to tell Application Server to wait for them all 2842 to finish drawing rather than waiting for each one to draw. 2843 2844 DrawPicture() 2845 2846 The asynchronous versions pass the picture to Application Server and return 2847 immediately. 2848 2849 This can be more efficient in some cases for example to draw several pictures 2850 at once and then call Sync() to tell Application Server to wait for them all 2851 to finish drawing rather than waiting for each one to draw. 2852 2853 DrawPicture() doesn't alter the graphics state of the view nor do changes to 2854 the graphics state of the view alter the BPicture object. What the picture 2855 will look like depends on the graphics parameters that were in effect when the 2856 picture was recorded. 2857 2858 DrawString() 2859 2860 The \a string is drawn in the view's current font and is modified by 2861 the other parameters of the font such as its direction (left-to-right or 2862 right-to-left), rotation, spacing, shear, etc. The \a string is always drawn 2863 left to right even if its text direction is set to right-to-left mode. 2864 2865 Drawing a string is fastest in \c B_OP_COPY mode and anti-aliasing can 2866 produce undesirable effects when a string is draw in other modes, especially 2867 if the string is drawn in the same location repeatedly. 2868 2869 DrawString() doesn't erase before drawing. 2870*/ 2871 2872 2873//! @{ 2874 2875 2876/*! 2877 \fn void BView::DrawBitmapAsync(const BBitmap* bitmap, BRect bitmapRect, 2878 BRect viewRect, uint32 options) 2879 \brief Draws \a bitmap on the view within \a viewRect asynchronously. 2880 \a bitmap portion is scaled to fit \a viewRect. 2881 2882 \param bitmap The bitmap to draw onto the view. 2883 \param bitmapRect The portion of the bitmap to draw in the bitmap's 2884 coordinate system. 2885 \param viewRect The area in the view's coordinate system to draw the 2886 bitmap in. 2887 \param options combination of \a bitmap_drawing_options flags 2888 2889 \since Haiku R1 2890*/ 2891 2892 2893/*! 2894 \fn void BView::DrawBitmapAsync(const BBitmap* bitmap, BRect bitmapRect, 2895 BRect viewRect) 2896 \brief Draws \a bitmap on the view within \a viewRect asynchronously. 2897 \a bitmap portion is scaled to fit \a viewRect. 2898 2899 \param bitmap The bitmap to draw onto the view. 2900 \param bitmapRect The portion of the bitmap to draw in the bitmap's 2901 coordinate system. 2902 \param viewRect The area in the view's coordinate system to draw the 2903 bitmap in. 2904 2905 \since BeOS R3 2906*/ 2907 2908 2909/*! 2910 \fn void BView::DrawBitmapAsync(const BBitmap* bitmap, BRect viewRect) 2911 \brief Draws \a bitmap on the view within \a viewRect asynchronously. 2912 \a bitmap is scaled to fit \a viewRect. 2913 2914 \param bitmap The bitmap to draw onto the view. 2915 \param viewRect The area in the view's coordinate system to draw the 2916 bitmap in. 2917 2918 \since BeOS R3 2919*/ 2920 2921 2922/*! 2923 \fn void BView::DrawBitmapAsync(const BBitmap* bitmap, BPoint where) 2924 \brief Draws \a bitmap on the view offset by \a where asynchronously. 2925 2926 \param bitmap The bitmap to draw onto the view. 2927 \param where The location to draw the bitmap in the view's coordinate system. 2928 2929 \since BeOS R3 2930*/ 2931 2932 2933/*! 2934 \fn void BView::DrawBitmapAsync(const BBitmap* bitmap) 2935 \brief Draws \a bitmap on the view asynchronously. 2936 2937 \param bitmap The bitmap to draw onto the view. 2938 2939 \since BeOS R3 2940*/ 2941 2942 2943/*! 2944 \fn void BView::DrawBitmap(const BBitmap* bitmap, BRect bitmapRect, 2945 BRect viewRect, uint32 options) 2946 \brief Draws \a bitmap on the view within \a viewRect. \a bitmap portion 2947 is scaled to fit \a viewRect. 2948 2949 \param bitmap The bitmap to draw onto the view. 2950 \param bitmapRect The portion of the bitmap to draw in the bitmap's 2951 coordinate system. 2952 \param viewRect The area in the view's coordinate system to draw the 2953 bitmap in. 2954 \param options ?? 2955 2956 \since Haiku R1 2957*/ 2958 2959 2960/*! 2961 \fn void BView::DrawBitmap(const BBitmap* bitmap, BRect bitmapRect, 2962 BRect viewRect) 2963 \brief Draws \a bitmap on the view within \a viewRect. \a bitmap portion 2964 is scaled to fit \a viewRect. 2965 2966 \param bitmap The bitmap to draw onto the view. 2967 \param bitmapRect The portion of the bitmap to draw in the bitmap's 2968 coordinate system. 2969 \param viewRect The area in the view's coordinate system to draw the 2970 bitmap in. 2971 2972 \since BeOS R3 2973*/ 2974 2975 2976/*! 2977 \fn void BView::DrawBitmap(const BBitmap* bitmap, BRect viewRect) 2978 \brief Draws \a bitmap on the view within \a viewRect. \a bitmap is scaled 2979 to fit \a viewRect. 2980 2981 \param bitmap The bitmap to draw onto the view. 2982 \param viewRect The area in the view's coordinate system to draw the 2983 bitmap in. 2984 2985 \since BeOS R3 2986*/ 2987 2988 2989/*! 2990 \fn void BView::DrawBitmap(const BBitmap* bitmap, BPoint where) 2991 \brief Draws \a bitmap on the view offset by \a where. 2992 2993 \param bitmap The bitmap to draw onto the view. 2994 \param where The location to draw the bitmap in the view's coordinate system. 2995 2996 \since BeOS R3 2997*/ 2998 2999 3000/*! 3001 \fn void BView::DrawBitmap(const BBitmap* bitmap) 3002 \brief Draws \a bitmap on the view. 3003 3004 \param bitmap The bitmap to draw onto the view. 3005 3006 \since BeOS R3 3007*/ 3008 3009 3010/*! 3011 \fn void BView::DrawTiledBitmapAsync(const BBitmap* bitmap, BRect viewRect, 3012 BPoint phase = B_ORIGIN) 3013 \brief Draws \a bitmap on the view within \a viewRect asynchronously. 3014 If \a bitmap is smaller, it is cloned to fill remaining space 3015 in \a viewRect. 3016 3017 \param bitmap The bitmap to draw onto the view. 3018 \param viewRect The area in the view's coordinate system to draw the 3019 bitmap in. 3020 \param phase Source bitmap offset used as starting point for drawing. 3021 3022 \since Haiku R1 3023*/ 3024 3025 3026/*! 3027 \fn void BView::DrawTiledBitmap(const BBitmap* bitmap, BRect viewRect, 3028 BPoint phase = B_ORIGIN) 3029 \brief Draws \a bitmap on the view within \a viewRect. If \a bitmap is 3030 smaller, it is cloned to fill remaining space in \a viewRect. 3031 3032 \param bitmap The bitmap to draw onto the view. 3033 \param viewRect The area in the view's coordinate system to draw the 3034 bitmap in. 3035 \param phase Source bitmap offset used as starting point for drawing. 3036 3037 \since Haiku R1 3038*/ 3039 3040 3041/*! 3042 \fn void BView::DrawChar(char c) 3043 \brief Draws character \a c onto to the view at the current pen position. 3044 3045 The character is drawn in the view's current font. 3046 3047 \param c The character to draw. 3048 3049 \since BeOS R3 3050*/ 3051 3052 3053/*! 3054 \fn void BView::DrawChar(char c, BPoint location) 3055 \brief Draws character \a c at the specified \a location in the view. 3056 3057 The character is drawn in the view's current font. 3058 3059 \param c The character to draw. 3060 \param location The location in the view to draw the character. 3061 3062 \since BeOS R3 3063*/ 3064 3065 3066/*! 3067 \fn void BView::DrawString(const char* string, escapement_delta* delta) 3068 \brief Draw \a string onto the view at the current pen position. 3069 3070 \param string The string to draw. 3071 \param delta Adds additional width to each character according to the 3072 following fields: 3073 - nonspace(float) The amount of width to add to characters with visible 3074 glyphs. 3075 - space(float) The amount of width to add to characters with escapements 3076 but don't have visible glyphs. 3077 3078 \since BeOS R3 3079*/ 3080 3081 3082/*! 3083 \fn void BView::DrawString(const char* string, BPoint location, 3084 escapement_delta* delta) 3085 \brief Draw \a string onto the view at the specified \a location in the view. 3086 3087 \param string The string to draw. 3088 \param location The location in the view to draw the string. 3089 \param delta Adds additional width to each character according to the 3090 following fields: 3091 - nonspace(float) The amount of width to add to characters with visible 3092 glyphs. 3093 - space(float) The amount of width to add to characters with escapements 3094 but don't have visible glyphs. 3095 3096 \since BeOS R3 3097*/ 3098 3099 3100/*! 3101 \fn void BView::DrawString(const char* string, int32 length, 3102 escapement_delta* delta) 3103 \brief Draw \a string up to \a length characters onto the view at the current 3104 pen position. 3105 3106 \param string The string to draw. 3107 \param length The maximum number of characters in \a string to draw. 3108 \param delta Adds additional width to each character according to the 3109 following fields: 3110 - nonspace(float) The amount of width to add to characters with visible 3111 glyphs. 3112 - space(float) The amount of width to add to characters with escapements 3113 but don't have visible glyphs. 3114 3115 \since BeOS R3 3116*/ 3117 3118 3119/*! 3120 \fn void BView::DrawString(const char* string, int32 length, BPoint location, 3121 escapement_delta* delta) 3122 \brief Draw \a string up to \a length characters onto the view at the 3123 specified \a location in the view. 3124 3125 \param string The string to draw. 3126 \param length The maximum number of characters in \a string to draw. 3127 \param location The location in the view to draw the string. 3128 \param delta Adds additional width to each character according to the 3129 following fields: 3130 - nonspace(float) The amount of width to add to characters with visible 3131 glyphs. 3132 - space(float) The amount of width to add to characters with escapements 3133 but don't have visible glyphs. 3134 3135 \since BeOS R3 3136*/ 3137 3138 3139/*! 3140 \fn void BView::DrawString(const char* string, const BPoint* locations, 3141 int32 locationCount) 3142 \brief Draw \a string \a locationCount times at the specified \a locations. 3143 3144 \param string The string to draw. 3145 \param locations A pointer to an array of BPoint objects to draw the string. 3146 \param locationCount The number of elements in \a locations. 3147 3148 \since Haiku R1 3149*/ 3150 3151 3152/*! 3153 \fn void BView::DrawString(const char* string, int32 length, 3154 const BPoint* locations, int32 locationCount) 3155 \brief Draw \a string up to \a length characters \a locationCount times at the 3156 specified \a locations. 3157 3158 \param string The string to draw. 3159 \param length The maximum number of characters in \a string to draw. 3160 \param locations A pointer to an array of BPoint objects to draw the string. 3161 \param locationCount The number of elements in \a locations. 3162 3163 \since Haiku R1 3164*/ 3165 3166 3167/*! 3168 \fn void BView::StrokeEllipse(BPoint center, float xRadius, float yRadius, 3169 ::pattern pattern) 3170 \brief Stroke the outline of an ellipse starting at \a center with a 3171 horizontal radius of \a xRadius and a vertical radius of \a yRadius. 3172 3173 \param center The center point. 3174 \param xRadius The horizontal radius. 3175 \param yRadius The vertical radius. 3176 \param pattern One of the following: 3177 - \c B_SOLID_HIGH 3178 - \c B_SOLID_LOW 3179 - \c B_MIXED_COLORS 3180 3181 \since BeOS R3 3182*/ 3183 3184 3185/*! 3186 \fn void BView::StrokeEllipse(BRect rect, ::pattern pattern) 3187 \brief Stroke the outline of an ellipse inscribed within \a rect. 3188 3189 \param rect The area within which to inscribe the shape. 3190 \param pattern One of the following: 3191 - \c B_SOLID_HIGH 3192 - \c B_SOLID_LOW 3193 - \c B_MIXED_COLORS 3194 3195 \since BeOS R3 3196*/ 3197 3198 3199/*! 3200 \fn void BView::FillEllipse(BPoint center, float xRadius, float yRadius, 3201 ::pattern pattern) 3202 \brief Fill an ellipse starting at \a center with a horizontal radius 3203 of \a xRadius and a vertical radius of \a yRadius. 3204 3205 \param center The center point. 3206 \param xRadius The horizontal radius. 3207 \param yRadius The vertical radius. 3208 \param pattern One of the following: 3209 - \c B_SOLID_HIGH 3210 - \c B_SOLID_LOW 3211 - \c B_MIXED_COLORS 3212 3213 \since BeOS R3 3214*/ 3215 3216 3217/*! 3218 \fn void BView::FillEllipse(BRect rect, ::pattern pattern) 3219 \brief Fill an ellipse inscribed within \a rect. 3220 3221 \param rect The area within which to inscribe the shape. 3222 \param pattern One of the following: 3223 - \c B_SOLID_HIGH 3224 - \c B_SOLID_LOW 3225 - \c B_MIXED_COLORS 3226 3227 \since BeOS R3 3228*/ 3229 3230 3231/*! 3232 \fn void BView::FillEllipse(BPoint center, float xRadius, float yRadius, 3233 const BGradient& gradient) 3234 \brief Fill an ellipse with the specified \a gradient pattern starting at 3235 \a center with a horizontal radius of \a xRadius and a vertical radius 3236 of \a yRadius. 3237 3238 \param center The center point. 3239 \param xRadius The horizontal radius. 3240 \param yRadius The vertical radius. 3241 \param gradient The gradient pattern to fill the ellipse with. 3242 3243 \since Haiku R1 3244*/ 3245 3246 3247/*! 3248 \fn void BView::FillEllipse(BRect rect, const BGradient& gradient) 3249 \brief Fill an ellipse with the specified \a gradient pattern inscribed within 3250 \a rect. 3251 3252 \param rect The area within which to inscribe the shape. 3253 \param gradient The gradient pattern to fill the ellipse with. 3254 3255 \since Haiku R1 3256*/ 3257 3258 3259/*! 3260 \fn void BView::StrokeArc(BPoint center, float xRadius, float yRadius, 3261 float startAngle, float arcAngle, ::pattern pattern) 3262 \brief Stroke the outline of an arc starting at \a center with a 3263 horizontal radius of \a xRadius and a vertical radius of \a yRadius 3264 starting at \a startAngle and drawing \a arcAngle degrees. 3265 3266 \param center The center point. 3267 \param xRadius The horizontal radius. 3268 \param yRadius The vertical radius. 3269 \param startAngle The angle to begin drawing at. 3270 \param arcAngle The number of degrees of the arc to draw. 3271 \param pattern One of the following: 3272 - \c B_SOLID_HIGH 3273 - \c B_SOLID_LOW 3274 - \c B_MIXED_COLORS 3275 3276 \since BeOS R3 3277*/ 3278 3279 3280/*! 3281 \fn void BView::StrokeArc(BRect rect, float startAngle, float arcAngle, 3282 ::pattern pattern) 3283 \brief Stroke the outline of an arc inscribed within \a rect starting at 3284 \a startAngle and drawing \a arcAngle degrees. 3285 3286 \param rect The area within which to inscribe the shape. 3287 \param startAngle The angle to begin drawing at. 3288 \param arcAngle The number of degrees of the arc to draw. 3289 \param pattern One of the following: 3290 - \c B_SOLID_HIGH 3291 - \c B_SOLID_LOW 3292 - \c B_MIXED_COLORS 3293 3294 \since BeOS R3 3295*/ 3296 3297 3298/*! 3299 \fn void BView::FillArc(BPoint center, float xRadius, float yRadius, 3300 float startAngle, float arcAngle, ::pattern pattern) 3301 \brief Fill an arc starting at \a center with a horizontal radius of 3302 \a xRadius and a vertical radius of \a yRadius starting at 3303 \a startAngle and drawing \a arcAngle degrees. 3304 3305 \param center The center point. 3306 \param xRadius The horizontal radius. 3307 \param yRadius The vertical radius. 3308 \param startAngle The angle to begin drawing at. 3309 \param arcAngle The number of degrees of the arc to draw. 3310 \param pattern One of the following: 3311 - \c B_SOLID_HIGH 3312 - \c B_SOLID_LOW 3313 - \c B_MIXED_COLORS 3314 3315 \since BeOS R3 3316*/ 3317 3318 3319/*! 3320 \fn void BView::FillArc(BPoint center, float xRadius, float yRadius, 3321 float startAngle, float arcAngle, const BGradient& gradient) 3322 \brief Fill an arc with the specified \a gradient pattern starting at 3323 \a center with a horizontal radius of \a xRadius and a vertical 3324 radius of \a yRadius starting at \a startAngle and drawing 3325 \a arcAngle degrees. 3326 3327 \param center The center point. 3328 \param xRadius The horizontal radius. 3329 \param yRadius The vertical radius. 3330 \param startAngle The angle to begin drawing at. 3331 \param arcAngle The number of degrees of the arc to draw. 3332 \param gradient The gradient pattern to fill the arc with. 3333 3334 \since Haiku R1 3335*/ 3336 3337 3338/*! 3339 \fn void BView::FillArc(BRect rect, float startAngle, float arcAngle, 3340 ::pattern pattern) 3341 \brief Fill an arc inscribed within \a rect starting at startAngle and 3342 drawing \a arcAngle degrees. 3343 3344 \param rect The area within which to inscribe the shape. 3345 \param startAngle The angle to begin drawing at. 3346 \param arcAngle The number of degrees of the arc to draw. 3347 \param pattern One of the following: 3348 - \c B_SOLID_HIGH 3349 - \c B_SOLID_LOW 3350 - \c B_MIXED_COLORS 3351 3352 \since BeOS R3 3353*/ 3354 3355 3356/*! 3357 \fn void BView::FillArc(BRect rect, float startAngle, float arcAngle, 3358 const BGradient& gradient) 3359 \brief Fill an arc with the specified \a gradient pattern inscribed within 3360 \a rect starting at startAngle and drawing \a arcAngle degrees. 3361 3362 \param rect The area within which to inscribe the shape. 3363 \param startAngle The angle to begin drawing at. 3364 \param arcAngle The number of degrees of the arc to draw. 3365 \param gradient The gradient pattern to fill the arc with. 3366 3367 \since Haiku R1 3368*/ 3369 3370 3371/*! 3372 \fn void BView::StrokeBezier(BPoint* controlPoints, ::pattern pattern) 3373 \brief Stroke a bezier curve. 3374 3375 \param controlPoints The list of points that form the bezier curve. 3376 \param pattern One of the following: 3377 - \c B_SOLID_HIGH 3378 - \c B_SOLID_LOW 3379 - \c B_MIXED_COLORS 3380 3381 \since BeOS R3 3382*/ 3383 3384 3385/*! 3386 \fn void BView::FillBezier(BPoint* controlPoints, ::pattern pattern) 3387 \brief Fill a bezier curve. 3388 3389 \param controlPoints The list of points that form the bezier curve. 3390 \param pattern One of the following: 3391 - \c B_SOLID_HIGH 3392 - \c B_SOLID_LOW 3393 - \c B_MIXED_COLORS 3394 3395 \since BeOS R3 3396*/ 3397 3398 3399/*! 3400 \fn void BView::FillBezier(BPoint* controlPoints, const BGradient& gradient) 3401 3402 \brief Fill a bezier curve. 3403 3404 \param controlPoints The list of points that form the bezier curve. 3405 \param gradient The gradient pattern to fill the bezier curve with. 3406 3407 \since Haiku R1 3408*/ 3409 3410 3411/*! 3412 \fn void BView::StrokePolygon(const BPolygon* polygon, bool closed, 3413 ::pattern pattern) 3414 \brief Stroke a polygon shape. 3415 3416 \param polygon The polygon shape to stroke. 3417 \param closed Whether or not the last line of the polygon should intersect 3418 with the initial point. 3419 \param pattern One of the following: 3420 - \c B_SOLID_HIGH 3421 - \c B_SOLID_LOW 3422 - \c B_MIXED_COLORS 3423 3424 \since BeOS R3 3425*/ 3426 3427 3428/*! 3429 \fn void BView::StrokePolygon(const BPoint* pointArray, int32 numPoints, 3430 bool closed, ::pattern pattern) 3431 \brief Stroke a polygon shape made up of points specified by \a pointArray. 3432 3433 \param pointArray An array of points that specify the vertices of the 3434 polygon. 3435 \param numPoints The number of points in \a pointArray. 3436 \param closed Whether or not the last line of the polygon should intersect 3437 with the initial point. 3438 \param pattern One of the following: 3439 - \c B_SOLID_HIGH 3440 - \c B_SOLID_LOW 3441 - \c B_MIXED_COLORS 3442 3443 \since BeOS R3 3444*/ 3445 3446 3447/*! 3448 \fn void BView::StrokePolygon(const BPoint* pointArray, int32 numPoints, 3449 BRect bounds, bool closed, ::pattern pattern) 3450 \brief Stroke a polygon shape made up of points specified by \a pointArray 3451 inscribed by \a bounds. 3452 3453 \param pointArray An array of points that specify the vertices of the 3454 polygon. 3455 \param numPoints The number of points in \a pointArray. 3456 \param bounds The smallest rectangle that encloses the points in 3457 \a pointArray. 3458 \param closed Whether or not the last line of the polygon should intersect 3459 with the initial point. 3460 \param pattern One of the following: 3461 - \c B_SOLID_HIGH 3462 - \c B_SOLID_LOW 3463 - \c B_MIXED_COLORS 3464 3465 \since BeOS R3 3466*/ 3467 3468 3469/*! 3470 \fn void BView::FillPolygon(const BPolygon* polygon, ::pattern pattern) 3471 \brief Fill a polygon shape. 3472 3473 \param polygon The polygon shape to fill. 3474 \param pattern One of the following: 3475 - \c B_SOLID_HIGH 3476 - \c B_SOLID_LOW 3477 - \c B_MIXED_COLORS 3478 3479 \since BeOS R3 3480*/ 3481 3482 3483/*! 3484 \fn void BView::FillPolygon(const BPolygon* polygon, 3485 const BGradient& gradient) 3486 \brief Fill a polygon shape with the specified \a gradient pattern. 3487 3488 \param polygon The polygon shape to fill. 3489 \param gradient The gradient pattern to fill the polygon with. 3490 3491 \since Haiku R1 3492*/ 3493 3494 3495/*! 3496 \fn void BView::FillPolygon(const BPoint* pointArray, int32 numPoints, 3497 ::pattern pattern) 3498 \brief Fill a polygon shape made up of points specified by \a pointArray. 3499 3500 \param pointArray An array of points that specify the vertices of the polygon. 3501 \param numPoints The number of points in \a pointArray. 3502 \param pattern One of the following: 3503 - \c B_SOLID_HIGH 3504 - \c B_SOLID_LOW 3505 - \c B_MIXED_COLORS 3506 3507 \since BeOS R3 3508*/ 3509 3510 3511/*! 3512 \fn void BView::FillPolygon(const BPoint* pointArray, int32 numPoints, 3513 const BGradient& gradient) 3514 \brief Fill a polygon shape made up of points specified by \a pointArray 3515 with the specified \a gradient pattern. 3516 3517 \param pointArray An array of points that specify the vertices of the 3518 polygon. 3519 \param numPoints The number of points in \a pointArray. 3520 \param gradient The gradient pattern to fill the polygon with. 3521 3522 \since Haiku R1 3523*/ 3524 3525 3526/*! 3527 \fn void BView::FillPolygon(const BPoint* pointArray, int32 numPoints, 3528 BRect bounds, ::pattern pattern) 3529 \brief Fill a polygon shape made up of points specified by \a pointArray 3530 inscribed by \a bounds. 3531 3532 \param pointArray An array of points that specify the vertices of the 3533 polygon. 3534 \param numPoints The number of points in \a pointArray. 3535 \param bounds The smallest rectangle that encloses the points in 3536 \a pointArray. 3537 \param pattern One of the following: 3538 - \c B_SOLID_HIGH 3539 - \c B_SOLID_LOW 3540 - \c B_MIXED_COLORS 3541 3542 \since BeOS R3 3543*/ 3544 3545 3546/*! 3547 \fn void BView::FillPolygon(const BPoint* pointArray, int32 numPoints, 3548 BRect bounds, const BGradient& gradient) 3549 \brief Fill a polygon shape made up of points specified by \a pointArray 3550 inscribed by \a bounds with the specified \a gradient pattern. 3551 3552 \param pointArray An array of points that specify the vertices of the 3553 polygon. 3554 \param numPoints The number of points in \a pointArray. 3555 \param bounds The smallest rectangle that encloses the points in 3556 \a pointArray. 3557 \param gradient The gradient pattern to fill the polygon with. 3558 3559 \since Haiku R1 3560*/ 3561 3562 3563/*! 3564 \fn void BView::StrokeRect(BRect rect, ::pattern pattern) 3565 \brief Stroke the rectangle specified by \a rect. 3566 3567 \param rect The rectangular area to stroke. 3568 \param pattern One of the following: 3569 - \c B_SOLID_HIGH 3570 - \c B_SOLID_LOW 3571 - \c B_MIXED_COLORS 3572 3573 \since BeOS R3 3574*/ 3575 3576 3577/*! 3578 \fn void BView::FillRect(BRect rect, ::pattern pattern) 3579 \brief Fill the rectangle specified by \a rect. 3580 3581 \param rect The rectangular area to fill. 3582 \param pattern One of the following: 3583 - \c B_SOLID_HIGH 3584 - \c B_SOLID_LOW 3585 - \c B_MIXED_COLORS 3586 3587 \since BeOS R3 3588*/ 3589 3590 3591/*! 3592 \fn void BView::FillRect(BRect rect, const BGradient& gradient) 3593 \brief Fill the rectangle specified by \a rect with the specified 3594 \a gradient pattern. 3595 3596 \param rect The rectangular area to fill. 3597 \param gradient The gradient pattern to fill the rectangle with. 3598 3599 \since Haiku R1 3600*/ 3601 3602 3603/*! 3604 \fn void BView::StrokeRoundRect(BRect rect, float xRadius, float yRadius, 3605 ::pattern pattern) 3606 \brief Stroke the rounded rectangle with horizontal radius \a xRadius and 3607 vertical radius \a yRadius. 3608 3609 \param rect The rectangular area to stroke the round rect within. 3610 \param xRadius The horizontal radius. 3611 \param yRadius The vertical radius. 3612 \param pattern One of the following: 3613 - \c B_SOLID_HIGH 3614 - \c B_SOLID_LOW 3615 - \c B_MIXED_COLORS 3616 3617 \since BeOS R3 3618*/ 3619 3620 3621/*! 3622 \fn void BView::FillRoundRect(BRect rect, float xRadius, float yRadius, 3623 ::pattern pattern) 3624 \brief Fill the rounded rectangle with horizontal radius \a xRadius and 3625 vertical radius \a yRadius. 3626 3627 \param rect The rectangular area to fill the round rect within. 3628 \param xRadius The horizontal radius. 3629 \param yRadius The vertical radius. 3630 \param pattern One of the following: 3631 - \c B_SOLID_HIGH 3632 - \c B_SOLID_LOW 3633 - \c B_MIXED_COLORS 3634 3635 \since BeOS R3 3636*/ 3637 3638 3639/*! 3640 \fn void BView::FillRoundRect(BRect rect, float xRadius, float yRadius, 3641 const BGradient& gradient) 3642 \brief Fill the rounded rectangle with horizontal radius \a xRadius and 3643 vertical radius \a yRadius with the specified \a gradient pattern. 3644 3645 \param rect The rectangular area to fill the round rect within. 3646 \param xRadius The horizontal radius. 3647 \param yRadius The vertical radius. 3648 \param gradient The gradient pattern to fill the round rect with. 3649 3650 \since Haiku R1 3651*/ 3652 3653 3654/*! 3655 \fn void BView::FillRegion(BRegion* region, ::pattern pattern) 3656 \brief Fill \a region. 3657 3658 \param region The \a region to fill. 3659 \param pattern One of the following: 3660 - \c B_SOLID_HIGH 3661 - \c B_SOLID_LOW 3662 - \c B_MIXED_COLORS 3663 3664 \since BeOS R3 3665*/ 3666 3667 3668/*! 3669 \fn void BView::FillRegion(BRegion* region, const BGradient& gradient) 3670 \brief Fill \a region with the specified \a gradient pattern. 3671 3672 \param region The \a region to fill. 3673 \param gradient The gradient pattern to fill the \a region with. 3674 3675 \since Haiku R1 3676*/ 3677 3678 3679/*! 3680 \fn void BView::StrokeTriangle(BPoint point1, BPoint point2, BPoint point3, 3681 BRect bounds, ::pattern pattern) 3682 \brief Stroke the triangle specified by points \a point1, \a point2, and 3683 \a point3 and enclosed by \a bounds. 3684 3685 \param point1 The first point of the triangle. 3686 \param point2 The second point of the triangle. 3687 \param point3 The third point of the triangle. 3688 \param bounds The rectangular area that encloses the triangle. 3689 \param pattern One of the following: 3690 - \c B_SOLID_HIGH 3691 - \c B_SOLID_LOW 3692 - \c B_MIXED_COLORS 3693 3694 \since BeOS R3 3695*/ 3696 3697 3698/*! 3699 \fn void BView::StrokeTriangle(BPoint point1, BPoint point2, BPoint point3, 3700 ::pattern pattern) 3701 \brief Stroke the triangle specified by points \a point1, \a point2, 3702 and \a point3. 3703 3704 \param point1 The first point of the triangle. 3705 \param point2 The second point of the triangle. 3706 \param point3 The third point of the triangle. 3707 \param pattern One of the following: 3708 - \c B_SOLID_HIGH 3709 - \c B_SOLID_LOW 3710 - \c B_MIXED_COLORS 3711 3712 \since BeOS R3 3713*/ 3714 3715 3716/*! 3717 \fn void BView::FillTriangle(BPoint point1, BPoint point2, BPoint point3, 3718 ::pattern pattern) 3719 \brief Fill the triangle specified by points \a point1, \a point2, 3720 and \a point3. 3721 3722 \param point1 The first point of the triangle. 3723 \param point2 The second point of the triangle. 3724 \param point3 The third point of the triangle. 3725 \param pattern One of the following: 3726 - \c B_SOLID_HIGH 3727 - \c B_SOLID_LOW 3728 - \c B_MIXED_COLORS 3729 3730 \since BeOS R3 3731*/ 3732 3733 3734/*! 3735 \fn void BView::FillTriangle(BPoint point1, BPoint point2, BPoint point3, 3736 const BGradient& gradient) 3737 \brief Fill the triangle specified by points \a point1, \a point2, 3738 and \a point3 with the specified \a gradient pattern. 3739 3740 \param point1 The first point of the triangle. 3741 \param point2 The second point of the triangle. 3742 \param point3 The third point of the triangle. 3743 \param gradient The gradient pattern to fill the triangle with. 3744 3745 \since Haiku R1 3746*/ 3747 3748 3749/*! 3750 \fn void BView::FillTriangle(BPoint point1, BPoint point2, BPoint point3, 3751 BRect bounds, ::pattern pattern) 3752 \brief Fill the triangle specified by points \a point1, \a point2, 3753 and \a point3 and enclosed by \a bounds. 3754 3755 \param point1 The first point of the triangle. 3756 \param point2 The second point of the triangle. 3757 \param point3 The third point of the triangle. 3758 \param bounds The rectangular area that encloses the triangle. 3759 \param pattern One of the following: 3760 - \c B_SOLID_HIGH 3761 - \c B_SOLID_LOW 3762 - \c B_MIXED_COLORS 3763 3764 \since BeOS R3 3765*/ 3766 3767 3768/*! 3769 \fn void BView::FillTriangle(BPoint point1, BPoint point2, BPoint point3, 3770 BRect bounds, const BGradient& gradient) 3771 \brief Fill the triangle specified by points \a point1, \a point2, 3772 and \a point3 and enclosed by \a bounds with the specified 3773 \a gradient pattern. 3774 3775 \param point1 The first point of the triangle. 3776 \param point2 The second point of the triangle. 3777 \param point3 The third point of the triangle. 3778 \param bounds The rectangular area that encloses the triangle. 3779 \param gradient The gradient pattern to fill the triangle with. 3780 3781 \since Haiku R1 3782*/ 3783 3784 3785/*! 3786 \fn void BView::StrokeLine(BPoint toPoint, ::pattern pattern) 3787 \brief Stroke a line from the current pen location to the point \a toPoint. 3788 3789 \param toPoint The end point of the line. 3790 \param pattern One of the following: 3791 - \c B_SOLID_HIGH 3792 - \c B_SOLID_LOW 3793 - \c B_MIXED_COLORS 3794 3795 \since BeOS R3 3796*/ 3797 3798 3799/*! 3800 \fn void BView::StrokeLine(BPoint start, BPoint end, ::pattern pattern) 3801 \brief Stroke a line from point \a start to point \a end. 3802 3803 \param start The start point of the line. 3804 \param end The end point of the line. 3805 \param pattern One of the following: 3806 - \c B_SOLID_HIGH 3807 - \c B_SOLID_LOW 3808 - \c B_MIXED_COLORS 3809 3810 \since BeOS R3 3811*/ 3812 3813 3814/*! 3815 \fn void BView::StrokeShape(BShape* shape, ::pattern pattern) 3816 \brief Stroke \a shape. 3817 3818 \param shape The \a shape to stroke. 3819 \param pattern One of the following: 3820 - \c B_SOLID_HIGH 3821 - \c B_SOLID_LOW 3822 - \c B_MIXED_COLORS 3823 3824 \since BeOS R5 3825*/ 3826 3827 3828/*! 3829 \fn void BView::FillShape(BShape* shape, ::pattern pattern) 3830 \brief Fill \a shape. 3831 3832 \param shape The \a shape to fill. 3833 \param pattern One of the following: 3834 - \c B_SOLID_HIGH 3835 - \c B_SOLID_LOW 3836 - \c B_MIXED_COLORS 3837 3838 \since BeOS R5 3839*/ 3840 3841 3842/*! 3843 \fn void BView::FillShape(BShape* shape, const BGradient& gradient) 3844 \brief Fill \a shape with the specified \a gradient pattern. 3845 3846 \param shape The \a shape to fill. 3847 \param gradient The gradient pattern to fill the \a shape with. 3848 3849 \since Haiku R1 3850*/ 3851 3852 3853/*! 3854 \fn void BView::BeginLineArray(int32 count) 3855 \brief Begin a line array of up to \a count lines. 3856 3857 This is a more efficient way of drawing a large number of lines than calling 3858 StrokeLine() repeatedly. First call BeginLineArray() to begin drawing lines, 3859 then call AddLine() for each line you wish to draw, and finally call 3860 EndLineArray() to finish the line array and draw the lines. 3861 3862 These methods don't move the current pen location or change the high or low 3863 colors of the view. \a count should be close to the number of lines you wish 3864 to draw and should be below 256 to draw efficiently. 3865 3866 \param count The maximum number of lines in the line array to draw. 3867 3868 \see StrokeLine() 3869 3870 \since BeOS R3 3871*/ 3872 3873 3874/*! 3875 \fn void BView::AddLine(BPoint start, BPoint end, rgb_color color); 3876 \brief Add a line to the line array drawn from \a start to \a end. 3877 3878 \param start The \a start point of the line. 3879 \param end The \a end point of the line. 3880 \param color The \a color to draw the line. 3881 3882 \since BeOS R3 3883*/ 3884 3885 3886/*! 3887 \fn void BView::EndLineArray() 3888 \brief End the line array drawing the lines. 3889 3890 \since BeOS R3 3891*/ 3892 3893 3894/*! 3895 \fn void BView::SetDiskMode(char* filename, long offset) 3896 \brief Unimplemented. 3897 3898 \since Haiku R1 3899*/ 3900 3901 3902/*! 3903 \fn void BView::BeginPicture(BPicture* picture) 3904 \brief Begins sending drawing instructions to \a picture. 3905 3906 The \a BPicture object is cleared and any successive drawing instructions sent 3907 to the view are redirected to \a picture until EndPicture() is called. To 3908 append drawing instructions to a BPicture object without clearing it first 3909 call AppendToPicture() instead. 3910 3911 The view doesn't display anything to the screen while it's recording to \a 3912 picture. Use the DrawPicture() method to render the \a picture. 3913 3914 Only drawing instructions performed directly on the view, not its child views 3915 are send to the BPicture object and BPicture captures only primitive graphics 3916 operations. The view must be attached to a window for the drawing instruction 3917 to be recorded. Drawing instructions are recorded even if the view is hidden or 3918 resides outside the clipping region or the window is off-screen. 3919 3920 \param picture The BPicture object to record drawing instructions to. 3921 3922 \since BeOS R3 3923*/ 3924 3925 3926/*! 3927 \fn void BView::AppendToPicture(BPicture* picture) 3928 \brief Appends drawing instructions to \a picture without clearing it first. 3929 3930 \param picture The BPicture object to record drawing instructions to. 3931 3932 \since BeOS R3 3933*/ 3934 3935 3936/*! 3937 \fn BPicture* BView::EndPicture() 3938 \brief Ends the drawing instruction recording session and returns the 3939 BPicture object passed to BeginPicture() or AppendToPicture(). 3940 3941 \return The BPicture object passed to BeginPicture() or AppendToPicture(). 3942 3943 \since BeOS R3 3944*/ 3945 3946 3947/*! 3948 \fn void BView::SetViewBitmap(const BBitmap* bitmap, BRect srcRect, 3949 BRect dstRect, uint32 followFlags, uint32 options) 3950 \brief Sets the background \a bitmap of the view. 3951 3952 All drawing to the view occurs over \a bitmap. Any visible regions not 3953 covered by \a bitmap are filled with the current background color. 3954 3955 Once \a bitmap has been passed in and this method returns the caller may 3956 safely delete the object. 3957 3958 \param bitmap The background bitmap to set to the view. 3959 \param srcRect Specifies the area of \a bitmap to use. 3960 \param dstRect Specifies the area of the view to set \a bitmap to. 3961 \param followFlags Specifies the as the view is resized. See the BView 3962 constructor for more details. 3963 \param options Specifies additional view options. The only option currently 3964 available is \c B_TILE_BITMAP which tiles the bitmap across the view. 3965 3966 \since BeOS R4 3967*/ 3968 3969 3970/*! 3971 \fn void BView::SetViewBitmap(const BBitmap* bitmap, uint32 followFlags, 3972 uint32 options) 3973 \brief Sets the background \a bitmap of the view. 3974 3975 All drawing to the view occurs over \a bitmap. Any visible regions not 3976 covered by \a bitmap are filled with the current background color. 3977 3978 Once \a bitmap has been passed in and this method returns the caller may 3979 safely delete the object. 3980 3981 \param bitmap The background bitmap to set to the view. 3982 \param followFlags Specifies the as the view is resized. See the BView 3983 constructor for more details. 3984 \param options Specifies additional view options. The only option currently 3985 available is \c B_TILE_BITMAP which tiles the bitmap across the view. 3986 3987 \since BeOS R4 3988*/ 3989 3990 3991/*! 3992 \fn void BView::ClearViewBitmap() 3993 \brief Clears the background bitmap of the view if it has one. 3994 3995 \since BeOS R4 3996*/ 3997 3998 3999/*! 4000 \fn status_t BView::SetViewOverlay(const BBitmap* overlay, BRect srcRect, 4001 BRect dstRect, rgb_color* colorKey, uint32 followFlags, uint32 options) 4002 \brief Sets the \a overlay bitmap of the view. 4003 4004 \a colorKey specifies which color pixels in \a overlay are treated as transparent 4005 allowing the pixels of the view to show through. 4006 4007 Once \a overlay has been passed in and this method returns the caller may 4008 safely delete the object. 4009 4010 \param overlay The overlay bitmap to set to the view. 4011 \param srcRect Specifies the area of \a overlay to use. 4012 \param dstRect Specifies the area of the view to set \a overlay to. 4013 \param colorKey The color in \a overlay to treat as transparent. 4014 \param followFlags Specifies the as the view is resized. See the BView 4015 constructor for more details. 4016 \param options Specifies additional view options. The only option currently 4017 available is \c B_TILE_BITMAP which tiles the bitmap across the view. 4018 4019 \since BeOS R5 4020*/ 4021 4022 4023/*! 4024 \fn status_t BView::SetViewOverlay(const BBitmap* overlay, 4025 rgb_color* colorKey, uint32 followFlags, uint32 options) 4026 \brief Sets the \a overlay bitmap of the view. 4027 4028 \a colorKey specifies which color pixels in \a overlay are treated as transparent 4029 allowing the pixels of the view to show through. 4030 4031 Once \a overlay has been passed in and this method returns the caller may 4032 safely delete the object. 4033 4034 \param overlay The overlay bitmap to set to the view. 4035 \param colorKey The color in \a overlay to treat as transparent. 4036 \param followFlags Specifies the as the view is resized. See the BView 4037 constructor for more details. 4038 \param options Specifies additional view options. The only option currently 4039 available is \c B_TILE_BITMAP which tiles the bitmap across the view. 4040 4041 \since BeOS R5 4042*/ 4043 4044 4045/*! 4046 \fn void BView::ClearViewOverlay() 4047 \brief Clears the overlay bitmap of the view if it has one. 4048 4049 \since BeOS R5 4050*/ 4051 4052 4053/*! 4054 \fn void BView::CopyBits(BRect src, BRect dst) 4055 \brief Copy the bits from the \a src rectangle to the \a dst rectangle in the 4056 view's coordinate system. 4057 4058 If the rectangles are of different sizes than \a src is scaled to fit. \a src 4059 is clipped if a part of \a dst lies outside of the visible region of the view. 4060 Only the visible portions of \a src are copied. 4061 4062 The view must be attached to a window for this method to work. 4063 4064 \param src The source rectangle to copy bits from. 4065 \param dst The destination rectangle to copy bits to. 4066 4067 \since BeOS R3 4068*/ 4069 4070 4071/*! 4072 \fn void BView::DrawPicture(const BPicture* picture) 4073 \brief Draws the \a picture at the view's current pen position. 4074 4075 \param picture The BPicture object to draw. 4076 4077 \since BeOS R3 4078*/ 4079 4080 4081/*! 4082 \fn void BView::DrawPicture(const BPicture* picture, BPoint where) 4083 \brief Draws the \a picture at the location in the view specified by \a where. 4084 4085 \param picture The BPicture object to draw. 4086 \param where The point on the view to draw \a picture. 4087 4088 \since BeOS R3 4089*/ 4090 4091 4092/*! 4093 \fn void BView::DrawPicture(const char* filename, long offset, BPoint where) 4094 \brief Draws the \a picture from the file specified by \a filename offset by 4095 \a offset bytes at the location in the view specified by \a where. 4096 4097 \param filename The filename of the file containing the picture to draw. 4098 \param where The point on the view to draw the picture. 4099 \param offset The number of bytes to offset in the file to find the picture. 4100 4101 \since BeOS R4 4102*/ 4103 4104 4105/*! 4106 \fn void BView::DrawPictureAsync(const BPicture* picture) 4107 \brief Draws the \a picture at the view's current pen position. 4108 4109 \param picture The BPicture object to draw. 4110 4111 \since BeOS R5 4112*/ 4113 4114 4115/*! 4116 \fn void BView::DrawPictureAsync(const BPicture* picture, BPoint where) 4117 \brief Draws the \a picture at the location in the view specified by 4118 \a where. 4119 4120 \param picture The BPicture object to draw. 4121 \param where The point on the view to draw \a picture. 4122 4123 \since BeOS R5 4124*/ 4125 4126 4127/*! 4128 \fn void BView::DrawPictureAsync(const char* filename, long offset, 4129 BPoint where) 4130 \brief Draws the \a picture from the file specified by \a filename offset 4131 by \a offset bytes at the location in the view specified by 4132 \a where. 4133 4134 \param filename The filename of the file containing the picture to draw. 4135 \param where The point on the view to draw the picture. 4136 \param offset The number of bytes to offset in the file to find the 4137 picture. 4138 4139 \since BeOS R5 4140*/ 4141 4142 4143/*! 4144 \fn void BView::BeginLayer(uint8 opacity) 4145 \brief Begins a drawing layer. 4146 4147 This feature of BView allows you to create a separate layer, draw on it, 4148 and blend it in with the rest of the view with a given \a opacity. 4149 Internally, the method creates a new drawing buffer, that you can draw on 4150 using the methods of BView. After finishing your layer, you call EndLayer() 4151 to apply the \a opacity to the layer, and blend it in with the existing 4152 drawing. 4153 4154 You can nest layers, meaning you can call this method while drawing a 4155 layer, to create a sublayer. The layers are mixed and blended in order. 4156 4157 This work was done to support drawing for WebKit. 4158 4159 \sa EndLayer() 4160 4161 \since Haiku R1 4162*/ 4163 4164 4165/*! 4166 \fn void BView::EndLayer() 4167 \brief Finish a layer and blend it in with the view. 4168 4169 This is the counterpart to BeginLayer(). You can nest multiple layer. If 4170 this method is called and the current layer is nested in another layer, the 4171 current layer is applied to the layer above. If this is the only layer, it 4172 will directly blend in to the main view. 4173 4174 \sa BeginLayer() 4175 4176 \since Haiku R` 4177*/ 4178 4179 4180/*! 4181 \fn void BView::Invalidate(BRect invalRect) 4182 \brief Sends a message to App Server to redraw the portion of the view 4183 specified by \a invalRect. 4184 4185 \param invalRect The rectangular area of the view to redraw. 4186 4187 \since BeOS R3 4188*/ 4189 4190 4191/*! 4192 \fn void BView::Invalidate(const BRegion* region) 4193 \brief Sends a message to App Server to redraw the portion of the view 4194 specified by \a region. 4195 4196 \param region The region of the view to redraw. 4197 4198 \since Haiku R1 4199*/ 4200 4201 4202/*! 4203 \fn void BView::Invalidate() 4204 \brief Sends a message to App Server to redraw the view. 4205 4206 \since BeOS R3 4207*/ 4208 4209 4210/*! 4211 \fn void BView::DelayedInvalidate(bigtime_t delay) 4212 \brief Sends a message to App Server to redraw the entire view after 4213 a certain, minimum, delay. Repeated calls to this method may be 4214 merged, but the view is guaranteed to be redrawn after the delay 4215 given in the first call of this method. 4216 4217 \param delay The time, in microseconds, to wait until redrawing the view. 4218 4219 \since Haiku R1 4220*/ 4221 4222 4223/*! 4224 \fn void BView::DelayedInvalidate(bigtime_t delay, BRect invalRect) 4225 \brief Sends a message to App Server to redraw the portion of the view 4226 specified by \a invalRect after a certain, minimum, delay. 4227 Repeated calls to this method may be merged, but the invalidated 4228 rect is guaranteed to be redrawn after the minimum delay given 4229 by the first call of this method. 4230 4231 \param delay The time, in microseconds, to wait until redrawing the view. 4232 \param invalRect The rectangular area of the view to redraw. 4233 4234 \since Haiku R1 4235*/ 4236 4237 4238/*! 4239 \fn void BView::InvertRect(BRect rect) 4240 \brief Inverts the colors within \a rect. 4241 4242 This method is often used to draw a highlighted selection in a view. 4243 4244 \param rect The rectangular area in the view to invert the colors of. 4245 4246 \since BeOS R3 4247*/ 4248 4249 4250//! @} 4251 4252 4253/*! 4254 \name View Hierarchy 4255*/ 4256 4257 4258//! @{ 4259 4260 4261/*! 4262 \fn void BView::AddChild(BView* child, BView* before) 4263 \brief Adds \a child to the view hierarchy immediately before \a before. 4264 4265 A view may only have one parent at a time so \a child must not have already 4266 been added to the view hierarchy. If \a before is \c NULL then \a child is added 4267 to the end of the tree. If the view is attached to a window \a child and all 4268 of its descendent views also become attached to the window invoking an 4269 AttachedToWindow() method on each view. 4270 4271 \param child The child view to add. 4272 \param before The sibling view to add \a child before. 4273 4274 \since BeOS R3 4275*/ 4276 4277 4278/*! 4279 \fn bool BView::AddChild(BLayoutItem* child) 4280 \brief Add the \a child layout item to the view hierarchy. 4281 4282 \param child The child layout item to add. 4283 \return Whether or not \a child was added to the view layout hierarchy. 4284 4285 \since Haiku R1 4286*/ 4287 4288 4289/*! 4290 \fn bool BView::RemoveChild(BView* child) 4291 \brief Removes \a child from the view hierarchy. 4292 4293 \param child The child view to remove. 4294 \return Whether or not \a child was removed from the view hierarchy. 4295 4296 \since BeOS R3 4297*/ 4298 4299 4300/*! 4301 \fn int32 BView::CountChildren() const 4302 \brief Returns the number of child views that this view has. 4303 4304 \return The number of child views. 4305 4306 \since BeOS R3 4307*/ 4308 4309 4310/*! 4311 \fn BView* BView::ChildAt(int32 index) const 4312 \brief Returns a pointer to the child view found at \a index. 4313 4314 \param index The index of the child view to return a pointer of. 4315 4316 \return A pointer to the child view at \a index or \c NULL if not found. 4317 4318 \since BeOS R3 4319*/ 4320 4321 4322/*! 4323 \fn BView* BView::NextSibling() const 4324 \brief Returns a pointer to the next sibling view. 4325 4326 \return A pointer to the next sibling view or \a NULL if not found. 4327 4328 \since BeOS R3 4329*/ 4330 4331 4332/*! 4333 \fn BView* BView::PreviousSibling() const 4334 \brief Returns a pointer to the previous sibling view. 4335 4336 \return A pointer to the previous sibling view or \a NULL if not found. 4337 4338 \since BeOS R3 4339*/ 4340 4341 4342/*! 4343 \fn bool BView::RemoveSelf() 4344 \brief Removes the view and all child views from the view hierarchy. 4345 4346 \returns Whether or not the view was removed from the view hierarchy. 4347 4348 \since BeOS R3 4349*/ 4350 4351 4352/*! 4353 \fn BView* BView::Parent() const 4354 \brief Returns a pointer to the view's parent. 4355 4356 \return A pointer to the parent view or \c NULL if not attached. 4357 4358 \since BeOS R3 4359*/ 4360 4361 4362/*! 4363 \fn BView* BView::FindView(const char* name) const 4364 \brief Returns the view in the view hierarchy with the specified \a name. 4365 4366 \return The view in the view hierarchy with the specified \a name or \c NULL 4367 if not found. 4368 4369 \since BeOS R3 4370*/ 4371 4372 4373//! @} 4374 4375 4376/*! 4377 \name View Frame Alteration 4378 4379 As a view's frame rectangle must be aligned to pixel values all parameters are 4380 rounded to the nearest integer. If the view isn't attached these methods alter the 4381 frame rectangle without triggering FrameMoved(), FrameResized() or Invalidate(). 4382*/ 4383 4384 4385//! @{ 4386 4387 4388/*! 4389 \fn void BView::MoveBy(float deltaX, float deltaY) 4390 \brief Moves the view \a deltaX pixels horizontally and \a deltaY pixels 4391 vertically in the parent view's coordinate system. 4392 4393 \param deltaX The number of pixels to move the view horizontally. 4394 \param deltaY The number of pixels to move the view vertically. 4395 4396 \since BeOS R3 4397*/ 4398 4399 4400/*! 4401 \fn void BView::MoveTo(BPoint where) 4402 \brief Move the view to the location specified by \a where in the parent 4403 view's coordinate system. 4404 4405 \param where The location to move the view to. 4406 4407 \since BeOS R3 4408*/ 4409 4410 4411/*! 4412 \fn void BView::MoveTo(float x, float y) 4413 \brief Move the view to the coordinates specified by \a x in the horizontal 4414 dimension and \a y in the vertical dimension in the parent view's 4415 coordinate system. 4416 4417 \param x The horizontal coordinate to move the view to. 4418 \param y The vertical coordinate to move the view to. 4419 4420 \since BeOS R3 4421*/ 4422 4423 4424/*! 4425 \fn void BView::ResizeBy(float deltaWidth, float deltaHeight) 4426 \brief Resize the view by \a deltaWidth horizontally and \a deltaHeight 4427 vertically without moving the top left corner of the view. 4428 4429 \param deltaWidth The number of pixels to resize the view by horizontally. 4430 \param deltaHeight The number of pixels to resize the view by vertically. 4431 4432 \since BeOS R3 4433*/ 4434 4435 4436/*! 4437 \fn void BView::ResizeTo(float width, float height) 4438 \brief Resize the view to the specified \a width and \a height. 4439 4440 \param width The width to resize the view to. 4441 \param height The height to resize the view to. 4442 4443 \since BeOS R3 4444*/ 4445 4446 4447/*! 4448 \fn void BView::ResizeTo(BSize size) 4449 \brief Resize the view to the dimension specified by \a size. 4450 4451 \param size The \a size to resize the view to. 4452 4453 \since Haiku R1 4454*/ 4455 4456 4457//! @} 4458 4459 4460/*! 4461 \fn status_t BView::GetSupportedSuites(BMessage* data) 4462 \copydoc BHandler::GetSupportedSuites() 4463*/ 4464 4465 4466/*! 4467 \fn BHandler* BView::ResolveSpecifier(BMessage* message, int32 index, 4468 BMessage* specifier, int32 what, const char* property) 4469 \copydoc BHandler::ResolveSpecifier() 4470*/ 4471 4472 4473/*! 4474 \fn status_t BView::Perform(perform_code code, void* _data) 4475 \brief Perform some action. (Internal Method) 4476 4477 This method is available to allow classes to be extended while maintaining 4478 binary compatibility. 4479 4480 The following perform codes are recognized: 4481 - \c PERFORM_CODE_MIN_SIZE: 4482 - \c PERFORM_CODE_MAX_SIZE: 4483 - \c PERFORM_CODE_PREFERRED_SIZE: 4484 - \c PERFORM_CODE_LAYOUT_ALIGNMENT: 4485 - \c PERFORM_CODE_HAS_HEIGHT_FOR_WIDTH: 4486 - \c PERFORM_CODE_GET_HEIGHT_FOR_WIDTH: 4487 - \c PERFORM_CODE_SET_LAYOUT: 4488 - \c PERFORM_CODE_INVALIDATE_LAYOUT: 4489 - \c PERFORM_CODE_DO_LAYOUT: 4490 - \c PERFORM_CODE_GET_TOOL_TIP_AT: 4491 - \c PERFORM_CODE_ALL_UNARCHIVED: 4492 - \c PERFORM_CODE_ALL_ARCHIVED: 4493 4494 \param code The perform code. 4495 \param _data A pointer to store some data. 4496 4497 \returns A status code. 4498 4499 \since Haiku R1 4500*/ 4501 4502 4503/*! 4504 \name Layouting 4505 4506 \note These methods were not available in BeOS R5. 4507*/ 4508 4509 4510//! @{ 4511 4512 4513/*! 4514 \fn BSize BView::MinSize() 4515 \brief Return the minimum size of the view. 4516 4517 \remark This is only meaningful if the view is part of a BLayout. 4518 4519 \return The minimum size of the view as a BSize. 4520 4521 \sa BAbstractLayout::MinSize() 4522 4523 \since Haiku R1 4524*/ 4525 4526 4527/*! 4528 \fn BSize BView::MaxSize() 4529 \brief Return the maximum size of the view. 4530 4531 \remark This is only meaningful if the view is part of a BLayout. 4532 4533 \return The maximum size of the view as a BSize. 4534 4535 \sa BAbstractLayout::MaxSize() 4536 4537 \since Haiku R1 4538*/ 4539 4540 4541/*! 4542 \fn BSize BView::PreferredSize() 4543 \brief Return the preferred size of the view. 4544 4545 \remark This is only meaningful if the view is part of a BLayout. 4546 4547 \return The preferred size of the view as a BSize. 4548 4549 \sa BAbstractLayout::PreferredSize() 4550 4551 \since Haiku R1 4552*/ 4553 4554 4555/*! 4556 \fn virtual BAlignment BView::LayoutAlignment() 4557 \brief Return the current BAlignemnt of the view. 4558 4559 \remark This is only meaningful if the view is part of a BLayout. 4560 4561 \since Haiku R1 4562*/ 4563 4564 4565/*! 4566 \fn void BView::SetExplicitMinSize(BSize size) 4567 \brief Set this view's min size, to be used by MinSize(). 4568 4569 \remark This is only meaningful if the view is part of a BLayout. 4570 4571 \sa BAbstractLayout::SetExplicitMinSize() 4572 4573 \since Haiku R1 4574*/ 4575 4576 4577/*! 4578 \fn void BView::SetExplicitMaxSize(BSize size) 4579 \brief Set this view's max size, to be used by MaxSize(). 4580 4581 \remark This is only meaningful if the view is part of a BLayout. 4582 4583 \sa BAbstractLayout::SetExplicitMaxSize() 4584 4585 \since Haiku R1 4586*/ 4587 4588 4589/*! 4590 \fn void BView::SetExplicitPreferredSize(BSize size) 4591 \brief Set this view's preferred size, to be used by PreferredSize(). 4592 4593 \remark This is only meaningful if the view is part of a BLayout. 4594 4595 \sa BAbstractLayout::SetExplicitPreferredSize() 4596 4597 \since Haiku R1 4598*/ 4599 4600 4601/*! 4602 \fn void BView::SetExplicitSize(BSize size) 4603 \brief Set this view's size. 4604 4605 \remark This is only meaningful if the view is part of a BLayout. 4606 4607 This is a convenience function that calls both SetExplicitMinSize() 4608 and SetExplicitMaxSize() with the \a size parameter. 4609 4610 \since Haiku R1 4611*/ 4612 4613 4614/*! 4615 \fn void BView::SetExplicitAlignment(BAlignment alignment) 4616 \brief Set this view's alignment, to be used by Alignment(). 4617 4618 \remark This is only meaningful if the view is part of a BLayout. 4619 4620 \sa BAbstractLayout::SetExplicitAlignment() 4621 4622 \since Haiku R1 4623*/ 4624 4625 4626/*! 4627 \fn BSize BView::ExplicitMinSize() const 4628 \brief Returns the explicit minimum size. 4629 4630 \remark This is only meaningful if the view is part of a BLayout. 4631 4632 This returns the value that was set by SetExplicitMinSize(). 4633 4634 \since Haiku R1 4635*/ 4636 4637 4638/*! 4639 \fn BSize BView::ExplicitMaxSize() const 4640 \brief Returns the explicit maximum size. 4641 4642 \remark This is only meaningful if the view is part of a BLayout. 4643 4644 This returns the value that was set by SetExplicitMaxSize(). 4645 4646 \since Haiku R1 4647*/ 4648 4649 4650/*! 4651 \fn BSize BView::ExplicitPreferredSize() const 4652 \brief Returns the explicit preferred size. 4653 4654 \remark This is only meaningful if the view is part of a BLayout. 4655 4656 This returns the value that was set by SetExplicitPreferredSize(). 4657 4658 \since Haiku R1 4659*/ 4660 4661 4662/*! 4663 \fn BSize BView::ExplicitAlignment() const 4664 \brief Returns the explicit alignment size. 4665 4666 \remark This is only meaningful if the view is part of a BLayout. 4667 4668 This returns the value that was set by SetExplicitAlignment(). 4669 4670 \since Haiku R1 4671*/ 4672 4673 4674/*! 4675 \fn bool BView::HasHeightForWidth() 4676 \brief Returns whether the layout of the view can calculate a height for a 4677 given width. 4678 4679 \remark This is only meaningful if the view is part of a BLayout. 4680 4681 Use GetHeightForWidth() to actually get the preferred size. 4682 4683 \returns \c true if the height values can be calculated, \c false if they 4684 cannot. 4685 4686 \since Haiku R1 4687*/ 4688 4689 4690/*! 4691 \fn virtual void BView::GetHeightForWidth(float width, float* min, 4692 float* max, float* preferred) 4693 \brief Returns the min, max and preferred height for a given width. 4694 4695 \remark This is only meaningful if the view is part of a BLayout. 4696 4697 \param[in] width The width you want the height to be calculated for. 4698 \param[out] min The minimum height that the layout will request. 4699 \param[out] max The maximum height that the layout will request. 4700 \param[out] preferred The preferred height for this \a width. 4701 4702 \since Haiku R1 4703*/ 4704 4705 4706/*! 4707 \fn void BView::SetLayout(BLayout* layout) 4708 \brief Sets the \a layout of the view. 4709 4710 \param layout The \a layout to set. 4711 4712 \since Haiku R1 4713*/ 4714 4715 4716/*! 4717 \fn BLayout* BView::GetLayout() const 4718 \brief Get the layout of the view. 4719 4720 \remark This is only meaningful if the view is part of a BLayout. 4721 4722 \returns The layout of the view. 4723 4724 \since Haiku R1 4725*/ 4726 4727 4728/*! 4729 \fn void BView::InvalidateLayout(bool descendants) 4730 \brief Invalidate layout. 4731 4732 \remark This is only meaningful if the view is part of a BLayout. 4733 4734 \param descendants Also invalidate its children views. 4735 4736 \since Haiku R1 4737*/ 4738 4739 4740/*! 4741 \fn void BView::EnableLayoutInvalidation() 4742 \brief Enable layout invalidation. 4743 4744 \remark This is only meaningful if the view is part of a BLayout. 4745 4746 \since Haiku R1 4747*/ 4748 4749 4750/*! 4751 \fn void BView::DisableLayoutInvalidation() 4752 \brief Disable layout invalidation. 4753 4754 \remark This is only meaningful if the view is part of a BLayout. 4755 4756 \since Haiku R1 4757*/ 4758 4759 4760/*! 4761 \fn bool BView::IsLayoutInvalidationDisabled() 4762 \brief Returns whether or not layout invalidation is disabled. 4763 4764 \remark This is only meaningful if the view is part of a BLayout. 4765 4766 \return \c true of layout invalidation is disabled, \c false otherwise. 4767 4768 \since Haiku R1 4769*/ 4770 4771 4772/*! 4773 \fn bool BView::IsLayoutValid() const 4774 \brief Returns whether or not the layout is valid. 4775 4776 \remark This is only meaningful if the view is part of a BLayout. 4777 4778 \returns Returns \c true if the layout is valid, \c false otherwise. 4779 4780 \since Haiku R1 4781*/ 4782 4783 4784/*! 4785 \fn void BView::ResetLayoutInvalidation() 4786 \brief Service call for BView derived classes re-enabling 4787 InvalidateLayout() notifications. 4788 4789 BLayout and BView will avoid calling InvalidateLayout on views that have 4790 already been invalidated, but if the view caches internal layout information 4791 which it updates in methods other than DoLayout(), it has to invoke this 4792 method, when it has done so, since otherwise the information might become 4793 obsolete without the layout noticing. 4794 4795 This is only meaningful if the view is part of a BLayout. 4796 4797 \since Haiku R1 4798*/ 4799 4800 4801/*! 4802 \fn BLayoutContext* BView::LayoutContext() const 4803 \brief Returns the BLayoutContext for this View. 4804 4805 \remark This is only meaningful if the view is part of a BLayout. 4806 4807 \since Haiku R1 4808*/ 4809 4810 4811/*! 4812 \fn void BView::Layout(bool force) 4813 \brief Layout the view. 4814 4815 \remark This is only meaningful if the view is part of a BLayout. 4816 4817 \param force If \c true layout even if valid. 4818 4819 \since Haiku R1 4820*/ 4821 4822 4823/*! 4824 \fn void BView::Relayout() 4825 \brief Relayout the view. 4826 4827 \remark This is only meaningful if the view is part of a BLayout. 4828 4829 \since Haiku R1 4830*/ 4831 4832 4833/*! 4834 \fn void BView::DoLayout() 4835 \brief Layout view within the layout context. 4836 4837 \remark This is only meaningful if the view is part of a BLayout. 4838 4839 \since Haiku R1 4840*/ 4841 4842 4843//! @} 4844 4845 4846/*! 4847 \name Tool Tips 4848 4849 \note These methods were not available in BeOS R5. 4850*/ 4851 4852 4853//! @{ 4854 4855 4856/*! 4857 \fn void BView::SetToolTip(const char* text) 4858 \brief Set the tool tip of the view to \a text. 4859 4860 \param text The \a text to set the view to or \c NULL or blank to unset. 4861 4862 \since Haiku R1 4863*/ 4864 4865 4866/*! 4867 \fn void BView::SetToolTip(BToolTip* tip) 4868 \brief Set the tool tip of the view to the \a tip object. 4869 4870 \param tip The tool tip object to set the view to or \c NULL to unset. 4871 4872 \since Haiku R1 4873*/ 4874 4875 4876/*! 4877 \fn BToolTip* BView::ToolTip() const 4878 \brief Return the tool tip set to the view or \c NULL if not set. 4879 4880 \return The BToolTip object set to the view. 4881 4882 \since Haiku R1 4883*/ 4884 4885 4886/*! 4887 \fn void BView::ShowToolTip(BToolTip* tip) 4888 \brief Show the tool tip at the current mouse position. 4889 4890 \param tip The BToolTip object to show. 4891 4892 \since Haiku R1 4893*/ 4894 4895 4896/*! 4897 \fn void BView::HideToolTip() 4898 \brief Hide the view's tool tip. 4899 4900 \since Haiku R1 4901*/ 4902 4903 4904/*! 4905 \fn bool BView::GetToolTipAt(BPoint point, BToolTip** _tip) 4906 \brief Point \a _tip with the view's tool tip. 4907 4908 \param point Currently unused. 4909 \param _tip A pointer to a pointer to a BToolTip object to set. 4910 4911 \since Haiku R1 4912*/ 4913 4914 4915//! @} 4916