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