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 DrawTiledBitmap() 2710 2711 DrawBitmap() scales the image to fit if the image has different size than 2712 the destination rectangle. 2713 2714 DrawTiledBitmap() fills the destination rectangle with copies of the source 2715 image, without changing its size. 2716 2717 The asynchronous versions pass the image to Application Server and return 2718 immediately. 2719 2720 This can be more efficient in some cases for example to draw several bitmaps 2721 at once and then call Sync() to tell Application Server to wait for them all 2722 to finish drawing rather than waiting for each one to draw. 2723 2724 DrawPicture() 2725 2726 The asynchronous versions pass the picture to Application Server and return 2727 immediately. 2728 2729 This can be more efficient in some cases for example to draw several pictures 2730 at once and then call Sync() to tell Application Server to wait for them all 2731 to finish drawing rather than waiting for each one to draw. 2732 2733 DrawPicture() doesn't alter the graphics state of the view nor do changes to 2734 the graphics state of the view alter the BPicture object. What the picture 2735 will look like depends on the graphics parameters that were in effect when the 2736 picture was recorded. 2737 2738 DrawString() 2739 2740 The \a string is drawn in the view's current font and is modified by 2741 the other parameters of the font such as its direction (left-to-right or 2742 right-to-left), rotation, spacing, shear, etc. The \a string is always drawn 2743 left to right even if its text direction is set to right-to-left mode. 2744 2745 Drawing a string is fastest in \c B_OP_COPY mode and anti-aliasing can 2746 produce undesirable effects when a string is draw in other modes, especially 2747 if the string is drawn in the same location repeatedly. 2748 2749 DrawString() doesn't erase before drawing. 2750*/ 2751 2752 2753//! @{ 2754 2755 2756/*! 2757 \fn void BView::DrawBitmapAsync(const BBitmap* bitmap, BRect bitmapRect, 2758 BRect viewRect, uint32 options) 2759 \brief Draws \a bitmap on the view within \a viewRect asynchronously. 2760 \a bitmap portion is scaled to fit \a viewRect. 2761 2762 \param bitmap The bitmap to draw onto the view. 2763 \param bitmapRect The portion of the bitmap to draw in the bitmap's 2764 coordinate system. 2765 \param viewRect The area in the view's coordinate system to draw the 2766 bitmap in. 2767 \param options combination of \a bitmap_drawing_options flags 2768 2769 \since Haiku R1 2770*/ 2771 2772 2773/*! 2774 \fn void BView::DrawBitmapAsync(const BBitmap* bitmap, BRect bitmapRect, 2775 BRect viewRect) 2776 \brief Draws \a bitmap on the view within \a viewRect asynchronously. 2777 \a bitmap portion is scaled to fit \a viewRect. 2778 2779 \param bitmap The bitmap to draw onto the view. 2780 \param bitmapRect The portion of the bitmap to draw in the bitmap's 2781 coordinate system. 2782 \param viewRect The area in the view's coordinate system to draw the 2783 bitmap in. 2784 2785 \since BeOS R3 2786*/ 2787 2788 2789/*! 2790 \fn void BView::DrawBitmapAsync(const BBitmap* bitmap, BRect viewRect) 2791 \brief Draws \a bitmap on the view within \a viewRect asynchronously. 2792 \a bitmap is scaled to fit \a viewRect. 2793 2794 \param bitmap The bitmap to draw onto the view. 2795 \param viewRect The area in the view's coordinate system to draw the 2796 bitmap in. 2797 2798 \since BeOS R3 2799*/ 2800 2801 2802/*! 2803 \fn void BView::DrawBitmapAsync(const BBitmap* bitmap, BPoint where) 2804 \brief Draws \a bitmap on the view offset by \a where asynchronously. 2805 2806 \param bitmap The bitmap to draw onto the view. 2807 \param where The location to draw the bitmap in the view's coordinate system. 2808 2809 \since BeOS R3 2810*/ 2811 2812 2813/*! 2814 \fn void BView::DrawBitmapAsync(const BBitmap* bitmap) 2815 \brief Draws \a bitmap on the view asynchronously. 2816 2817 \param bitmap The bitmap to draw onto the view. 2818 2819 \since BeOS R3 2820*/ 2821 2822 2823/*! 2824 \fn void BView::DrawBitmap(const BBitmap* bitmap, BRect bitmapRect, 2825 BRect viewRect, uint32 options) 2826 \brief Draws \a bitmap on the view within \a viewRect. \a bitmap portion 2827 is scaled to fit \a viewRect. 2828 2829 \param bitmap The bitmap to draw onto the view. 2830 \param bitmapRect The portion of the bitmap to draw in the bitmap's 2831 coordinate system. 2832 \param viewRect The area in the view's coordinate system to draw the 2833 bitmap in. 2834 \param options ?? 2835 2836 \since Haiku R1 2837*/ 2838 2839 2840/*! 2841 \fn void BView::DrawBitmap(const BBitmap* bitmap, BRect bitmapRect, 2842 BRect viewRect) 2843 \brief Draws \a bitmap on the view within \a viewRect. \a bitmap portion 2844 is scaled to fit \a viewRect. 2845 2846 \param bitmap The bitmap to draw onto the view. 2847 \param bitmapRect The portion of the bitmap to draw in the bitmap's 2848 coordinate system. 2849 \param viewRect The area in the view's coordinate system to draw the 2850 bitmap in. 2851 2852 \since BeOS R3 2853*/ 2854 2855 2856/*! 2857 \fn void BView::DrawBitmap(const BBitmap* bitmap, BRect viewRect) 2858 \brief Draws \a bitmap on the view within \a viewRect. \a bitmap is scaled 2859 to fit \a viewRect. 2860 2861 \param bitmap The bitmap to draw onto the view. 2862 \param viewRect The area in the view's coordinate system to draw the 2863 bitmap in. 2864 2865 \since BeOS R3 2866*/ 2867 2868 2869/*! 2870 \fn void BView::DrawBitmap(const BBitmap* bitmap, BPoint where) 2871 \brief Draws \a bitmap on the view offset by \a where. 2872 2873 \param bitmap The bitmap to draw onto the view. 2874 \param where The location to draw the bitmap in the view's coordinate system. 2875 2876 \since BeOS R3 2877*/ 2878 2879 2880/*! 2881 \fn void BView::DrawBitmap(const BBitmap* bitmap) 2882 \brief Draws \a bitmap on the view. 2883 2884 \param bitmap The bitmap to draw onto the view. 2885 2886 \since BeOS R3 2887*/ 2888 2889 2890/*! 2891 \fn void BView::DrawTiledBitmapAsync(const BBitmap* bitmap, BRect viewRect, 2892 BPoint phase = B_ORIGIN) 2893 \brief Draws \a bitmap on the view within \a viewRect asynchronously. 2894 If \a bitmap is smaller, it is cloned to fill remaining space 2895 in \a viewRect. 2896 2897 \param bitmap The bitmap to draw onto the view. 2898 \param viewRect The area in the view's coordinate system to draw the 2899 bitmap in. 2900 \param phase Source bitmap offset used as starting point for drawing. 2901 2902 \since Haiku R1 2903*/ 2904 2905 2906/*! 2907 \fn void BView::DrawTiledBitmap(const BBitmap* bitmap, BRect viewRect, 2908 BPoint phase = B_ORIGIN) 2909 \brief Draws \a bitmap on the view within \a viewRect. If \a bitmap is 2910 smaller, it is cloned to fill remaining space in \a viewRect. 2911 2912 \param bitmap The bitmap to draw onto the view. 2913 \param viewRect The area in the view's coordinate system to draw the 2914 bitmap in. 2915 \param phase Source bitmap offset used as starting point for drawing. 2916 2917 \since Haiku R1 2918*/ 2919 2920 2921/*! 2922 \fn void BView::DrawChar(char c) 2923 \brief Draws character \a c onto to the view at the current pen position. 2924 2925 The character is drawn in the view's current font. 2926 2927 \param c The character to draw. 2928 2929 \since BeOS R3 2930*/ 2931 2932 2933/*! 2934 \fn void BView::DrawChar(char c, BPoint location) 2935 \brief Draws character \a c at the specified \a location in the view. 2936 2937 The character is drawn in the view's current font. 2938 2939 \param c The character to draw. 2940 \param location The location in the view to draw the character. 2941 2942 \since BeOS R3 2943*/ 2944 2945 2946/*! 2947 \fn void BView::DrawString(const char* string, escapement_delta* delta) 2948 \brief Draw \a string onto the view at the current pen position. 2949 2950 \param string The string to draw. 2951 \param delta Adds additional width to each character according to the 2952 following fields: 2953 - nonspace(float) The amount of width to add to characters with visible 2954 glyphs. 2955 - space(float) The amount of width to add to characters with escapements 2956 but don't have visible glyphs. 2957 2958 \since BeOS R3 2959*/ 2960 2961 2962/*! 2963 \fn void BView::DrawString(const char* string, BPoint location, 2964 escapement_delta* delta) 2965 \brief Draw \a string onto the view at the specified \a location in the view. 2966 2967 \param string The string to draw. 2968 \param location The location in the view to draw the string. 2969 \param delta Adds additional width to each character according to the 2970 following fields: 2971 - nonspace(float) The amount of width to add to characters with visible 2972 glyphs. 2973 - space(float) The amount of width to add to characters with escapements 2974 but don't have visible glyphs. 2975 2976 \since BeOS R3 2977*/ 2978 2979 2980/*! 2981 \fn void BView::DrawString(const char* string, int32 length, 2982 escapement_delta* delta) 2983 \brief Draw \a string up to \a length characters onto the view at the current 2984 pen position. 2985 2986 \param string The string to draw. 2987 \param length The maximum number of characters in \a string to draw. 2988 \param delta Adds additional width to each character according to the 2989 following fields: 2990 - nonspace(float) The amount of width to add to characters with visible 2991 glyphs. 2992 - space(float) The amount of width to add to characters with escapements 2993 but don't have visible glyphs. 2994 2995 \since BeOS R3 2996*/ 2997 2998 2999/*! 3000 \fn void BView::DrawString(const char* string, int32 length, BPoint location, 3001 escapement_delta* delta) 3002 \brief Draw \a string up to \a length characters onto the view at the 3003 specified \a location in the view. 3004 3005 \param string The string to draw. 3006 \param length The maximum number of characters in \a string to draw. 3007 \param location The location in the view to draw the string. 3008 \param delta Adds additional width to each character according to the 3009 following fields: 3010 - nonspace(float) The amount of width to add to characters with visible 3011 glyphs. 3012 - space(float) The amount of width to add to characters with escapements 3013 but don't have visible glyphs. 3014 3015 \since BeOS R3 3016*/ 3017 3018 3019/*! 3020 \fn void BView::DrawString(const char* string, const BPoint* locations, 3021 int32 locationCount) 3022 \brief Draw \a string \a locationCount times at the specified \a locations. 3023 3024 \param string The string to draw. 3025 \param locations A pointer to an array of BPoint objects to draw the string. 3026 \param locationCount The number of elements in \a locations. 3027 3028 \since Haiku R1 3029*/ 3030 3031 3032/*! 3033 \fn void BView::DrawString(const char* string, int32 length, 3034 const BPoint* locations, int32 locationCount) 3035 \brief Draw \a string up to \a length characters \a locationCount times at the 3036 specified \a locations. 3037 3038 \param string The string to draw. 3039 \param length The maximum number of characters in \a string to draw. 3040 \param locations A pointer to an array of BPoint objects to draw the string. 3041 \param locationCount The number of elements in \a locations. 3042 3043 \since Haiku R1 3044*/ 3045 3046 3047/*! 3048 \fn void BView::StrokeEllipse(BPoint center, float xRadius, float yRadius, 3049 ::pattern pattern) 3050 \brief Stroke the outline of an ellipse starting at \a center with a 3051 horizontal radius of \a xRadius and a vertical radius of \a yRadius. 3052 3053 \param center The center point. 3054 \param xRadius The horizontal radius. 3055 \param yRadius The vertical radius. 3056 \param pattern One of the following: 3057 - \c B_SOLID_HIGH 3058 - \c B_SOLID_LOW 3059 - \c B_MIXED_COLORS 3060 3061 \since BeOS R3 3062*/ 3063 3064 3065/*! 3066 \fn void BView::StrokeEllipse(BRect rect, ::pattern pattern) 3067 \brief Stroke the outline of an ellipse inscribed within \a rect. 3068 3069 \param rect The area within which to inscribe the shape. 3070 \param pattern One of the following: 3071 - \c B_SOLID_HIGH 3072 - \c B_SOLID_LOW 3073 - \c B_MIXED_COLORS 3074 3075 \since BeOS R3 3076*/ 3077 3078 3079/*! 3080 \fn void BView::FillEllipse(BPoint center, float xRadius, float yRadius, 3081 ::pattern pattern) 3082 \brief Fill an ellipse starting at \a center with a horizontal radius 3083 of \a xRadius and a vertical radius of \a yRadius. 3084 3085 \param center The center point. 3086 \param xRadius The horizontal radius. 3087 \param yRadius The vertical radius. 3088 \param pattern One of the following: 3089 - \c B_SOLID_HIGH 3090 - \c B_SOLID_LOW 3091 - \c B_MIXED_COLORS 3092 3093 \since BeOS R3 3094*/ 3095 3096 3097/*! 3098 \fn void BView::FillEllipse(BRect rect, ::pattern pattern) 3099 \brief Fill an ellipse inscribed within \a rect. 3100 3101 \param rect The area within which to inscribe the shape. 3102 \param pattern One of the following: 3103 - \c B_SOLID_HIGH 3104 - \c B_SOLID_LOW 3105 - \c B_MIXED_COLORS 3106 3107 \since BeOS R3 3108*/ 3109 3110 3111/*! 3112 \fn void BView::FillEllipse(BPoint center, float xRadius, float yRadius, 3113 const BGradient& gradient) 3114 \brief Fill an ellipse with the specified \a gradient pattern starting at 3115 \a center with a horizontal radius of \a xRadius and a vertical radius 3116 of \a yRadius. 3117 3118 \param center The center point. 3119 \param xRadius The horizontal radius. 3120 \param yRadius The vertical radius. 3121 \param gradient The gradient pattern to fill the ellipse with. 3122 3123 \since Haiku R1 3124*/ 3125 3126 3127/*! 3128 \fn void BView::FillEllipse(BRect rect, const BGradient& gradient) 3129 \brief Fill an ellipse with the specified \a gradient pattern inscribed within 3130 \a rect. 3131 3132 \param rect The area within which to inscribe the shape. 3133 \param gradient The gradient pattern to fill the ellipse with. 3134 3135 \since Haiku R1 3136*/ 3137 3138 3139/*! 3140 \fn void BView::StrokeArc(BPoint center, float xRadius, float yRadius, 3141 float startAngle, float arcAngle, ::pattern pattern) 3142 \brief Stroke the outline of an arc starting at \a center with a 3143 horizontal radius of \a xRadius and a vertical radius of \a yRadius 3144 starting at \a startAngle and drawing \a arcAngle degrees. 3145 3146 \param center The center point. 3147 \param xRadius The horizontal radius. 3148 \param yRadius The vertical radius. 3149 \param startAngle The angle to begin drawing at. 3150 \param arcAngle The number of degrees of the arc to draw. 3151 \param pattern One of the following: 3152 - \c B_SOLID_HIGH 3153 - \c B_SOLID_LOW 3154 - \c B_MIXED_COLORS 3155 3156 \since BeOS R3 3157*/ 3158 3159 3160/*! 3161 \fn void BView::StrokeArc(BRect rect, float startAngle, float arcAngle, 3162 ::pattern pattern) 3163 \brief Stroke the outline of an arc inscribed within \a rect starting at 3164 \a startAngle and drawing \a arcAngle degrees. 3165 3166 \param rect The area within which to inscribe the shape. 3167 \param startAngle The angle to begin drawing at. 3168 \param arcAngle The number of degrees of the arc to draw. 3169 \param pattern One of the following: 3170 - \c B_SOLID_HIGH 3171 - \c B_SOLID_LOW 3172 - \c B_MIXED_COLORS 3173 3174 \since BeOS R3 3175*/ 3176 3177 3178/*! 3179 \fn void BView::FillArc(BPoint center, float xRadius, float yRadius, 3180 float startAngle, float arcAngle, ::pattern pattern) 3181 \brief Fill an arc starting at \a center with a horizontal radius of 3182 \a xRadius and a vertical radius of \a yRadius starting at 3183 \a startAngle and drawing \a arcAngle degrees. 3184 3185 \param center The center point. 3186 \param xRadius The horizontal radius. 3187 \param yRadius The vertical radius. 3188 \param startAngle The angle to begin drawing at. 3189 \param arcAngle The number of degrees of the arc to draw. 3190 \param pattern One of the following: 3191 - \c B_SOLID_HIGH 3192 - \c B_SOLID_LOW 3193 - \c B_MIXED_COLORS 3194 3195 \since BeOS R3 3196*/ 3197 3198 3199/*! 3200 \fn void BView::FillArc(BPoint center, float xRadius, float yRadius, 3201 float startAngle, float arcAngle, const BGradient& gradient) 3202 \brief Fill an arc with the specified \a gradient pattern starting at 3203 \a center with a horizontal radius of \a xRadius and a vertical 3204 radius of \a yRadius starting at \a startAngle and drawing 3205 \a arcAngle degrees. 3206 3207 \param center The center point. 3208 \param xRadius The horizontal radius. 3209 \param yRadius The vertical radius. 3210 \param startAngle The angle to begin drawing at. 3211 \param arcAngle The number of degrees of the arc to draw. 3212 \param gradient The gradient pattern to fill the arc with. 3213 3214 \since Haiku R1 3215*/ 3216 3217 3218/*! 3219 \fn void BView::FillArc(BRect rect, float startAngle, float arcAngle, 3220 ::pattern pattern) 3221 \brief Fill an arc inscribed within \a rect starting at startAngle and 3222 drawing \a arcAngle degrees. 3223 3224 \param rect The area within which to inscribe the shape. 3225 \param startAngle The angle to begin drawing at. 3226 \param arcAngle The number of degrees of the arc to draw. 3227 \param pattern One of the following: 3228 - \c B_SOLID_HIGH 3229 - \c B_SOLID_LOW 3230 - \c B_MIXED_COLORS 3231 3232 \since BeOS R3 3233*/ 3234 3235 3236/*! 3237 \fn void BView::FillArc(BRect rect, float startAngle, float arcAngle, 3238 const BGradient& gradient) 3239 \brief Fill an arc with the specified \a gradient pattern inscribed within 3240 \a rect starting at startAngle and drawing \a arcAngle degrees. 3241 3242 \param rect The area within which to inscribe the shape. 3243 \param startAngle The angle to begin drawing at. 3244 \param arcAngle The number of degrees of the arc to draw. 3245 \param gradient The gradient pattern to fill the arc with. 3246 3247 \since Haiku R1 3248*/ 3249 3250 3251/*! 3252 \fn void BView::StrokeBezier(BPoint* controlPoints, ::pattern pattern) 3253 \brief Stroke a bezier curve. 3254 3255 \param controlPoints The list of points that form the bezier curve. 3256 \param pattern One of the following: 3257 - \c B_SOLID_HIGH 3258 - \c B_SOLID_LOW 3259 - \c B_MIXED_COLORS 3260 3261 \since BeOS R3 3262*/ 3263 3264 3265/*! 3266 \fn void BView::FillBezier(BPoint* controlPoints, ::pattern pattern) 3267 \brief Fill a bezier curve. 3268 3269 \param controlPoints The list of points that form the bezier curve. 3270 \param pattern One of the following: 3271 - \c B_SOLID_HIGH 3272 - \c B_SOLID_LOW 3273 - \c B_MIXED_COLORS 3274 3275 \since BeOS R3 3276*/ 3277 3278 3279/*! 3280 \fn void BView::FillBezier(BPoint* controlPoints, const BGradient& gradient) 3281 3282 \brief Fill a bezier curve. 3283 3284 \param controlPoints The list of points that form the bezier curve. 3285 \param gradient The gradient pattern to fill the bezier curve with. 3286 3287 \since Haiku R1 3288*/ 3289 3290 3291/*! 3292 \fn void BView::StrokePolygon(const BPolygon* polygon, bool closed, 3293 ::pattern pattern) 3294 \brief Stroke a polygon shape. 3295 3296 \param polygon The polygon shape to stroke. 3297 \param closed Whether or not the last line of the polygon should intersect 3298 with the initial point. 3299 \param pattern One of the following: 3300 - \c B_SOLID_HIGH 3301 - \c B_SOLID_LOW 3302 - \c B_MIXED_COLORS 3303 3304 \since BeOS R3 3305*/ 3306 3307 3308/*! 3309 \fn void BView::StrokePolygon(const BPoint* pointArray, int32 numPoints, 3310 bool closed, ::pattern pattern) 3311 \brief Stroke a polygon shape made up of points specified by \a pointArray. 3312 3313 \param pointArray An array of points that specify the vertices of the 3314 polygon. 3315 \param numPoints The number of points in \a pointArray. 3316 \param closed Whether or not the last line of the polygon should intersect 3317 with the initial point. 3318 \param pattern One of the following: 3319 - \c B_SOLID_HIGH 3320 - \c B_SOLID_LOW 3321 - \c B_MIXED_COLORS 3322 3323 \since BeOS R3 3324*/ 3325 3326 3327/*! 3328 \fn void BView::StrokePolygon(const BPoint* pointArray, int32 numPoints, 3329 BRect bounds, bool closed, ::pattern pattern) 3330 \brief Stroke a polygon shape made up of points specified by \a pointArray 3331 inscribed by \a bounds. 3332 3333 \param pointArray An array of points that specify the vertices of the 3334 polygon. 3335 \param numPoints The number of points in \a pointArray. 3336 \param bounds The smallest rectangle that encloses the points in 3337 \a pointArray. 3338 \param closed Whether or not the last line of the polygon should intersect 3339 with the initial point. 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 BPolygon* polygon, ::pattern pattern) 3351 \brief Fill a polygon shape. 3352 3353 \param polygon The polygon shape to fill. 3354 \param pattern One of the following: 3355 - \c B_SOLID_HIGH 3356 - \c B_SOLID_LOW 3357 - \c B_MIXED_COLORS 3358 3359 \since BeOS R3 3360*/ 3361 3362 3363/*! 3364 \fn void BView::FillPolygon(const BPolygon* polygon, 3365 const BGradient& gradient) 3366 \brief Fill a polygon shape with the specified \a gradient pattern. 3367 3368 \param polygon The polygon shape to fill. 3369 \param gradient The gradient pattern to fill the polygon with. 3370 3371 \since Haiku R1 3372*/ 3373 3374 3375/*! 3376 \fn void BView::FillPolygon(const BPoint* pointArray, int32 numPoints, 3377 ::pattern pattern) 3378 \brief Fill a polygon shape made up of points specified by \a pointArray. 3379 3380 \param pointArray An array of points that specify the vertices of the polygon. 3381 \param numPoints The number of points in \a pointArray. 3382 \param pattern One of the following: 3383 - \c B_SOLID_HIGH 3384 - \c B_SOLID_LOW 3385 - \c B_MIXED_COLORS 3386 3387 \since BeOS R3 3388*/ 3389 3390 3391/*! 3392 \fn void BView::FillPolygon(const BPoint* pointArray, int32 numPoints, 3393 const BGradient& gradient) 3394 \brief Fill a polygon shape made up of points specified by \a pointArray 3395 with the specified \a gradient pattern. 3396 3397 \param pointArray An array of points that specify the vertices of the 3398 polygon. 3399 \param numPoints The number of points in \a pointArray. 3400 \param gradient The gradient pattern to fill the polygon with. 3401 3402 \since Haiku R1 3403*/ 3404 3405 3406/*! 3407 \fn void BView::FillPolygon(const BPoint* pointArray, int32 numPoints, 3408 BRect bounds, ::pattern pattern) 3409 \brief Fill a polygon shape made up of points specified by \a pointArray 3410 inscribed by \a bounds. 3411 3412 \param pointArray An array of points that specify the vertices of the 3413 polygon. 3414 \param numPoints The number of points in \a pointArray. 3415 \param bounds The smallest rectangle that encloses the points in 3416 \a pointArray. 3417 \param pattern One of the following: 3418 - \c B_SOLID_HIGH 3419 - \c B_SOLID_LOW 3420 - \c B_MIXED_COLORS 3421 3422 \since BeOS R3 3423*/ 3424 3425 3426/*! 3427 \fn void BView::FillPolygon(const BPoint* pointArray, int32 numPoints, 3428 BRect bounds, const BGradient& gradient) 3429 \brief Fill a polygon shape made up of points specified by \a pointArray 3430 inscribed by \a bounds with the specified \a gradient pattern. 3431 3432 \param pointArray An array of points that specify the vertices of the 3433 polygon. 3434 \param numPoints The number of points in \a pointArray. 3435 \param bounds The smallest rectangle that encloses the points in 3436 \a pointArray. 3437 \param gradient The gradient pattern to fill the polygon with. 3438 3439 \since Haiku R1 3440*/ 3441 3442 3443/*! 3444 \fn void BView::StrokeRect(BRect rect, ::pattern pattern) 3445 \brief Stroke the rectangle specified by \a rect. 3446 3447 \param rect The rectangular area to stroke. 3448 \param pattern One of the following: 3449 - \c B_SOLID_HIGH 3450 - \c B_SOLID_LOW 3451 - \c B_MIXED_COLORS 3452 3453 \since BeOS R3 3454*/ 3455 3456 3457/*! 3458 \fn void BView::FillRect(BRect rect, ::pattern pattern) 3459 \brief Fill the rectangle specified by \a rect. 3460 3461 \param rect The rectangular area to fill. 3462 \param pattern One of the following: 3463 - \c B_SOLID_HIGH 3464 - \c B_SOLID_LOW 3465 - \c B_MIXED_COLORS 3466 3467 \since BeOS R3 3468*/ 3469 3470 3471/*! 3472 \fn void BView::FillRect(BRect rect, const BGradient& gradient) 3473 \brief Fill the rectangle specified by \a rect with the specified 3474 \a gradient pattern. 3475 3476 \param rect The rectangular area to fill. 3477 \param gradient The gradient pattern to fill the rectangle with. 3478 3479 \since Haiku R1 3480*/ 3481 3482 3483/*! 3484 \fn void BView::StrokeRoundRect(BRect rect, float xRadius, float yRadius, 3485 ::pattern pattern) 3486 \brief Stroke the rounded rectangle with horizontal radius \a xRadius and 3487 vertical radius \a yRadius. 3488 3489 \param rect The rectangular area to stroke the round rect within. 3490 \param xRadius The horizontal radius. 3491 \param yRadius The vertical radius. 3492 \param pattern One of the following: 3493 - \c B_SOLID_HIGH 3494 - \c B_SOLID_LOW 3495 - \c B_MIXED_COLORS 3496 3497 \since BeOS R3 3498*/ 3499 3500 3501/*! 3502 \fn void BView::FillRoundRect(BRect rect, float xRadius, float yRadius, 3503 ::pattern pattern) 3504 \brief Fill the rounded rectangle with horizontal radius \a xRadius and 3505 vertical radius \a yRadius. 3506 3507 \param rect The rectangular area to fill the round rect within. 3508 \param xRadius The horizontal radius. 3509 \param yRadius The vertical radius. 3510 \param pattern One of the following: 3511 - \c B_SOLID_HIGH 3512 - \c B_SOLID_LOW 3513 - \c B_MIXED_COLORS 3514 3515 \since BeOS R3 3516*/ 3517 3518 3519/*! 3520 \fn void BView::FillRoundRect(BRect rect, float xRadius, float yRadius, 3521 const BGradient& gradient) 3522 \brief Fill the rounded rectangle with horizontal radius \a xRadius and 3523 vertical radius \a yRadius with the specified \a gradient pattern. 3524 3525 \param rect The rectangular area to fill the round rect within. 3526 \param xRadius The horizontal radius. 3527 \param yRadius The vertical radius. 3528 \param gradient The gradient pattern to fill the round rect with. 3529 3530 \since Haiku R1 3531*/ 3532 3533 3534/*! 3535 \fn void BView::FillRegion(BRegion* region, ::pattern pattern) 3536 \brief Fill \a region. 3537 3538 \param region The \a region to fill. 3539 \param pattern One of the following: 3540 - \c B_SOLID_HIGH 3541 - \c B_SOLID_LOW 3542 - \c B_MIXED_COLORS 3543 3544 \since BeOS R3 3545*/ 3546 3547 3548/*! 3549 \fn void BView::FillRegion(BRegion* region, const BGradient& gradient) 3550 \brief Fill \a region with the specified \a gradient pattern. 3551 3552 \param region The \a region to fill. 3553 \param gradient The gradient pattern to fill the \a region with. 3554 3555 \since Haiku R1 3556*/ 3557 3558 3559/*! 3560 \fn void BView::StrokeTriangle(BPoint point1, BPoint point2, BPoint point3, 3561 BRect bounds, ::pattern pattern) 3562 \brief Stroke the triangle specified by points \a point1, \a point2, and 3563 \a point3 and enclosed by \a bounds. 3564 3565 \param point1 The first point of the triangle. 3566 \param point2 The second point of the triangle. 3567 \param point3 The third point of the triangle. 3568 \param bounds The rectangular area that encloses the triangle. 3569 \param pattern One of the following: 3570 - \c B_SOLID_HIGH 3571 - \c B_SOLID_LOW 3572 - \c B_MIXED_COLORS 3573 3574 \since BeOS R3 3575*/ 3576 3577 3578/*! 3579 \fn void BView::StrokeTriangle(BPoint point1, BPoint point2, BPoint point3, 3580 ::pattern pattern) 3581 \brief Stroke the triangle specified by points \a point1, \a point2, 3582 and \a point3. 3583 3584 \param point1 The first point of the triangle. 3585 \param point2 The second point of the triangle. 3586 \param point3 The third point of the triangle. 3587 \param pattern One of the following: 3588 - \c B_SOLID_HIGH 3589 - \c B_SOLID_LOW 3590 - \c B_MIXED_COLORS 3591 3592 \since BeOS R3 3593*/ 3594 3595 3596/*! 3597 \fn void BView::FillTriangle(BPoint point1, BPoint point2, BPoint point3, 3598 ::pattern pattern) 3599 \brief Fill the triangle specified by points \a point1, \a point2, 3600 and \a point3. 3601 3602 \param point1 The first point of the triangle. 3603 \param point2 The second point of the triangle. 3604 \param point3 The third point of the triangle. 3605 \param pattern One of the following: 3606 - \c B_SOLID_HIGH 3607 - \c B_SOLID_LOW 3608 - \c B_MIXED_COLORS 3609 3610 \since BeOS R3 3611*/ 3612 3613 3614/*! 3615 \fn void BView::FillTriangle(BPoint point1, BPoint point2, BPoint point3, 3616 const BGradient& gradient) 3617 \brief Fill the triangle specified by points \a point1, \a point2, 3618 and \a point3 with the specified \a gradient pattern. 3619 3620 \param point1 The first point of the triangle. 3621 \param point2 The second point of the triangle. 3622 \param point3 The third point of the triangle. 3623 \param gradient The gradient pattern to fill the triangle with. 3624 3625 \since Haiku R1 3626*/ 3627 3628 3629/*! 3630 \fn void BView::FillTriangle(BPoint point1, BPoint point2, BPoint point3, 3631 BRect bounds, ::pattern pattern) 3632 \brief Fill the triangle specified by points \a point1, \a point2, 3633 and \a point3 and enclosed by \a bounds. 3634 3635 \param point1 The first point of the triangle. 3636 \param point2 The second point of the triangle. 3637 \param point3 The third point of the triangle. 3638 \param bounds The rectangular area that encloses the triangle. 3639 \param pattern One of the following: 3640 - \c B_SOLID_HIGH 3641 - \c B_SOLID_LOW 3642 - \c B_MIXED_COLORS 3643 3644 \since BeOS R3 3645*/ 3646 3647 3648/*! 3649 \fn void BView::FillTriangle(BPoint point1, BPoint point2, BPoint point3, 3650 BRect bounds, const BGradient& gradient) 3651 \brief Fill the triangle specified by points \a point1, \a point2, 3652 and \a point3 and enclosed by \a bounds with the specified 3653 \a gradient pattern. 3654 3655 \param point1 The first point of the triangle. 3656 \param point2 The second point of the triangle. 3657 \param point3 The third point of the triangle. 3658 \param bounds The rectangular area that encloses the triangle. 3659 \param gradient The gradient pattern to fill the triangle with. 3660 3661 \since Haiku R1 3662*/ 3663 3664 3665/*! 3666 \fn void BView::StrokeLine(BPoint toPoint, ::pattern pattern) 3667 \brief Stroke a line from the current pen location to the point \a toPoint. 3668 3669 \param toPoint The end point of the line. 3670 \param pattern One of the following: 3671 - \c B_SOLID_HIGH 3672 - \c B_SOLID_LOW 3673 - \c B_MIXED_COLORS 3674 3675 \since BeOS R3 3676*/ 3677 3678 3679/*! 3680 \fn void BView::StrokeLine(BPoint start, BPoint end, ::pattern pattern) 3681 \brief Stroke a line from point \a start to point \a end. 3682 3683 \param start The start point of the line. 3684 \param end The end point of the line. 3685 \param pattern One of the following: 3686 - \c B_SOLID_HIGH 3687 - \c B_SOLID_LOW 3688 - \c B_MIXED_COLORS 3689 3690 \since BeOS R3 3691*/ 3692 3693 3694/*! 3695 \fn void BView::StrokeShape(BShape* shape, ::pattern pattern) 3696 \brief Stroke \a shape. 3697 3698 \param shape The \a shape to stroke. 3699 \param pattern One of the following: 3700 - \c B_SOLID_HIGH 3701 - \c B_SOLID_LOW 3702 - \c B_MIXED_COLORS 3703 3704 \since BeOS R5 3705*/ 3706 3707 3708/*! 3709 \fn void BView::FillShape(BShape* shape, ::pattern pattern) 3710 \brief Fill \a shape. 3711 3712 \param shape The \a shape to fill. 3713 \param pattern One of the following: 3714 - \c B_SOLID_HIGH 3715 - \c B_SOLID_LOW 3716 - \c B_MIXED_COLORS 3717 3718 \since BeOS R5 3719*/ 3720 3721 3722/*! 3723 \fn void BView::FillShape(BShape* shape, const BGradient& gradient) 3724 \brief Fill \a shape with the specified \a gradient pattern. 3725 3726 \param shape The \a shape to fill. 3727 \param gradient The gradient pattern to fill the \a shape with. 3728 3729 \since Haiku R1 3730*/ 3731 3732 3733/*! 3734 \fn void BView::BeginLineArray(int32 count) 3735 \brief Begin a line array of up to \a count lines. 3736 3737 This is a more efficient way of drawing a large number of lines than calling 3738 StrokeLine() repeatedly. First call BeginLineArray() to begin drawing lines, 3739 then call AddLine() for each line you wish to draw, and finally call 3740 EndLineArray() to finish the line array and draw the lines. 3741 3742 These methods don't move the current pen location or change the high or low 3743 colors of the view. \a count should be close to the number of lines you wish 3744 to draw and should be below 256 to draw efficiently. 3745 3746 \param count The maximum number of lines in the line array to draw. 3747 3748 \see StrokeLine() 3749 3750 \since BeOS R3 3751*/ 3752 3753 3754/*! 3755 \fn void BView::AddLine(BPoint start, BPoint end, rgb_color color); 3756 \brief Add a line to the line array drawn from \a start to \a end. 3757 3758 \param start The \a start point of the line. 3759 \param end The \a end point of the line. 3760 \param color The \a color to draw the line. 3761 3762 \since BeOS R3 3763*/ 3764 3765 3766/*! 3767 \fn void BView::EndLineArray() 3768 \brief End the line array drawing the lines. 3769 3770 \since BeOS R3 3771*/ 3772 3773 3774/*! 3775 \fn void BView::SetDiskMode(char* filename, long offset) 3776 \brief Unimplemented. 3777 3778 \since Haiku R1 3779*/ 3780 3781 3782/*! 3783 \fn void BView::BeginPicture(BPicture* picture) 3784 \brief Begins sending drawing instructions to \a picture. 3785 3786 The \a BPicture object is cleared and any successive drawing instructions sent 3787 to the view are redirected to \a picture until EndPicture() is called. To 3788 append drawing instructions to a BPicture object without clearing it first 3789 call AppendToPicture() instead. 3790 3791 The view doesn't display anything to the screen while it's recording to \a 3792 picture. Use the DrawPicture() method to render the \a picture. 3793 3794 Only drawing instructions performed directly on the view, not its child views 3795 are send to the BPicture object and BPicture captures only primitive graphics 3796 operations. The view must be attached to a window for the drawing instruction 3797 to be recorded. Drawing instructions are recorded even if the view is hidden or 3798 resides outside the clipping region or the window is off-screen. 3799 3800 \param picture The BPicture object to record drawing instructions to. 3801 3802 \since BeOS R3 3803*/ 3804 3805 3806/*! 3807 \fn void BView::AppendToPicture(BPicture* picture) 3808 \brief Appends drawing instructions to \a picture without clearing it first. 3809 3810 \param picture The BPicture object to record drawing instructions to. 3811 3812 \since BeOS R3 3813*/ 3814 3815 3816/*! 3817 \fn BPicture* BView::EndPicture() 3818 \brief Ends the drawing instruction recording session and returns the 3819 BPicture object passed to BeginPicture() or AppendToPicture(). 3820 3821 \return The BPicture object passed to BeginPicture() or AppendToPicture(). 3822 3823 \since BeOS R3 3824*/ 3825 3826 3827/*! 3828 \fn void BView::SetViewBitmap(const BBitmap* bitmap, BRect srcRect, 3829 BRect dstRect, uint32 followFlags, uint32 options) 3830 \brief Sets the background \a bitmap of the view. 3831 3832 All drawing to the view occurs over \a bitmap. Any visible regions not 3833 covered by \a bitmap are filled with the current background color. 3834 3835 Once \a bitmap has been passed in and this method returns the caller may 3836 safely delete the object. 3837 3838 \param bitmap The background bitmap to set to the view. 3839 \param srcRect Specifies the area of \a bitmap to use. 3840 \param dstRect Specifies the area of the view to set \a bitmap to. 3841 \param followFlags Specifies the as the view is resized. See the BView 3842 constructor for more details. 3843 \param options Specifies additional view options. The only option currently 3844 available is \c B_TILE_BITMAP which tiles the bitmap across the view. 3845 3846 \since BeOS R4 3847*/ 3848 3849 3850/*! 3851 \fn void BView::SetViewBitmap(const BBitmap* bitmap, uint32 followFlags, 3852 uint32 options) 3853 \brief Sets the background \a bitmap of the view. 3854 3855 All drawing to the view occurs over \a bitmap. Any visible regions not 3856 covered by \a bitmap are filled with the current background color. 3857 3858 Once \a bitmap has been passed in and this method returns the caller may 3859 safely delete the object. 3860 3861 \param bitmap The background bitmap to set to the view. 3862 \param followFlags Specifies the as the view is resized. See the BView 3863 constructor for more details. 3864 \param options Specifies additional view options. The only option currently 3865 available is \c B_TILE_BITMAP which tiles the bitmap across the view. 3866 3867 \since BeOS R4 3868*/ 3869 3870 3871/*! 3872 \fn void BView::ClearViewBitmap() 3873 \brief Clears the background bitmap of the view if it has one. 3874 3875 \since BeOS R4 3876*/ 3877 3878 3879/*! 3880 \fn status_t BView::SetViewOverlay(const BBitmap* overlay, BRect srcRect, 3881 BRect dstRect, rgb_color* colorKey, uint32 followFlags, uint32 options) 3882 \brief Sets the \a overlay bitmap of the view. 3883 3884 \a colorKey specifies which color pixels in \a overlay are treated as transparent 3885 allowing the pixels of the view to show through. 3886 3887 Once \a overlay has been passed in and this method returns the caller may 3888 safely delete the object. 3889 3890 \param overlay The overlay bitmap to set to the view. 3891 \param srcRect Specifies the area of \a overlay to use. 3892 \param dstRect Specifies the area of the view to set \a overlay to. 3893 \param colorKey The color in \a overlay to treat as transparent. 3894 \param followFlags Specifies the as the view is resized. See the BView 3895 constructor for more details. 3896 \param options Specifies additional view options. The only option currently 3897 available is \c B_TILE_BITMAP which tiles the bitmap across the view. 3898 3899 \since BeOS R5 3900*/ 3901 3902 3903/*! 3904 \fn status_t BView::SetViewOverlay(const BBitmap* overlay, 3905 rgb_color* colorKey, uint32 followFlags, uint32 options) 3906 \brief Sets the \a overlay bitmap of the view. 3907 3908 \a colorKey specifies which color pixels in \a overlay are treated as transparent 3909 allowing the pixels of the view to show through. 3910 3911 Once \a overlay has been passed in and this method returns the caller may 3912 safely delete the object. 3913 3914 \param overlay The overlay bitmap to set to the view. 3915 \param colorKey The color in \a overlay to treat as transparent. 3916 \param followFlags Specifies the as the view is resized. See the BView 3917 constructor for more details. 3918 \param options Specifies additional view options. The only option currently 3919 available is \c B_TILE_BITMAP which tiles the bitmap across the view. 3920 3921 \since BeOS R5 3922*/ 3923 3924 3925/*! 3926 \fn void BView::ClearViewOverlay() 3927 \brief Clears the overlay bitmap of the view if it has one. 3928 3929 \since BeOS R5 3930*/ 3931 3932 3933/*! 3934 \fn void BView::CopyBits(BRect src, BRect dst) 3935 \brief Copy the bits from the \a src rectangle to the \a dst rectangle in the 3936 view's coordinate system. 3937 3938 If the rectangles are of different sizes than \a src is scaled to fit. \a src 3939 is clipped if a part of \a dst lies outside of the visible region of the view. 3940 Only the visible portions of \a src are copied. 3941 3942 The view must be attached to a window for this method to work. 3943 3944 \param src The source rectangle to copy bits from. 3945 \param dst The destination rectangle to copy bits to. 3946 3947 \since BeOS R3 3948*/ 3949 3950 3951/*! 3952 \fn void BView::DrawPicture(const BPicture* picture) 3953 \brief Draws the \a picture at the view's current pen position. 3954 3955 \param picture The BPicture object to draw. 3956 3957 \since BeOS R3 3958*/ 3959 3960 3961/*! 3962 \fn void BView::DrawPicture(const BPicture* picture, BPoint where) 3963 \brief Draws the \a picture at the location in the view specified by \a where. 3964 3965 \param picture The BPicture object to draw. 3966 \param where The point on the view to draw \a picture. 3967 3968 \since BeOS R3 3969*/ 3970 3971 3972/*! 3973 \fn void BView::DrawPicture(const char* filename, long offset, BPoint where) 3974 \brief Draws the \a picture from the file specified by \a filename offset by 3975 \a offset bytes at the location in the view specified by \a where. 3976 3977 \param filename The filename of the file containing the picture to draw. 3978 \param where The point on the view to draw the picture. 3979 \param offset The number of bytes to offset in the file to find the picture. 3980 3981 \since BeOS R4 3982*/ 3983 3984 3985/*! 3986 \fn void BView::DrawPictureAsync(const BPicture* picture) 3987 \brief Draws the \a picture at the view's current pen position. 3988 3989 \param picture The BPicture object to draw. 3990 3991 \since BeOS R5 3992*/ 3993 3994 3995/*! 3996 \fn void BView::DrawPictureAsync(const BPicture* picture, BPoint where) 3997 \brief Draws the \a picture at the location in the view specified by 3998 \a where. 3999 4000 \param picture The BPicture object to draw. 4001 \param where The point on the view to draw \a picture. 4002 4003 \since BeOS R5 4004*/ 4005 4006 4007/*! 4008 \fn void BView::DrawPictureAsync(const char* filename, long offset, 4009 BPoint where) 4010 \brief Draws the \a picture from the file specified by \a filename offset 4011 by \a offset bytes at the location in the view specified by 4012 \a where. 4013 4014 \param filename The filename of the file containing the picture to draw. 4015 \param where The point on the view to draw the picture. 4016 \param offset The number of bytes to offset in the file to find the 4017 picture. 4018 4019 \since BeOS R5 4020*/ 4021 4022 4023/*! 4024 \fn void BView::BeginLayer(uint8 opacity) 4025 \brief Begins a drawing layer. 4026 4027 This feature of BView allows you to create a separate layer, draw on it, 4028 and blend it in with the rest of the view with a given \a opacity. 4029 Internally, the method creates a new drawing buffer, that you can draw on 4030 using the methods of BView. After finishing your layer, you call EndLayer() 4031 to apply the \a opacity to the layer, and blend it in with the existing 4032 drawing. 4033 4034 You can nest layers, meaning you can call this method while drawing a 4035 layer, to create a sublayer. The layers are mixed and blended in order. 4036 4037 This work was done to support drawing for WebKit. 4038 4039 \sa EndLayer() 4040 4041 \since Haiku R1 4042*/ 4043 4044 4045/*! 4046 \fn void BView::EndLayer() 4047 \brief Finish a layer and blend it in with the view. 4048 4049 This is the counterpart to BeginLayer(). You can nest multiple layer. If 4050 this method is called and the current layer is nested in another layer, the 4051 current layer is applied to the layer above. If this is the only layer, it 4052 will directly blend in to the main view. 4053 4054 \sa BeginLayer() 4055 4056 \since Haiku R` 4057*/ 4058 4059 4060/*! 4061 \fn void BView::Invalidate(BRect invalRect) 4062 \brief Sends a message to App Server to redraw the portion of the view 4063 specified by \a invalRect. 4064 4065 \param invalRect The rectangular area of the view to redraw. 4066 4067 \since BeOS R3 4068*/ 4069 4070 4071/*! 4072 \fn void BView::Invalidate(const BRegion* region) 4073 \brief Sends a message to App Server to redraw the portion of the view 4074 specified by \a region. 4075 4076 \param region The region of the view to redraw. 4077 4078 \since Haiku R1 4079*/ 4080 4081 4082/*! 4083 \fn void BView::Invalidate() 4084 \brief Sends a message to App Server to redraw the view. 4085 4086 \since BeOS R3 4087*/ 4088 4089 4090/*! 4091 \fn void BView::DelayedInvalidate(bigtime_t delay) 4092 \brief Sends a message to App Server to redraw the entire view after 4093 a certain, minimum, delay. Repeated calls to this method may be 4094 merged, but the view is guaranteed to be redrawn after the delay 4095 given in the first call of this method. 4096 4097 \param delay The time, in microseconds, to wait until redrawing the view. 4098 4099 \since Haiku R1 4100*/ 4101 4102 4103/*! 4104 \fn void BView::DelayedInvalidate(bigtime_t delay, BRect invalRect) 4105 \brief Sends a message to App Server to redraw the portion of the view 4106 specified by \a invalRect after a certain, minimum, delay. 4107 Repeated calls to this method may be merged, but the invalidated 4108 rect is guaranteed to be redrawn after the minimum delay given 4109 by the first call of this method. 4110 4111 \param delay The time, in microseconds, to wait until redrawing the view. 4112 \param invalRect The rectangular area of the view to redraw. 4113 4114 \since Haiku R1 4115*/ 4116 4117 4118/*! 4119 \fn void BView::InvertRect(BRect rect) 4120 \brief Inverts the colors within \a rect. 4121 4122 This method is often used to draw a highlighted selection in a view. 4123 4124 \param rect The rectangular area in the view to invert the colors of. 4125 4126 \since BeOS R3 4127*/ 4128 4129 4130//! @} 4131 4132 4133/*! 4134 \name View Hierarchy 4135*/ 4136 4137 4138//! @{ 4139 4140 4141/*! 4142 \fn void BView::AddChild(BView* child, BView* before) 4143 \brief Adds \a child to the view hierarchy immediately before \a before. 4144 4145 A view may only have one parent at a time so \a child must not have already 4146 been added to the view hierarchy. If \a before is \c NULL then \a child is added 4147 to the end of the tree. If the view is attached to a window \a child and all 4148 of its descendent views also become attached to the window invoking an 4149 AttachedToWindow() method on each view. 4150 4151 \param child The child view to add. 4152 \param before The sibling view to add \a child before. 4153 4154 \since BeOS R3 4155*/ 4156 4157 4158/*! 4159 \fn bool BView::AddChild(BLayoutItem* child) 4160 \brief Add the \a child layout item to the view hierarchy. 4161 4162 \param child The child layout item to add. 4163 \return Whether or not \a child was added to the view layout hierarchy. 4164 4165 \since Haiku R1 4166*/ 4167 4168 4169/*! 4170 \fn bool BView::RemoveChild(BView* child) 4171 \brief Removes \a child from the view hierarchy. 4172 4173 \param child The child view to remove. 4174 \return Whether or not \a child was removed from the view hierarchy. 4175 4176 \since BeOS R3 4177*/ 4178 4179 4180/*! 4181 \fn int32 BView::CountChildren() const 4182 \brief Returns the number of child views that this view has. 4183 4184 \return The number of child views. 4185 4186 \since BeOS R3 4187*/ 4188 4189 4190/*! 4191 \fn BView* BView::ChildAt(int32 index) const 4192 \brief Returns a pointer to the child view found at \a index. 4193 4194 \param index The index of the child view to return a pointer of. 4195 4196 \return A pointer to the child view at \a index or \c NULL if not found. 4197 4198 \since BeOS R3 4199*/ 4200 4201 4202/*! 4203 \fn BView* BView::NextSibling() const 4204 \brief Returns a pointer to the next sibling view. 4205 4206 \return A pointer to the next sibling view or \a NULL if not found. 4207 4208 \since BeOS R3 4209*/ 4210 4211 4212/*! 4213 \fn BView* BView::PreviousSibling() const 4214 \brief Returns a pointer to the previous sibling view. 4215 4216 \return A pointer to the previous sibling view or \a NULL if not found. 4217 4218 \since BeOS R3 4219*/ 4220 4221 4222/*! 4223 \fn bool BView::RemoveSelf() 4224 \brief Removes the view and all child views from the view hierarchy. 4225 4226 \returns Whether or not the view was removed from the view hierarchy. 4227 4228 \since BeOS R3 4229*/ 4230 4231 4232/*! 4233 \fn BView* BView::Parent() const 4234 \brief Returns a pointer to the view's parent. 4235 4236 \return A pointer to the parent view or \c NULL if not attached. 4237 4238 \since BeOS R3 4239*/ 4240 4241 4242/*! 4243 \fn BView* BView::FindView(const char* name) const 4244 \brief Returns the view in the view hierarchy with the specified \a name. 4245 4246 \return The view in the view hierarchy with the specified \a name or \c NULL 4247 if not found. 4248 4249 \since BeOS R3 4250*/ 4251 4252 4253//! @} 4254 4255 4256/*! 4257 \name View Frame Alteration 4258 4259 As a view's frame rectangle must be aligned to pixel values all parameters are 4260 rounded to the nearest integer. If the view isn't attached these methods alter the 4261 frame rectangle without triggering FrameMoved(), FrameResized() or Invalidate(). 4262*/ 4263 4264 4265//! @{ 4266 4267 4268/*! 4269 \fn void BView::MoveBy(float deltaX, float deltaY) 4270 \brief Moves the view \a deltaX pixels horizontally and \a deltaY pixels 4271 vertically in the parent view's coordinate system. 4272 4273 \param deltaX The number of pixels to move the view horizontally. 4274 \param deltaY The number of pixels to move the view vertically. 4275 4276 \since BeOS R3 4277*/ 4278 4279 4280/*! 4281 \fn void BView::MoveTo(BPoint where) 4282 \brief Move the view to the location specified by \a where in the parent 4283 view's coordinate system. 4284 4285 \param where The location to move the view to. 4286 4287 \since BeOS R3 4288*/ 4289 4290 4291/*! 4292 \fn void BView::MoveTo(float x, float y) 4293 \brief Move the view to the coordinates specified by \a x in the horizontal 4294 dimension and \a y in the vertical dimension in the parent view's 4295 coordinate system. 4296 4297 \param x The horizontal coordinate to move the view to. 4298 \param y The vertical coordinate to move the view to. 4299 4300 \since BeOS R3 4301*/ 4302 4303 4304/*! 4305 \fn void BView::ResizeBy(float deltaWidth, float deltaHeight) 4306 \brief Resize the view by \a deltaWidth horizontally and \a deltaHeight 4307 vertically without moving the top left corner of the view. 4308 4309 \param deltaWidth The number of pixels to resize the view by horizontally. 4310 \param deltaHeight The number of pixels to resize the view by vertically. 4311 4312 \since BeOS R3 4313*/ 4314 4315 4316/*! 4317 \fn void BView::ResizeTo(float width, float height) 4318 \brief Resize the view to the specified \a width and \a height. 4319 4320 \param width The width to resize the view to. 4321 \param height The height to resize the view to. 4322 4323 \since BeOS R3 4324*/ 4325 4326 4327/*! 4328 \fn void BView::ResizeTo(BSize size) 4329 \brief Resize the view to the dimension specified by \a size. 4330 4331 \param size The \a size to resize the view to. 4332 4333 \since Haiku R1 4334*/ 4335 4336 4337//! @} 4338 4339 4340/*! 4341 \fn status_t BView::GetSupportedSuites(BMessage* data) 4342 \copydoc BHandler::GetSupportedSuites() 4343*/ 4344 4345 4346/*! 4347 \fn BHandler* BView::ResolveSpecifier(BMessage* message, int32 index, 4348 BMessage* specifier, int32 what, const char* property) 4349 \copydoc BHandler::ResolveSpecifier() 4350*/ 4351 4352 4353/*! 4354 \fn status_t BView::Perform(perform_code code, void* _data) 4355 \brief Perform some action. (Internal Method) 4356 4357 The following perform codes are recognized: 4358 - \c PERFORM_CODE_MIN_SIZE: 4359 - \c PERFORM_CODE_MAX_SIZE: 4360 - \c PERFORM_CODE_PREFERRED_SIZE: 4361 - \c PERFORM_CODE_LAYOUT_ALIGNMENT: 4362 - \c PERFORM_CODE_HAS_HEIGHT_FOR_WIDTH: 4363 - \c PERFORM_CODE_GET_HEIGHT_FOR_WIDTH: 4364 - \c PERFORM_CODE_SET_LAYOUT: 4365 - \c PERFORM_CODE_INVALIDATE_LAYOUT: 4366 - \c PERFORM_CODE_DO_LAYOUT: 4367 - \c PERFORM_CODE_GET_TOOL_TIP_AT: 4368 - \c PERFORM_CODE_ALL_UNARCHIVED: 4369 - \c PERFORM_CODE_ALL_ARCHIVED: 4370 4371 \param code The perform code. 4372 \param _data A pointer to store some data. 4373 4374 \returns A status code. 4375 4376 \since Haiku R1 4377*/ 4378 4379 4380/*! 4381 \name Layouting 4382 4383 \note These methods were not available in BeOS R5. 4384*/ 4385 4386 4387//! @{ 4388 4389 4390/*! 4391 \fn BSize BView::MinSize() 4392 \brief Return the minimum size of the view. 4393 4394 \remark This is only meaningful if the view is part of a BLayout. 4395 4396 \return The minimum size of the view as a BSize. 4397 4398 \sa BAbstractLayout::MinSize() 4399 4400 \since Haiku R1 4401*/ 4402 4403 4404/*! 4405 \fn BSize BView::MaxSize() 4406 \brief Return the maximum size of the view. 4407 4408 \remark This is only meaningful if the view is part of a BLayout. 4409 4410 \return The maximum size of the view as a BSize. 4411 4412 \sa BAbstractLayout::MaxSize() 4413 4414 \since Haiku R1 4415*/ 4416 4417 4418/*! 4419 \fn BSize BView::PreferredSize() 4420 \brief Return the preferred size of the view. 4421 4422 \remark This is only meaningful if the view is part of a BLayout. 4423 4424 \return The preferred size of the view as a BSize. 4425 4426 \sa BAbstractLayout::PreferredSize() 4427 4428 \since Haiku R1 4429*/ 4430 4431 4432/*! 4433 \fn virtual BAlignment BView::LayoutAlignment() 4434 \brief Return the current BAlignemnt of the view. 4435 4436 \remark This is only meaningful if the view is part of a BLayout. 4437 4438 \since Haiku R1 4439*/ 4440 4441 4442/*! 4443 \fn void BView::SetExplicitMinSize(BSize size) 4444 \brief Set this view's min size, to be used by MinSize(). 4445 4446 \remark This is only meaningful if the view is part of a BLayout. 4447 4448 \sa BAbstractLayout::SetExplicitMinSize() 4449 4450 \since Haiku R1 4451*/ 4452 4453 4454/*! 4455 \fn void BView::SetExplicitMaxSize(BSize size) 4456 \brief Set this view's max size, to be used by MaxSize(). 4457 4458 \remark This is only meaningful if the view is part of a BLayout. 4459 4460 \sa BAbstractLayout::SetExplicitMaxSize() 4461 4462 \since Haiku R1 4463*/ 4464 4465 4466/*! 4467 \fn void BView::SetExplicitPreferredSize(BSize size) 4468 \brief Set this view's preferred size, to be used by PreferredSize(). 4469 4470 \remark This is only meaningful if the view is part of a BLayout. 4471 4472 \sa BAbstractLayout::SetExplicitPreferredSize() 4473 4474 \since Haiku R1 4475*/ 4476 4477 4478/*! 4479 \fn void BView::SetExplicitSize(BSize size) 4480 \brief Set this view's size. 4481 4482 \remark This is only meaningful if the view is part of a BLayout. 4483 4484 This is a convenience function that calls both SetExplicitMinSize() 4485 and SetExplicitMaxSize() with the \a size parameter. 4486 4487 \since Haiku R1 4488*/ 4489 4490 4491/*! 4492 \fn void BView::SetExplicitAlignment(BAlignment alignment) 4493 \brief Set this view's alignment, to be used by Alignment(). 4494 4495 \remark This is only meaningful if the view is part of a BLayout. 4496 4497 \sa BAbstractLayout::SetExplicitAlignment() 4498 4499 \since Haiku R1 4500*/ 4501 4502 4503/*! 4504 \fn BSize BView::ExplicitMinSize() const 4505 \brief Returns the explicit minimum size. 4506 4507 \remark This is only meaningful if the view is part of a BLayout. 4508 4509 This returns the value that was set by SetExplicitMinSize(). 4510 4511 \since Haiku R1 4512*/ 4513 4514 4515/*! 4516 \fn BSize BView::ExplicitMaxSize() const 4517 \brief Returns the explicit maximum size. 4518 4519 \remark This is only meaningful if the view is part of a BLayout. 4520 4521 This returns the value that was set by SetExplicitMaxSize(). 4522 4523 \since Haiku R1 4524*/ 4525 4526 4527/*! 4528 \fn BSize BView::ExplicitPreferredSize() const 4529 \brief Returns the explicit preferred size. 4530 4531 \remark This is only meaningful if the view is part of a BLayout. 4532 4533 This returns the value that was set by SetExplicitPreferredSize(). 4534 4535 \since Haiku R1 4536*/ 4537 4538 4539/*! 4540 \fn BSize BView::ExplicitAlignment() const 4541 \brief Returns the explicit alignment size. 4542 4543 \remark This is only meaningful if the view is part of a BLayout. 4544 4545 This returns the value that was set by SetExplicitAlignment(). 4546 4547 \since Haiku R1 4548*/ 4549 4550 4551/*! 4552 \fn bool BView::HasHeightForWidth() 4553 \brief Returns whether the layout of the view can calculate a height for a 4554 given width. 4555 4556 \remark This is only meaningful if the view is part of a BLayout. 4557 4558 Use GetHeightForWidth() to actually get the preferred size. 4559 4560 \returns \c true if the height values can be calculated, \c false if they 4561 cannot. 4562 4563 \since Haiku R1 4564*/ 4565 4566 4567/*! 4568 \fn virtual void BView::GetHeightForWidth(float width, float* min, 4569 float* max, float* preferred) 4570 \brief Returns the min, max and preferred height for a given width. 4571 4572 \remark This is only meaningful if the view is part of a BLayout. 4573 4574 \param[in] width The width you want the height to be calculated for. 4575 \param[out] min The minimum height that the layout will request. 4576 \param[out] max The maximum height that the layout will request. 4577 \param[out] preferred The preferred height for this \a width. 4578 4579 \since Haiku R1 4580*/ 4581 4582 4583/*! 4584 \fn void BView::SetLayout(BLayout* layout) 4585 \brief Sets the \a layout of the view. 4586 4587 \param layout The \a layout to set. 4588 4589 \since Haiku R1 4590*/ 4591 4592 4593/*! 4594 \fn BLayout* BView::GetLayout() const 4595 \brief Get the layout of the view. 4596 4597 \remark This is only meaningful if the view is part of a BLayout. 4598 4599 \returns The layout of the view. 4600 4601 \since Haiku R1 4602*/ 4603 4604 4605/*! 4606 \fn void BView::InvalidateLayout(bool descendants) 4607 \brief Invalidate layout. 4608 4609 \remark This is only meaningful if the view is part of a BLayout. 4610 4611 \param descendants Also invalidate its children views. 4612 4613 \since Haiku R1 4614*/ 4615 4616 4617/*! 4618 \fn void BView::EnableLayoutInvalidation() 4619 \brief Enable layout invalidation. 4620 4621 \remark This is only meaningful if the view is part of a BLayout. 4622 4623 \since Haiku R1 4624*/ 4625 4626 4627/*! 4628 \fn void BView::DisableLayoutInvalidation() 4629 \brief Disable layout invalidation. 4630 4631 \remark This is only meaningful if the view is part of a BLayout. 4632 4633 \since Haiku R1 4634*/ 4635 4636 4637/*! 4638 \fn bool BView::IsLayoutInvalidationDisabled() 4639 \brief Returns whether or not layout invalidation is disabled. 4640 4641 \remark This is only meaningful if the view is part of a BLayout. 4642 4643 \return \c true of layout invalidation is disabled, \c false otherwise. 4644 4645 \since Haiku R1 4646*/ 4647 4648 4649/*! 4650 \fn bool BView::IsLayoutValid() const 4651 \brief Returns whether or not the layout is valid. 4652 4653 \remark This is only meaningful if the view is part of a BLayout. 4654 4655 \returns Returns \c true if the layout is valid, \c false otherwise. 4656 4657 \since Haiku R1 4658*/ 4659 4660 4661/*! 4662 \fn void BView::ResetLayoutInvalidation() 4663 \brief Service call for BView derived classes re-enabling 4664 InvalidateLayout() notifications. 4665 4666 BLayout and BView will avoid calling InvalidateLayout on views that have 4667 already been invalidated, but if the view caches internal layout information 4668 which it updates in methods other than DoLayout(), it has to invoke this 4669 method, when it has done so, since otherwise the information might become 4670 obsolete without the layout noticing. 4671 4672 This is only meaningful if the view is part of a BLayout. 4673 4674 \since Haiku R1 4675*/ 4676 4677 4678/*! 4679 \fn BLayoutContext* BView::LayoutContext() const 4680 \brief Returns the BLayoutContext for this View. 4681 4682 \remark This is only meaningful if the view is part of a BLayout. 4683 4684 \since Haiku R1 4685*/ 4686 4687 4688/*! 4689 \fn void BView::Layout(bool force) 4690 \brief Layout the view. 4691 4692 \remark This is only meaningful if the view is part of a BLayout. 4693 4694 \param force If \c true layout even if valid. 4695 4696 \since Haiku R1 4697*/ 4698 4699 4700/*! 4701 \fn void BView::Relayout() 4702 \brief Relayout the view. 4703 4704 \remark This is only meaningful if the view is part of a BLayout. 4705 4706 \since Haiku R1 4707*/ 4708 4709 4710/*! 4711 \fn void BView::DoLayout() 4712 \brief Layout view within the layout context. 4713 4714 \remark This is only meaningful if the view is part of a BLayout. 4715 4716 \since Haiku R1 4717*/ 4718 4719 4720//! @} 4721 4722 4723/*! 4724 \name Tool Tips 4725 4726 \note These methods were not available in BeOS R5. 4727*/ 4728 4729 4730//! @{ 4731 4732 4733/*! 4734 \fn void BView::SetToolTip(const char* text) 4735 \brief Set the tool tip of the view to \a text. 4736 4737 \param text The \a text to set the view to or \c NULL or blank to unset. 4738 4739 \since Haiku R1 4740*/ 4741 4742 4743/*! 4744 \fn void BView::SetToolTip(BToolTip* tip) 4745 \brief Set the tool tip of the view to the \a tip object. 4746 4747 \param tip The tool tip object to set the view to or \c NULL to unset. 4748 4749 \since Haiku R1 4750*/ 4751 4752 4753/*! 4754 \fn BToolTip* BView::ToolTip() const 4755 \brief Return the tool tip set to the view or \c NULL if not set. 4756 4757 \return The BToolTip object set to the view. 4758 4759 \since Haiku R1 4760*/ 4761 4762 4763/*! 4764 \fn void BView::ShowToolTip(BToolTip* tip) 4765 \brief Show the tool tip at the current mouse position. 4766 4767 \param tip The BToolTip object to show. 4768 4769 \since Haiku R1 4770*/ 4771 4772 4773/*! 4774 \fn void BView::HideToolTip() 4775 \brief Hide the view's tool tip. 4776 4777 \since Haiku R1 4778*/ 4779 4780 4781/*! 4782 \fn bool BView::GetToolTipAt(BPoint point, BToolTip** _tip) 4783 \brief Point \a _tip with the view's tool tip. 4784 4785 \param point Currently unused. 4786 \param _tip A pointer to a pointer to a BToolTip object to set. 4787 4788 \since Haiku R1 4789*/ 4790 4791 4792//! @} 4793