1/* 2 * Copyright 2011-2013 Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * John Scipione, jscipione@gmail.com 7 * 8 * Corresponds to: 9 * headers/os/interface/View.h hrev45799 10 * src/kits/interface/View.cpp hrev45799 11 */ 12 13 14/*! 15 \file View.h 16 \ingroup interface 17 \ingroup libbe 18 \brief BView class definition and support data structures. 19*/ 20 21 22// mouse buttons 23 24 25/*! 26 \var B_PRIMARY_MOUSE_BUTTON 27 28 Primary mouse button mask parameter. 29*/ 30 31 32/*! 33 \var B_SECONDARY_MOUSE_BUTTON 34 35 Secondary mouse button mask parameter. 36*/ 37 38 39/*! 40 \var B_TERTIARY_MOUSE_BUTTON 41 42 Tertiary mouse button mask parameter. 43*/ 44 45 46// mouse transit 47 48 49/*! 50 \var B_ENTERED_VIEW 51 52 Mouse transit entered view. 53*/ 54 55 56/*! 57 \var B_INSIDE_VIEW 58 59 Mouse transit inside view. 60*/ 61 62 63/*! 64 \var B_EXITED_VIEW 65 66 Mouse transit exited view. 67*/ 68 69 70/*! 71 \var B_OUTSIDE_VIEW 72 73 Mouse transit outside view. 74*/ 75 76 77// event mask 78 79 80/*! 81 \var B_POINTER_EVENTS 82 83 Mouse pointer events mask parameter. 84*/ 85 86 87/*! 88 \var B_KEYBOARD_EVENTS 89 90 Keyboard events mask parameter. 91*/ 92 93 94// event mask options 95 96 97/*! 98 \var B_LOCK_WINDOW_FOCUS 99 100 Prevents the attached window from losing its focused state while the mouse is 101 held down. 102*/ 103 104 105/*! 106 \var B_SUSPEND_VIEW_FOCUS 107 108 Events normally sent to the focus view are suppressed. 109*/ 110 111 112/*! 113 \var B_NO_POINTER_HISTORY 114 115 Send only the most recent MouseMoved() event to the view. 116 117 \note New in Haiku: unless this flag is specified, both BWindow and 118 BView::GetMouse() will filter out older mouse moved messages. 119*/ 120 121 122/*! 123 \var B_FULL_POINTER_HISTORY 124 125 Send all MouseMoved() events to the view. 126*/ 127 128 129// event tracking 130 131 132/*! 133 \var B_TRACK_WHOLE_RECT 134 135 The whole rectangle moves with the cursor. 136*/ 137 138 139/*! 140 \var B_TRACK_RECT_CORNER 141 142 The left top corner is fixed while the right and bottom edges move with the 143 cursor. 144*/ 145 146 147// set font mask 148 149 150/*! 151 \var B_FONT_FAMILY_AND_STYLE 152 153 Font family and style mask parameter. 154*/ 155 156 157/*! 158 \var B_FONT_SIZE 159 160 Font size mask parameter. 161*/ 162 163 164/*! 165 \var B_FONT_SHEAR 166 167 Font shear mask parameter. 168*/ 169 170 171/*! 172 \var B_FONT_ROTATION 173 174 Font rotation mask parameter. 175*/ 176 177 178/*! 179 \var B_FONT_SPACING 180 181 Font spacing mask parameter. 182*/ 183 184 185/*! 186 \var B_FONT_ENCODING 187 188 Font encoding mask parameter. 189*/ 190 191 192/*! 193 \var B_FONT_FACE 194 195 Font face mask parameter. 196*/ 197 198 199/*! 200 \var B_FONT_FLAGS 201 202 Font flags mask parameter. 203*/ 204 205 206/*! 207 \var B_FONT_FALSE_BOLD_WIDTH 208 209 Font false bold width mask parameter. 210*/ 211 212 213/*! 214 \var B_FONT_ALL 215 216 Font all properties mask parameter. 217*/ 218 219 220// view flags 221 222 223/*! 224 \var B_FULL_UPDATE_ON_RESIZE 225 226 Redraw the entire view on resize. 227*/ 228 229 230/*! 231 \var _B_RESERVED1_ 232 233 Reserved for future use. 234*/ 235 236 237/*! 238 \var B_WILL_DRAW 239 240 Indicates that the view will do it's own drawing. 241*/ 242 243 244/*! 245 \var B_PULSE_NEEDED 246 247 Indicates that the view accepts Pulse() messages. 248*/ 249 250 251/*! 252 \var B_NAVIGABLE_JUMP 253 254 Indicates this is the default keyboard navigation view. 255*/ 256 257/*! 258 \var B_FRAME_EVENTS 259 260 View responds to frame move and resize events. 261*/ 262 263 264/*! 265 \var B_NAVIGABLE 266 267 The view is able to receive focus for keyboard navigation. Typically focus is 268 indicated by drawing a blue rectangle around the view. 269*/ 270 271 272/*! 273 \var B_SUBPIXEL_PRECISE 274 275 The view draws with sub-pixel precision. 276*/ 277 278 279/*! 280 \var B_DRAW_ON_CHILDREN 281 282 Indicates that the view responds to the DrawAfterChildren() hook method. 283*/ 284 285 286/*! 287 \var B_INPUT_METHOD_AWARE 288 289 Allows the view to use input method add-ons to gain access to the input 290 methods needed for Japanese and other languages. 291*/ 292 293 294/*! 295 \var _B_RESERVED7_ 296 297 Reserved for future use. 298*/ 299 300 301/*! 302 \var B_SUPPORTS_LAYOUT 303 304 The view supports the layout APIs, i.e. it doesn't require an explicit frame 305 rectangle to be specified. 306*/ 307 308 309/*! 310 \var B_INVALIDATE_AFTER_LAYOUT 311 312 Indicates that the view should be redraw after being added to a layout. 313*/ 314 315 316// resize mask variables, internal variables but are in a public header. 317 318 319/*! 320 \var _RESIZE_MASK_ 321 322 Resize mask. Do not use. 323*/ 324 325 326/*! 327 \var _VIEW_TOP_ 328 329 View top mask variable. Do not use. 330*/ 331 332 333/*! 334 \var _VIEW_LEFT_ 335 336 View left mask variable. Do not use. 337*/ 338 339 340/*! 341 \var _VIEW_BOTTOM_ 342 343 View bottom mask variable. Do not use. 344*/ 345 346 347/*! 348 \var _VIEW_RIGHT_ 349 350 View right mask variable. Do not use. 351*/ 352 353 354/*! 355 \var _VIEW_CENTER_ 356 357 View center mask variable. Do not use. 358*/ 359 360 361/*! 362 \fn inline uint32 _rule_(uint32 r1, uint32 r2, uint32 r3, uint32 r4) 363 \brief Internal function, do not use. 364*/ 365 366 367// resize mask 368 369 370/*! 371 \var B_FOLLOW_NONE 372 373 Follow none resize mask parameter. Equivalent to \c B_FOLLOW_LEFT 374 | \c B_FOLLOW_TOP. The view maintains its position in its parent's 375 coordinate system but not in the screen coordinate system. 376*/ 377 378 379/*! 380 \var B_FOLLOW_ALL_SIDES 381 382 Follow all sides resize mask parameter. Equivalent to \c B_FOLLOW_LEFT_RIGHT | 383 \c B_FOLLOW_TOP_BOTTOM. The view will be resized with its parent view both 384 horizontally and vertically. 385*/ 386 387 388/*! 389 \var B_FOLLOW_ALL 390 391 Equivalent to \c B_FOLLOW_ALL_SIDES. 392*/ 393 394 395// horizontal resize mask 396 397 398/*! 399 \var B_FOLLOW_LEFT 400 401 The margin between the left side of the view and the left side of its parent 402 remains constant. 403*/ 404 405 406/*! 407 \var B_FOLLOW_RIGHT 408 409 The margin between the right side of the view and the right side of its parent 410 remains constant. 411*/ 412 413 414/*! 415 \var B_FOLLOW_LEFT_RIGHT 416 417 The margin between the left and right sides of the view and the left and right 418 sides of its parent both remain constant. 419*/ 420 421 422/*! 423 \var B_FOLLOW_H_CENTER 424 425 The view maintains a constant relationship to the horizontal center of its 426 parent view. 427*/ 428 429 430// vertical resize mask 431 432 433/*! 434 \var B_FOLLOW_TOP 435 436 The margin between the top of the view and the top of its parent remains 437 constant. 438*/ 439 440 441/*! 442 \var B_FOLLOW_BOTTOM 443 444 The margin between the bottom of the view and the bottom of its parent remains 445 constant. 446*/ 447 448 449/*! 450 \var B_FOLLOW_TOP_BOTTOM 451 452 The margin between the top and bottom sides of the view and the top and bottom 453 sides of its parent both remain constant. 454*/ 455 456 457/*! 458 \var B_FOLLOW_V_CENTER 459 460 The view maintains a constant relationship to the vertical center of its 461 parent view. 462*/ 463 464 465/*! 466 \class BView 467 \ingroup interface 468 \ingroup libbe 469 \brief View base class. 470 471 A BView is a rectangular area within a window that responds to mouse clicks 472 and key presses, and acts as a surface for you to draw on. 473 474 Most Interface Kit classes, with the notable exception of BWindow inherit from 475 BView. Some of the time you might use a BView object as is, but most of the 476 time you subclass BView to do something unique. 477 478 To create a subclass of BView you generally override one or more of BView's 479 hook methods to respond to user events such as MouseDown() or FrameMoved(). 480 By default a BView does nothing in it's hook methods unless otherwise stated, 481 it's up to you to define what happens. To override the look of a BView you 482 should override the Draw() or DrawAfterChildren() methods. See the section on 483 Hook Methods below for more details. 484 485 When a BView object is first created it has no parent or child views. How you 486 add a view to the view hierarchy depends on if you want to use a standard 487 view with a defined frame rectangle or to use the Layout APIs to position and 488 size your view instead. 489 490 If you create a standard view you need to add it to a window or another view 491 using the AddChild() method, if you create a layout view you need to add your 492 view to a layout using BLayout::AddView() or by adding it to a layout builder. 493 494 Views are not very interesting until they, or one of their parents, are 495 attached to a window as many of BView's methods depend on a connection to the 496 App Server to do their work. In order to prevent multiple views from altering 497 the window simultaneously though locking is required. To perform an action 498 while the window is locked you issue the following code: 499 500\code 501if (Window()->LockLooper()) { 502 ... 503 Window()->UnlockLooper() 504} 505\endcode 506 507 Whenever App Server calls a hook method it automatically locks the BWindow for 508 you. 509 510 Only one view attached to a window is able to receive keyboard events at a 511 time. The view that is able to receive keyboard events such as KeyDown() is 512 called the "focus view". MakeFocus() gives or removes focus from a view. 513 Call IsFocus() to determine whether or not the view is the window's current 514 focus view. 515 516 When a view has focus an indicator should be drawn to inform the user. Typically 517 the view is surrounded by a blue rectangle to indicate that it is the window's 518 focus view. The color can be queried using the keyboard_navigation_color() 519 function in InterfaceDefs.h 520 521 Each view has it's own coordinate system with the origin point (0.0, 0.0) 522 located at the top left corner. You can convert a BPoint or BRect to or from 523 the view's coordinate system to the coordinate system of it's parent, or 524 of the screen's coordinate system. See the section on Coordinate Conversion 525 Methods for more details. 526 527 The Application Server clips a BView to the region where it's permitted to 528 draw which is never larger than the view's bound rectangle. A view can never 529 draw outside its bounds nor can it draw outside of the bounds rectangle of any 530 parent view. 531 532 You may limit the clipping region further by passing a BRegion object to 533 ConstrainClippingRegion(). You can obtain the current clipping region by 534 calling GetClippingRegion(). 535 536 Each view has a ViewColor() that fills the frame rectangle before the 537 view does any drawing of its own. The default view color is white, you may 538 change the view color by calling SetViewColor(). A commonly used view color 539 is \c B_PANEL_BACKGROUND_COLOR which is a grey color used as the view color 540 of many Interface Kit classes. If you set the view color to 541 \c B_TRANSPARENT_COLOR then the Application Server won't erase the clipping 542 region of the view before updating, this should only be used if the view 543 erases itself by drawing on every pixel in the clipping region. 544 545 If you want to set the view color of a view to be the same as its parent you 546 need to set it within the AttachedToWindow() method of the view like so: 547 548\code 549SetViewColor(Parent()->ViewColor()); 550\endcode 551*/ 552 553 554/*! 555 \fn BView::BView(const char* name, uint32 flags, BLayout* layout) 556 \brief Layout constructor. 557 558 To be used as part of a BLayout. You may use the Layout Methods found below 559 to set the size and alignment constraints of the view. 560 561 \c B_SUPPORTS_LAYOUT is automatically set to the view. The view flags can be 562 set after the view has been constructed by calling the SetFlags() methods. 563 564 \param name The name of the view, can be \c NULL. 565 \param flags The view flags, a mask of one or more of the following: 566 - \c B_FULL_UPDATE_ON_RESIZE Redraw the entire view on resize. 567 - \c B_WILL_DRAW Indicates that the view will do it's own drawing. 568 - \c B_PULSE_NEEDED The view accepts Pulse() messages. 569 - \c B_NAVIGABLE_JUMP Default for keyboard navigation. 570 - \c B_FRAME_EVENTS Responds to move and resize events. 571 - \c B_NAVIGABLE Able to receive keyboard navigation focus. 572 - \c B_SUBPIXEL_PRECISE Draws with sub-pixel precision. 573 - \c B_DRAW_ON_CHILDREN Responds to DrawAfterChildren(). 574 - \c B_INPUT_METHOD_AWARE Allows access input method add-ons. 575 - \c B_SUPPORTS_LAYOUT Supports the layout APIs, i.e. it doesn't 576 use a frame rectangle. 577 - \c B_INVALIDATE_AFTER_LAYOUT Is redraw after added to a layout. 578 \param layout A \a layout to set the view to. 579*/ 580 581 582/*! 583 \fn BView::BView(BRect frame, const char* name, uint32 resizingMode, 584 uint32 flags) 585 \brief Standard constructor. 586 587 A newly constructed BView object has no parent, you must assign it one by 588 passing it into the AddChild() method of another view or window. Once the 589 view or a parent view has been attached to a window the view becomes part of 590 that window's view hierarchy. 591 592 When the BView object is added as a child the \a frame values are interpreted 593 in the parent's coordinate system. The frame rectangle should be specified in 594 integral values to align on pixel boundaries, decimal values will be rounded. 595 596 The resizing mode flags and view flags can be set after the view has been 597 constructed by calling the SetResizingMode() and SetFlags() methods. 598 599 \param frame The \a frame rectangle of the view. 600 \param name The name of the view, can be \c NULL. 601 \param resizingMode Defines the view's behavior of the when its parent is 602 resized. 603 \n\n It combines one of the following horizontal resizing constants: 604 \li \c B_FOLLOW_TOP The margin between the top of the view and the top 605 of its parent remains constant. 606 \li \c B_FOLLOW_BOTTOM The margin between the bottom of the view and 607 the bottom of its parent remains constant. 608 \li \c B_FOLLOW_TOP_BOTTOM The margin between the top and bottom sides 609 of the view and the top and bottom sides of the parent both remain 610 constant. 611 \li \c B_FOLLOW_V_CENTER Maintains a constant relationship to the 612 vertical center of the parent view. 613 614 with one of the following vertical resizing constants: 615 \li \c B_FOLLOW_LEFT The margin between the left side of the view and 616 the left side of its parent remains constant. 617 \li \c B_FOLLOW_RIGHT The margin between the right side of the view and 618 the right side of the parent remains constant. 619 \li \c B_FOLLOW_LEFT_RIGHT The margin between the left and right sides 620 of the view and the left and right sides of its parent both remain 621 constant. 622 \li \c B_FOLLOW_H_CENTER The view maintains a constant relationship to 623 the horizontal center of the parent view. 624 625 or use one of the following combined horizontal/vertical constants: 626 \li \c B_FOLLOW_NONE Equivalent to \c B_FOLLOW_LEFT | \c B_FOLLOW_TOP. 627 \li \c B_FOLLOW_ALL_SIDES Equivalent to 628 \c B_FOLLOW_LEFT_RIGHT | \c B_FOLLOW_TOP_BOTTOM. 629 \param flags The view flags, a mask of one or more of the following: 630 - \c B_FULL_UPDATE_ON_RESIZE Redraw the entire view on resize. 631 - \c B_WILL_DRAW Indicates that the view will do it's own drawing. 632 - \c B_PULSE_NEEDED The view accepts Pulse() messages. 633 - \c B_NAVIGABLE_JUMP Default for keyboard navigation. 634 - \c B_FRAME_EVENTS Responds to move and resize events. 635 - \c B_NAVIGABLE Able to receive keyboard navigation focus. 636 - \c B_SUBPIXEL_PRECISE Draws with sub-pixel precision. 637 - \c B_DRAW_ON_CHILDREN Responds to DrawAfterChildren(). 638 - \c B_INPUT_METHOD_AWARE Allows access input method add-ons. 639 - \c B_SUPPORTS_LAYOUT Supports the layout APIs, i.e. it doesn't 640 use a frame rectangle. 641 - \c B_INVALIDATE_AFTER_LAYOUT Is redraw after added to a layout. 642*/ 643 644 645/*! 646 \fn BView::BView(BMessage* archive) 647 \brief Archive constructor. 648 649 \param archive The data \a archive message to construct the view from. 650*/ 651 652 653/*! 654 \fn BView::~BView() 655 \brief Destructor method. 656 657 Deletes the view and all children freeing any memory used. 658*/ 659 660 661/*! 662 \name Archiving 663*/ 664 665 666//! @{ 667 668 669/*! 670 \fn BArchivable* BView::Instantiate(BMessage* data) 671 \brief Creates a new BView object from the \a data message. 672 673 \returns A newly created BView object or \c NULL if the message doesn't 674 contain an archived BView object. 675*/ 676 677 678/*! 679 \fn status_t BView::Archive(BMessage* data, bool deep) const 680 \brief Archives the object into the \a data message. 681 682 \param data A pointer to the BMessage object to archive the object into. 683 \param deep Whether or not to archive child views as well. 684 685 \return A status code, \c B_OK if everything went well or an error code 686 otherwise. 687 \retval B_OK The object was archived successfully. 688 \retval B_NO_MEMORY Ran out of memory while archiving the object. 689*/ 690 691 692//! @} 693 694 695/*! 696 \name Hook Methods 697*/ 698 699 700//! @{ 701 702 703/*! 704 \fn status_t BView::AllUnarchived(const BMessage* from) 705 \brief Hook method called when all views have been unarchived. 706 707 The default implementation does nothing. 708*/ 709 710 711/*! 712 \fn status_t BView::AllArchived(BMessage* into) const 713 \brief Hook method called when all views have been archived. 714 715 The default implementation does nothing. 716*/ 717 718 719/*! 720 \fn void BView::AttachedToWindow() 721 \brief Hook method that is called when the object is attached to a 722 window. 723 724 The default implementation does nothing. 725*/ 726 727 728/*! 729 \fn void BView::AllAttached() 730 \brief Similar to AttachedToWindow() but this method is triggered after 731 all child views have already been attached to a window. 732 733 The default implementation does nothing. 734*/ 735 736 737/*! 738 \fn void BView::DetachedFromWindow() 739 \brief Hook method that is called when the object is detached from a 740 window. 741 742 The default implementation does nothing. 743*/ 744 745 746/*! 747 \fn void BView::AllDetached() 748 \brief Similar to AttachedToWindow() but this method is triggered after 749 all child views have already been detached from a window. 750 751 The default implementation does nothing. 752*/ 753 754 755/*! 756 \fn void BView::Draw(BRect updateRect) 757 \brief Draws the area of the view that intersects \a updateRect. 758 759 Derived classes should override this method to draw their view. 760 761 \remark This is an hook method called by the Interface Kit, you don't have to 762 call it yourself. If you need to forcefully redraw the view consider 763 calling Invalidate() instead. 764 765 \param updateRect The rectangular area to be drawn. 766 767 The default implementation does nothing. 768*/ 769 770 771/*! 772 \fn void BView::DrawAfterChildren(BRect r) 773 \brief Perform any drawing that needs to be done after child view have 774 already been drawn. 775 776 \param r The rectangular area to be drawn. 777 778 The default implementation does nothing. 779*/ 780 781 782/*! 783 \fn void BView::FrameMoved(BPoint newPosition) 784 \brief Hook method that gets called when the view is moved. 785 786 \param newPosition The point of the top left corner of the frame 787 that the view has been moved to. 788 789 The default implementation does nothing. 790*/ 791 792 793/*! 794 \fn void BView::FrameResized(float newWidth, float newHeight) 795 \brief Hook method that gets called when the view is resized. 796 797 \param newWidth The new \a width of the view. 798 \param newHeight The new \a height of the view. 799 800 The default implementation does nothing. 801*/ 802 803 804/*! 805 \fn void BView::KeyDown(const char* bytes, int32 numBytes) 806 \brief Hook method that is called when a keyboard key is pressed. 807 808 \param bytes The bytes of the key combination pressed. 809 \param numBytes The number of bytes in \a bytes. 810 811 The default implementation sets keyboard navigation focus. 812*/ 813 814 815/*! 816 \fn void BView::KeyUp(const char* bytes, int32 numBytes) 817 \brief Hook method that is called when a keyboard key is released. 818 819 \param bytes The bytes of the key combination pressed. 820 \param numBytes The number of bytes in \a bytes. 821 822 The default implementation does nothing. 823*/ 824 825 826/*! 827 \fn void BView::LayoutInvalidated(bool descendants) 828 \brief Hook method that is called when the layout is invalidated. 829 830 \note This method was not available in BeOS R5. 831 832 \param descendants Whether or not child views have also been invalidated. 833 834 The default implementation does nothing. 835*/ 836 837 838/*! 839 \fn void BView::MessageReceived(BMessage* message) 840 \brief Handle \a message received by the associated looper. 841 842 \param message The \a message received by the associated looper. 843 844 \see BHandler::MessageReceived() 845*/ 846 847 848/*! 849 \fn void BView::MouseDown(BPoint where) 850 \brief Hook method that is called when a mouse button is pressed. 851 852 \param where The point on the screen where to mouse pointer is when 853 the mouse button is pressed. 854 855 The default implementation does nothing. 856*/ 857 858 859/*! 860 \fn void BView::MouseUp(BPoint where) 861 \brief Hook method that is called when a mouse button is released. 862 863 \param where The point on the screen where to mouse pointer is when 864 the mouse button is released. 865 866 The default implementation does nothing. 867*/ 868 869 870/*! 871 \fn void BView::MouseMoved(BPoint where, uint32 code, 872 const BMessage* a_message) 873 \brief Hook method that is called when the mouse is moved. 874 875 The default implementation does nothing. 876*/ 877 878 879/*! 880 \fn void BView::Pulse() 881 \brief Hook method that gets called when the view receives a \c B_PULSE 882 message. 883 884 An action is performed each time the App Server calls the Pulse() method. 885 The pulse rate is set by SetPulseRate(). You can implement Pulse() to do 886 anything you want. The default version does nothing. The pulse granularity 887 is no better than once per 100,000 microseconds. 888 889 The default implementation does nothing. 890 891 \sa SetPulseRate() 892*/ 893 894 895/*! 896 \fn void BView::TargetedByScrollView(BScrollView* scrollView) 897 \brief Hook method called when the view becomes the target of 898 \a scrollView. 899 900 The default implementation does nothing. 901 902 \param scrollView The BScrollView object that has targeted the view. 903*/ 904 905 906/*! 907 \fn void BView::WindowActivated(bool state) 908 \brief Hook method called when the attached window becomes activated or 909 deactivated. 910 911 The default implementation does nothing. 912 913 \param state \c true if the window becomes activated, \c false if the 914 window becomes deactivated. 915*/ 916 917 918//! @} 919 920 921/*! 922 \fn BRect BView::Bounds() const 923 \brief Returns the view frame rectangle in the view's coordinate system. 924 925 \return The bounding rectangle of the view. 926*/ 927 928 929/*! 930 \fn BRect BView::Frame() const 931 \brief Returns the frame rectangle of the view in the parent's coordinate system. 932 933 \returns The view's frame rectangle. 934*/ 935 936 937/*! 938 \name Coordinate Conversion Methods 939*/ 940 941 942//! @{ 943 944 945/*! 946 \fn void BView::ConvertToParent(BPoint* point) const 947 \brief Convert \a point to the parent's coordinate system in place. 948 949 \param point A pointer to a BPoint object to convert. 950*/ 951 952 953/*! 954 \fn BPoint BView::ConvertToParent(BPoint point) const 955 \brief Returns \a point converted to the parent's coordinate system. 956 957 \param point A BPoint object to convert. 958 959 \return A new BPoint object in the parent's coordinate system. 960*/ 961 962 963/*! 964 \fn void BView::ConvertFromParent(BPoint* point) const 965 \brief Convert \a point from the parent's coordinate system to the 966 view's coordinate system in place. 967 968 \param point A pointer to a BPoint object to convert. 969*/ 970 971 972/*! 973 \fn BPoint BView::ConvertFromParent(BPoint point) const 974 \brief Returns \a point converted from the parent's coordinate system to 975 the view's coordinate system. 976 977 \param point A BPoint object to convert. 978 979 \return A new BPoint object in the view's coordinate system. 980*/ 981 982 983/*! 984 \fn void BView::ConvertToParent(BRect* rect) const 985 \brief Convert \a rect to the parent's coordinate system in place. 986 987 \param rect A pointer to a BRect object to convert. 988*/ 989 990 991/*! 992 \fn BRect BView::ConvertToParent(BRect rect) const 993 \brief Returns \a rect converted to the parent's coordinate system. 994 995 \param rect A BRect object to convert. 996 997 \return A new BRect object in the parent's coordinate system. 998*/ 999 1000 1001/*! 1002 \fn void BView::ConvertFromParent(BRect* rect) const 1003 \brief Convert \a rect from the parent's coordinate system to the 1004 view's coordinate system in place. 1005 1006 \param rect A pointer to a BRect object to convert. 1007*/ 1008 1009 1010/*! 1011 \fn BRect BView::ConvertFromParent(BRect rect) const 1012 \brief Returns \a rect converted from the parent's coordinate system to the 1013 view's coordinate system. 1014 1015 \param rect A BRect object to convert. 1016 1017 \return A new BRect object in the view's coordinate system. 1018*/ 1019 1020 1021/*! 1022 \fn void BView::ConvertToScreen(BPoint* point) const 1023 \brief Convert \a point to the screen's coordinate system in place. 1024 1025 \param point A pointer to a BPoint object to convert. 1026*/ 1027 1028 1029/*! 1030 \fn BPoint BView::ConvertToScreen(BPoint point) const 1031 \brief Returns \a point converted to the screen's coordinate system. 1032 1033 \param point A BPoint object to convert. 1034 1035 \return A new BPoint object in the screen's coordinate system. 1036*/ 1037 1038 1039/*! 1040 \fn void BView::ConvertFromScreen(BPoint* point) const 1041 \brief Convert \a point from the screen's coordinate system to the 1042 view's coordinate system in place. 1043 1044 \param point A pointer to a BPoint object to convert. 1045*/ 1046 1047 1048/*! 1049 \fn BPoint BView::ConvertFromScreen(BPoint point) const 1050 \brief Returns \a point converted from the screen's coordinate system to 1051 the view's coordinate system. 1052 1053 \param point A BPoint object to convert. 1054 1055 \return A new BPoint object in the view's coordinate system. 1056*/ 1057 1058 1059/*! 1060 \fn void BView::ConvertToScreen(BRect* rect) const 1061 \brief Convert \a rect to the screen's coordinate system in place. 1062 1063 \param rect A pointer to a BRect object to convert. 1064*/ 1065 1066 1067/*! 1068 \fn BRect BView::ConvertToScreen(BRect rect) const 1069 \brief Returns \a rect converted to the screen's coordinate system. 1070 1071 \param rect A BRect object to convert. 1072 1073 \return A new BRect object in the screen's coordinate system. 1074*/ 1075 1076 1077/*! 1078 \fn void BView::ConvertFromScreen(BRect* rect) const 1079 \brief Convert \a rect from the screen's coordinate system to the 1080 view's coordinate system in place. 1081 1082 \param rect A pointer to a BRect object to convert. 1083*/ 1084 1085 1086/*! 1087 \fn BRect BView::ConvertFromScreen(BRect rect) const 1088 \brief Returns \a rect converted from the screen's coordinate system to the 1089 view's coordinate system. 1090 1091 \param rect A BRect object to convert. 1092 1093 \return A new BRect object in the view's coordinate system. 1094*/ 1095 1096 1097//! @} 1098 1099 1100/*! 1101 \fn uint32 BView::Flags() const 1102 \brief Return the view flags set in the constructor or by SetFlags(). 1103 1104 \return The view flags as a uint32 mask. 1105*/ 1106 1107 1108/*! 1109 \fn void BView::SetFlags(uint32 flags) 1110 \brief Sets the view flags to the \a flags mask. 1111 1112 \param flags The view flags to set as a uint32 mask. 1113*/ 1114 1115 1116//! @} 1117 1118 1119/*! 1120 \fn void BView::Hide() 1121 \brief Hides the view without removing it from the view hierarchy. 1122 1123 Calls to Hide() and Show() are cumulative. A visible view becomes hidden 1124 once the number of Hide() calls exceeds the number of Show() calls. 1125 1126 \see BWindow::Hide() 1127 \see IsHidden() 1128*/ 1129 1130 1131/*! 1132 \fn void BView::Show() 1133 \brief Shows the view making it visible. 1134 1135 Calls to Hide() and Show() are cumulative. A hidden view becomes visible 1136 again once the number of Show() calls matches the number of Hide() calls. 1137 1138 \see BWindow::Show() 1139 \see IsHidden() 1140*/ 1141 1142 1143/*! 1144 \fn bool BView::IsFocus() const 1145 \brief Returns whether or not the view is the window's current focus view. 1146 1147 The focus view changes as the user moves from one view to another either 1148 by pushing the tab key or by clicking a new view with the mouse. The change 1149 can be made programmatically via the MakeFocus() method. 1150 1151 \returns \c true if the view is the current focus view, \c false otherwise. 1152 1153 \see MakeFocus() 1154 \see BWindow::CurrentFocus() 1155*/ 1156 1157 1158/*! 1159 \fn bool BView::IsHidden(const BView* lookingFrom) const 1160 \brief Returns whether or not the view is hidden from the perspective of 1161 \a lookingFrom. 1162 1163 A view is considered hidden if it, any of it's parent views, or the window 1164 it is attached to has had the Hide() method called on it. This method 1165 allows you to determine the hidden status of a view from a different point 1166 on the view hierarchy. 1167 1168 \param lookingFrom The view used as a base when determining the hidden 1169 status of the BView object. 1170 1171 \return \c true if the view was hidden via the Hide() method, \c false 1172 otherwise. 1173*/ 1174 1175 1176/*! 1177 \fn bool BView::IsHidden() const 1178 \brief Returns whether or not the view is hidden. 1179 1180 A view can be hidden either by calling Hide() on the view, calling Hide() 1181 on a parent view or calling Hide() on the window that the view is attached 1182 to. When a BWindow or BView is hidden, all its descendants are also hidden. 1183 1184 This method only returns whether the view or an ancestor view has had the 1185 Hide() method called on it, it doesn't consider if the view is obscured 1186 by another view or is off-screen. A BView is not hidden by default. 1187 1188 \return \c true if the view was hidden via the Hide() method, \c false 1189 otherwise. 1190*/ 1191 1192 1193/*! 1194 \fn bool BView::IsPrinting() const 1195 \brief Returns whether or not the BView object is drawing to a printer. 1196 1197 This method should only be called from the Draw() or DrawAfterChildren() 1198 methods. If called from any other method this method returns \c false. 1199 1200 The view may choose different fonts, images, or colors when drawing to a 1201 printer vs. when drawing to the screen. 1202 1203 \return Returns \c true if drawing to a printer, \c false otherwise. 1204*/ 1205 1206 1207/*! 1208 \fn BPoint BView::LeftTop() const 1209 \brief Returns the left top corner point. 1210 1211 \return The left top corner of the view as a BPoint object. 1212*/ 1213 1214 1215/*! 1216 \fn void BView::SetResizingMode(uint32 mode) 1217 \brief Sets the resizing mode of the view according to the \a mode mask. 1218 1219 The resizing mode is first set in the BView constructor. 1220 1221 \see SetFlags() 1222*/ 1223 1224 1225/*! 1226 \fn uint32 BView::ResizingMode() const 1227 \brief Returns the resizing mode flags mask set in the constructor or by 1228 SetResizingMode(). 1229 1230 \returns the current resizing mode flags as a uint32 mask. 1231*/ 1232 1233 1234/*! 1235 \fn void BView::SetViewCursor(const BCursor* cursor, bool sync) 1236 \brief Assigns \a cursor to the view. 1237 1238 This cursor will be displayed when the mouse is positioned inside the view. 1239 1240 \param cursor The BCursor object to assign to the view. 1241 \param sync If \c true App Server is synchronized immediately forcing the 1242 change to occur. If \c false, the change will be put in the queue and 1243 will take effect when the pending requests are processed. 1244*/ 1245 1246 1247/*! 1248 \fn void BView::Flush() const 1249 \brief Flushes the attached window's connection to App Server. 1250 1251 If the view isn't attached to a window, Flush() does nothing. 1252*/ 1253 1254 1255/*! 1256 \fn void BView::Sync() const 1257 \brief Synchronizes the attached window's connection to App Server. 1258 1259 \warning If the view isn't attached to a window, Sync() might crash the 1260 application. 1261*/ 1262 1263 1264/*! 1265 \fn BWindow* BView::Window() const 1266 \brief Returns the window the view is attached to. 1267 1268 \return The window the view is attached to or \c NULL if the view isn't 1269 attached to a window. 1270*/ 1271 1272 1273/*! 1274 \fn void BView::GetPreferredSize(float* _width, float* _height) 1275 \brief Fill out the preferred width and height of the view 1276 into the \a _width and \a _height parameters. 1277 1278 Derived classes should override this method to set the preferred 1279 size of object. 1280 1281 \remark Either the \a _width or \a _height parameter may be set to \c NULL 1282 if you only want to get the other one. 1283 1284 \param[out] _width Pointer to a \c float to store the width of the view. 1285 \param[out] _height Pointer to a \c float to store the height of the view. 1286*/ 1287 1288 1289/*! 1290 \fn void BView::ResizeToPreferred() 1291 \brief Resizes the view to its preferred size keeping the left top corner 1292 constant. 1293*/ 1294 1295 1296/*! 1297 \name Input Related Methods 1298*/ 1299 1300 1301//! @{ 1302 1303 1304/*! 1305 \fn void BView::BeginRectTracking(BRect startRect, uint32 style) 1306 \brief Displays an outline rectangle on the view and initiates tracking. 1307 1308 This method is typically called from the MouseDown() while EndRectTracking() 1309 is typically called from the MouseUp method(). 1310 1311 \param startRect The initial frame in the view's coordinate system. 1312 \param style This parameter is set to one of the following: 1313 - \c B_TRACK_WHOLE_RECT The position of the rect changes with the cursor 1314 while its size remains the same. 1315 - \c B_TRACK_RECT_CORNER The left top corner is fixed while the right and 1316 bottom edges move with the cursor. 1317*/ 1318 1319 1320/*! 1321 \fn void BView::EndRectTracking() 1322 \brief Ends tracking removing the outline rectangle from the view. 1323 1324 BeginRectTracking() is typically called from the MouseDown() while this 1325 method is typically called from the MouseUp() method. 1326*/ 1327 1328 1329/*! 1330 \fn void BView::DragMessage(BMessage* message, BRect dragRect, 1331 BHandler* replyTo) 1332 \brief Initiates a drag-and-drop session. 1333 1334 This method only works if the BView objects are attached to a window. 1335 1336 \param message Contains data to be dragged and dropped on the destination 1337 view. The caller retains responsibility for this object. 1338 \param dragRect An outline rectangle used in place of a bitmap image set in 1339 the view's coordinate system. 1340 \param replyTo The target set to handle the message sent in reply to the 1341 dragged message. If \c NULL the reply is instead directed to the 1342 BView object that initiated the drag-and-drop session. 1343*/ 1344 1345 1346/*! 1347 \fn void BView::DragMessage(BMessage* message, BBitmap* image, 1348 BPoint offset, BHandler* replyTo) 1349 \brief Initiates a drag-and-drop session of an \a image. 1350 1351 This method only works if the BView objects are attached to a window. 1352 1353 \param message Contains data to be dragged and dropped on the destination 1354 view. The caller retains responsibility for this object. 1355 \param image Bitmap image dragged by the user. The memory used by the bitmap 1356 is freed automatically when the message is dropped. 1357 \param offset The offset to the hotspot within the image in the bitmap's 1358 coordinate system. 1359 \param replyTo The target set to handle the message sent in reply to the 1360 dragged message. If \c NULL the reply is instead directed to the 1361 BView object that initiated the drag-and-drop session. 1362*/ 1363 1364 1365/*! 1366 \fn void BView::DragMessage(BMessage* message, BBitmap* image, 1367 drawing_mode dragMode, BPoint offset, BHandler* replyTo) 1368 \brief Initiates a drag-and-drop session of an \a image with drawing_mode 1369 set by \a dragMode. 1370 1371 This method only works if the BView objects are attached to a window. 1372 1373 \param message Contains data to be dragged and dropped on the destination 1374 view. The caller retains responsibility for this object. 1375 \param image Bitmap image dragged by the user. The memory used by the bitmap 1376 is freed automatically when the message is dropped. 1377 \param dragMode Sets the drawing_mode used to draw the dragged image. Set to 1378 \c B_OP_ALPHA to drag-and-drop partially transparent images. 1379 \param offset The offset to the hotspot within the image in the bitmap's 1380 coordinate system. 1381 \param replyTo The target set to handle the message sent in reply to the 1382 dragged message. If \c NULL the reply is instead directed to the 1383 BView object that initiated the drag-and-drop session. 1384*/ 1385 1386 1387/*! 1388 \fn void BView::GetMouse(BPoint* _location, uint32* _buttons, 1389 bool checkMessageQueue) 1390 \brief Fills out the cursor location and the current state of the mouse 1391 buttons. 1392 1393 The cursor doesn't have to be located within the view for this method to work, 1394 however, the view must be attached to a window. Don't use this method to track 1395 the mouse in your derived view, implement MouseMoved() instead. 1396 1397 \param[out] _location Filled out with the cursor location in the view's 1398 coordinate system. 1399 \param[out] _buttons Filled out with a mask of the following values: 1400 - \c B_PRIMARY_MOUSE_BUTTON 1401 - \c B_SECONDARY_MOUSE_BUTTON 1402 - \c B_TERTIARY_MOUSE_BUTTON 1403 \param checkMessageQueue If \c true pull from any pending MouseMoved() or 1404 MouseUp() events in the message queue top down before filling out 1405 the current mouse cursor state. 1406*/ 1407 1408 1409/*! 1410 \fn void BView::MakeFocus(bool focusState) 1411 \brief Makes the view the current focus view of the window or gives up 1412 being the focus view of the window. 1413 1414 The focus view handles selections and KeyDown events when the the attached 1415 window is active. There can be only one focus view at a time per window. 1416 1417 When called with \a focusState set to \c true this method first calls 1418 MakeFocus() on the previously focused view with \a focusState set to 1419 \c false. 1420 1421 The focus doesn't automatically change when MouseDown is called so calling 1422 MakeFocus() is the only way to make a view the focus view of a window. 1423 Classes derived from BView that can display the current selection, or that 1424 can accept pasted data should call MakeFocus() in their MouseDown() method 1425 to update the focus view of the window on click. 1426 1427 If the view isn't attached to a window this method has no effect. 1428 1429 \param focusState \a true to set focus, \a false to remove it. 1430*/ 1431 1432 1433/*! 1434 \fn BScrollBar* BView::ScrollBar(orientation posture) const 1435 \brief Returns the BScrollBar object that has the BView set as its target. 1436 1437 \param posture Either \c B_VERTICAL to get the vertical scroll bar or 1438 \c B_HORIZONTAL to get the horizontal scroll bar. 1439 1440 \returns the Scrollbar object requested or \c NULL if none found. 1441 1442 \see BScrollBar::SetTarget() 1443*/ 1444 1445 1446/*! 1447 \fn void BView::ScrollBy(float deltaX, float deltaY) 1448 \brief Scroll the view by \a deltaX horizontally and \a deltaY vertically. 1449 1450 \param deltaX The amount to scroll horizontally. 1451 \param deltaY The amount to scroll vertically. 1452*/ 1453 1454 1455/*! 1456 \fn void BView::ScrollTo(BPoint where) 1457 \brief Scroll the view to the point specified by \a where. 1458 1459 \param where The location to scroll the view to. 1460*/ 1461 1462 1463/*! 1464 \fn void BView::ScrollWithMouseWheelDelta(BScrollBar* scrollBar, 1465 float delta) 1466 \brief Handle the scroll wheel changing over scrollbars. 1467 1468 \note This method was not available in BeOS R5. 1469 1470 - Extract the scrollbar change based on the mouse wheel \a delta into a 1471 protected method of BView. 1472 - The method is called from the MessageReceived() method of BScrollBar. 1473 1474 With this change it is now a bit easier to scroll horizontally around the 1475 system by putting the mouse cursor over a horizontal scrollbar and using 1476 the wheel. 1477*/ 1478 1479 1480/*! 1481 \fn status_t BView::SetEventMask(uint32 mask, uint32 options) 1482 \brief Sets whether or not the view can accept mouse and keyboard 1483 events when not in focus. 1484 1485 If \a mask includes \c B_POINTER_EVENTS then the view will receive mouse 1486 events even when the mouse isn't over the view and if it includes 1487 \c B_KEYBOARD_EVENTS the view will receive keyboard events even if it 1488 isn't in focus. 1489 1490 The \a options mask options are as follows: 1491 - \c B_NO_POINTER_HISTORY Tells App Server to only send the most recent 1492 MouseMoved() event to the view sacrificing some granularity. 1493 - \c B_FULL_POINTER_HISTORY Tells App Server to send all MouseMoved() 1494 events to the view. 1495 1496 \param mask The \a mask of \c B_POINTER_EVENTS and \c B_KEYBOARD_EVENTS 1497 to set. 1498 \param options Sets other event-handling options. 1499 1500 \return \c B_OK if everything went fine or an error code, usually 1501 \c B_ERROR if something went wrong. 1502*/ 1503 1504 1505/*! 1506 \fn uint32 BView::EventMask() 1507 \brief Returns the current event mask. 1508 1509 \return The current event mask as a uint32. 1510*/ 1511 1512 1513/*! 1514 \fn status_t BView::SetMouseEventMask(uint32 mask, uint32 options) 1515 \brief Sets whether or not the view can accept mouse and keyboard 1516 events when not in focus from within MouseDown() until the 1517 following MouseUp() event. 1518 1519 The \a options mask options are as follows: 1520 - \c B_NO_POINTER_HISTORY Tells App Server to send only the most recent 1521 MouseMoved() event to the view sacrificing mouse movement granularity. 1522 - \c B_FULL_POINTER_HISTORY Tells App Server to send all MouseMoved() 1523 events to the view. 1524 - \c B_SUSPEND_VIEW_FOCUS Events normally sent to the focus view are 1525 suppressed. While the mouse is held down, the keyboard is ignored. 1526 The view receiving the MouseDown() messages doesn't have to be the 1527 focus view to suppress focused messages. 1528 - \c B_LOCK_WINDOW_FOCUS Prevents the attached window from losing its 1529 focused state while the mouse is held down, even if the mouse leaves 1530 the bounds of the window. 1531 1532 \param mask The \a mask of \c B_POINTER_EVENTS and \c B_KEYBOARD_EVENTS 1533 to set. 1534 \param options Sets other event-handling options. 1535 1536 \return \c B_OK if everything went fine or an error code, usually 1537 \c B_ERROR if something went wrong. 1538*/ 1539 1540 1541//! @} 1542 1543 1544/*! 1545 \name Graphics State Methods 1546*/ 1547 1548 1549//! @{ 1550 1551 1552/*! 1553 \fn void BView::PushState() 1554 \brief Saves the drawing state to the stack. 1555 1556 The drawing state contains the following elements: 1557 - local and global origins 1558 - local and global scales 1559 - local and global clipping regions 1560 - the current drawing mode 1561 - pen size and location 1562 - the font context 1563 - foreground and background color 1564 - line cap and join modes 1565 - miter limit 1566 - stipple pattern 1567 1568 A new state context is created after PushState() is called with a local scale 1569 at 0, a local origin at (0, 0), and no clipping region. 1570*/ 1571 1572 1573/*! 1574 \fn void BView::PopState() 1575 \brief Restores the drawing state from the stack. 1576*/ 1577 1578 1579/*! 1580 \fn void BView::SetOrigin(BPoint pt) 1581 \brief Sets the origin in the view's coordinate system. 1582 1583 \param pt The point to set the origin to. 1584*/ 1585 1586 1587/*! 1588 \fn void BView::SetOrigin(float x, float y) 1589 \brief Sets the origin in the view's coordinate system. 1590 1591 \param x The x-coordinate to set the origin to. 1592 \param y The y-coordinate to set the origin to. 1593*/ 1594 1595 1596/*! 1597 \fn BPoint BView::Origin() const 1598 \brief Returns the origin point in the view's coordinate system. 1599 1600 \return The local origin point in the view's coordinate system. 1601*/ 1602 1603 1604/*! 1605 \fn void BView::SetScale(float scale) const 1606 \brief Sets the scale of the coordinate system the view uses for drawing. 1607 1608 The default scale is 1.0. A \a scale value lower than 1.0 reduces the size of 1609 the drawing coordinate system, a \a scale value greater than 1.0 magnifies 1610 the coordinate system; for example, a \a scale value of 0.5 cuts the drawing 1611 drawing area in half moving the drawing closer to the origin while a \a scale 1612 value of 2.0 doubles the drawing area and moving it away from the origin. 1613 1614 Updating the \a scale of view won't update previously drawn elements. 1615 1616 SetScale() calls are not commutative unless you call them across different 1617 drawing states as the following: 1618 1619\code 1620 view->SetScale(2); 1621 view->SetScale(2); 1622 // view's scale is 2 1623 1624 view2->SetScale(2); 1625 view2->PushState(); 1626 view2->SetScale(2); 1627 // view2's scale is 4 1628\endcode 1629 1630 /param scale The scale factor to set. 1631*/ 1632 1633 1634/*! 1635 \fn float BView::Scale() const 1636 \brief Return the current drawing scale. 1637 1638 \return The current drawing scale. 1639*/ 1640 1641 1642/*! 1643 \fn void BView::SetLineMode(cap_mode lineCap, join_mode lineJoin, 1644 float miterLimit) 1645 \brief Set line mode to use PostScript-style line cap and join modes. 1646 1647 \a lineCap determines the shape of the endpoints of stroked paths while 1648 \a lineJoin determines the shape of the corners where two lines meet. 1649 1650 The default miter limit is 10.0 which gives an angle of 11.478341°. 1651 1652 \param lineCap One of the following: 1653 - \c B_ROUND_CAP A semicircle with diameter of line width is drawn at the 1654 endpoint. 1655 - \c B_BUTT_CAP A straight edge is drawn without extending beyond the endpoint. 1656 - \c B_SQUARE_CAP A straight edge is drawn extending past the endpoint by half 1657 the line width. 1658 \param lineJoin One of the following: 1659 - \c B_ROUND_JOIN Same as \c B_ROUND_CAP but for a join. 1660 - \c B_MITER_JOIN The lines are extended until they meet. If angle that they 1661 meet at is greater than the 2*arcsin(1/\a miterLimit) than a bevel join 1662 is used instead. 1663 - \c B_BEVEL_JOIN The area between the caps is filled with a triangle. 1664 - \c B_BUTT_JOIN Same as \c B_BUTT_CAP but for a join. 1665 - \c B_SQUARE_JOIN Same as \c B_SQUARE_CAP but for a join. 1666 \param miterLimit Sets the cut off angle before a miter join becomes a bevel 1667 join calculated by 2*arcsin(1/\a miterLimit). 1668*/ 1669 1670 1671/*! 1672 \fn join_mode BView::LineJoinMode() const 1673 \brief Returns the current line join mode. 1674 1675 \return The current line join mode set to the view. 1676*/ 1677 1678 1679/*! 1680 \fn cap_mode BView::LineCapMode() const 1681 \brief Returns the current line cap mode. 1682 1683 \return The current line cap mode set to the view. 1684*/ 1685 1686 1687/*! 1688 \fn float BView::LineMiterLimit() const 1689 \brief Returns the miter limit used for \c B_MITER_JOIN join mode. 1690 1691 \return The current miter limit set to the view. 1692*/ 1693 1694 1695/*! 1696 \fn void BView::SetDrawingMode(drawing_mode mode) 1697 \brief Sets the drawing mode of the view. 1698 1699 The default drawing mode is \c B_OP_COPY. 1700 1701 \param mode Set to one of the following: 1702 - \c B_OP_COPY 1703 - \c B_OP_OVER 1704 - \c B_OP_ERASE 1705 - \c B_OP_INVERT 1706 - \c B_OP_SELECT 1707 - \c B_OP_ALPHA 1708 - \c B_OP_MIN 1709 - \c B_OP_MAX 1710 - \c B_OP_ADD 1711 - \c B_OP_SUBTRACT 1712 - \c B_OP_BLEND 1713*/ 1714 1715 1716/*! 1717 \fn drawing_mode BView::DrawingMode() const 1718 \brief Return the current drawing_mode. 1719 1720 \return The current drawing_mode. 1721*/ 1722 1723 1724/*! 1725 \fn void BView::SetBlendingMode(source_alpha srcAlpha, 1726 alpha_function alphaFunc) 1727 \brief Set the blending mode which controls how transparency is used. 1728 1729 \param srcAlpha Set to one of the following: 1730 - \c B_CONSTANT_ALPHA Use the high color's alpha channel. 1731 - \c B_PIXEL_ALPHA Use the alpha value of each pixel when drawing a bitmap. 1732 \param alphaFunc Set to one of the following: 1733 - \c B_ALPHA_OVERLAY Used for drawing a image with transparency over an opaque 1734 background. 1735 - \c B_ALPHA_COMPOSITE Used to composite two or more transparent images 1736 together offscreen to produce a new image drawn using 1737 \c B_ALPHA_OVERLAY mode. 1738*/ 1739 1740 1741/*! 1742 \fn void BView::GetBlendingMode(source_alpha* srcAlpha, 1743 alpha_function* alphaFunc) const 1744 \brief Fill out \a srcAlpha and \a alphaFunc with the alpha mode and 1745 alpha function of the view. 1746 1747 \param[out] srcAlpha The alpha mode to fill out. 1748 \param[out] alphaFunc The alpha function to fill out. 1749*/ 1750 1751 1752/*! 1753 \fn void BView::MovePenTo(BPoint point) 1754 \brief Move the pen to \a point in the view's coordinate system. 1755 1756 \param point the location to move the pen to. 1757*/ 1758 1759 1760/*! 1761 \fn void BView::MovePenTo(float x, float y) 1762 \brief Move the pen to the point specified by \a x and \a y in the view's 1763 coordinate system. 1764 1765 \param x The horizontal coordinate to move the pen to. 1766 \param y The vertical coordinate to move the pen to. 1767*/ 1768 1769 1770/*! 1771 \fn void BView::MovePenBy(float x, float y) 1772 \brief Move the pen by \a x pixels horizontally and \a y pixels vertically. 1773 1774 \param x The number of pixels to move the pen horizontally. 1775 \param y The number of pixels to move the pen vertically. 1776*/ 1777 1778 1779/*! 1780 \fn BPoint BView::PenLocation() const 1781 \brief Return the current pen location as a BPoint object. 1782 1783 \return The current pen location in the view's coordinate system. 1784*/ 1785 1786 1787/*! 1788 \fn void BView::SetPenSize(float size) 1789 \brief Set the pen size to \a size. 1790 1791 \param size The pen size to set. 1792*/ 1793 1794 1795/*! 1796 \fn float BView::PenSize() const 1797 \brief Return the current pen size. 1798 1799 \return The current pen size as a float. 1800*/ 1801 1802 1803/*! 1804 \fn void BView::SetHighColor(rgb_color color) 1805 \brief Set the high color of the view. 1806 1807 \param color The color to set. 1808*/ 1809 1810 1811/*! 1812 \fn void BView::SetHighColor(uchar red, uchar green, uchar blue, 1813 uchar alpha) 1814 \brief Set the high color of the view. 1815 1816 \param red The \a red component of the high color. 1817 \param green The \a green component of the high color. 1818 \param blue The \a blue component of the high color. 1819 \param alpha The \a alpha component of the high color. 1820*/ 1821 1822 1823/*! 1824 \fn rgb_color BView::HighColor() const 1825 \brief Return the current high color. 1826 1827 \return The current high color as an rgb_color struct. 1828*/ 1829 1830 1831/*! 1832 \fn void BView::SetLowColor(rgb_color color) 1833 \brief Set the low color of the view. 1834 1835 \param color The color to set. 1836*/ 1837 1838 1839/*! 1840 \fn void BView::SetLowColor(uchar red, uchar green, uchar blue, uchar alpha) 1841 \brief Set the low color of the view. 1842 1843 \param red The \a red component of the low color. 1844 \param green The \a green component of the low color. 1845 \param blue The \a blue component of the low color. 1846 \param alpha The \a alpha component of the low color. 1847*/ 1848 1849 1850/*! 1851 \fn rgb_color BView::LowColor() const 1852 \brief Return the current low color. 1853 1854 \return The current low color as an rgb_color struct. 1855*/ 1856 1857 1858/*! 1859 \fn void BView::SetViewColor(rgb_color color) 1860 \brief Set the view color of the view. 1861 1862 \param color The color to set. 1863*/ 1864 1865 1866/*! 1867 \fn void BView::SetViewColor(uchar red, uchar green, uchar blue, 1868 uchar alpha) 1869 \brief Set the view color of the view. 1870 1871 \param red The \a red component of the view color. 1872 \param green The \a green component of the view color. 1873 \param blue The \a blue component of the view color. 1874 \param alpha The \a alpha component of the view color. 1875*/ 1876 1877 1878/*! 1879 \fn rgb_color BView::ViewColor() const 1880 \brief Return the current view color. 1881 1882 \return The current view color as an rgb_color struct. 1883*/ 1884 1885 1886/*! 1887 \fn void BView::ForceFontAliasing(bool enable) 1888 \brief Turn anti-aliasing on and off when printing. 1889 1890 Typically want to turn font anti-aliasing off when printing by passing 1891 \c true to this method and then turn it on again by passing in \c false. 1892 1893 This method does not affect characters drawn to the screen. 1894 1895 \param enable If \c true turn off anti-aliasing, if \c false turn on 1896 anti-aliasing. 1897*/ 1898 1899 1900/*! 1901 \fn void BView::SetFont(const BFont* font, uint32 mask) 1902 \brief Set the font of the view. 1903 1904 By passing \c B_FONT_ALL to the \a mask parameter as is the default all font 1905 properties from \a font are set on the view. 1906 1907 \param font A pointer to a BFont object to set. 1908 \param mask A mask of the following values to determine what font properties to set: 1909 - \c B_FONT_FAMILY_AND_STYLE 1910 - \c B_FONT_SPACING 1911 - \c B_FONT_SIZE 1912 - \c B_FONT_ENCODING 1913 - \c B_FONT_SHEAR 1914 - \c B_FONT_FACE 1915 - \c B_FONT_ROTATION 1916 - \c B_FONT_FLAGS 1917*/ 1918 1919 1920/*! 1921 \fn void BView::GetFont(BFont* font) const 1922 \brief Fill out \a font with the font set to the view. 1923 1924 \param[out] font The BFont object to fill out. 1925*/ 1926 1927 1928/*! 1929 \fn void BView::GetFontHeight(font_height* height) const 1930 \brief Fill out the font_height struct with the view font. 1931 1932 \param[out] height The font_height struct to fill out. 1933*/ 1934 1935 1936/*! 1937 \fn void BView::SetFontSize(float size) 1938 \brief Set the size of the view's font to \a size. 1939 1940 \param size The font size to set to the view in points. 1941*/ 1942 1943 1944/*! 1945 \fn float BView::StringWidth(const char* string) const 1946 \brief Return the width of \a string set in the font of the view. 1947 1948 \param string The \a string to get the width of. 1949 1950 \return The width of the string in the view's font as a float. 1951*/ 1952 1953 1954/*! 1955 \fn float BView::StringWidth(const char* string, int32 length) const 1956 \brief Return the width of \a string set in the font of the view up to 1957 \a length characters. 1958 1959 \param string The \a string to get the width of. 1960 \param length The maximum number of characters in \a string to consider. 1961 1962 \return The width of the string in the view's font as a float. 1963*/ 1964 1965 1966/*! 1967 \fn void BView::GetStringWidths(char* stringArray[], int32 lengthArray[], 1968 int32 numStrings, float widthArray[]) const 1969 \brief Fill out widths of the strings in \a stringArray set in the font 1970 of the view into \a widthArray. 1971 1972 \param stringArray The array of strings to get the lengths of. 1973 \param lengthArray The number of characters of the strings in \a stringArray 1974 to consider. 1975 \param numStrings The number of strings in \a stringArray. 1976 \param widthArray The array to store the widths of the strings in 1977 \a stringArray. 1978*/ 1979 1980 1981/*! 1982 \fn void BView::TruncateString(BString* string, uint32 mode, float width) const 1983 \brief Truncate \a string with truncation mode \a mode so that it is no wider 1984 than \a width set in the view's font. 1985 1986 When the string is truncated the missing characters are replaced by a 1987 horizontal ellipses. 1988 1989 \param string The string to truncate in place. 1990 \param mode The truncation mode to use, one of the following: 1991 - \c B_TRUNCATE_BEGINNING Truncate from the beginning of the string. 1992 - \c B_TRUNCATE_MIDDLE Truncate from the middle of the string. 1993 - \c B_TRUNCATE_END Truncate from the end of the string. 1994 - \c B_TRUNCATE_SMART Truncate from anywhere based on the string content. 1995 Not currently implemented. 1996 \param width The maximum width to truncate the string to. 1997*/ 1998 1999 2000/*! 2001 \fn void BView::ClipToPicture(BPicture* picture, BPoint where, bool sync) 2002 \brief Intersects the current clipping region of the view with the pixels 2003 of \a picture. 2004 2005 BPicture instances are resolution independent, \a picture is effectively 2006 drawn at the view's resolution and the bitmap produced is used to modify the 2007 clipping region. 2008 2009 The pixels that are at least partially opaque are the ones drawn by 2010 \a picture. 2011 2012 \param picture The BPicture object to intersect with. 2013 \param where Offset in the view's coordinate system. 2014 \param sync If \c false, this method will execute asynchronously. 2015*/ 2016 2017 2018/*! 2019 \fn void BView::ClipToInversePicture(BPicture* picture, BPoint where, 2020 bool sync) 2021 \brief Intersects the current clipping region of the view with the pixels 2022 outside of \a picture. 2023 2024 \param picture The BPicture object to intersect with. 2025 \param where Offset in the view's coordinate system. 2026 \param sync If \c false, this method will execute asynchronously. 2027 2028 \see ClipToPicture() 2029*/ 2030 2031 2032/*! 2033 \fn void BView::GetClippingRegion(BRegion* region) const 2034 \brief Fill out \a region with the view's clipping region. 2035 2036 \param[out] region The BRegion object to fill out. 2037*/ 2038 2039 2040/*! 2041 \fn void BView::ConstrainClippingRegion(BRegion* region) 2042 \brief Set the clipping region the \a region restricting the area that the 2043 view can draw in. 2044 2045 The Application Server keeps track of the clipping region for each view 2046 attached to a window so that the view can't draw outside of it, 2047 consequently this method works only for view that are attached to a window. 2048 2049 The default clipping region contains the visible area of the view. By passing 2050 a region to this method the clipping area is further restricted. Passing in 2051 \c NULL resets the clipping region back to the default. 2052 2053 Calls to ConstrainClippingRegion() are not cumulative, each time this 2054 method is called it replaces the old clipping region. 2055 2056 \param region The region to set the clipping region to or \c NULL 2057 to reset to default. 2058*/ 2059 2060 2061//! @} 2062 2063 2064/*! 2065 \name Drawing Related Methods 2066 2067 The view must be attached to the window for these methods to work unless 2068 otherwise stated. Notes on specific methods are provided below: 2069 2070 DrawBitmap() 2071 2072 If the the image is bigger than the destination rectangle, it is scaled to fit. 2073 2074 The asynchronous versions pass the image to Application Server and return 2075 immediately. 2076 2077 This can be more efficient in some cases for example to draw several bitmaps 2078 at once and then call Sync() to tell Application Server to wait for them all 2079 to finish drawing rather than waiting for each one to draw. 2080 2081 DrawPicture() 2082 2083 The asynchronous versions pass the picture to Application Server and return 2084 immediately. 2085 2086 This can be more efficient in some cases for example to draw several pictures 2087 at once and then call Sync() to tell Application Server to wait for them all 2088 to finish drawing rather than waiting for each one to draw. 2089 2090 DrawPicture() doesn't alter the graphics state of the view nor do changes to 2091 the graphics state of the view alter the BPicture object. What the picture 2092 will look like depends on the graphics parameters that were in effect when the 2093 picture was recorded. 2094 2095 DrawString() 2096 2097 The \a string is drawn in the view's current font and is modified by 2098 the other parameters of the font such as it's direction (left-to-right or 2099 right-to-left), rotation, spacing, shear, etc. The \a string is always drawn 2100 left to right even if it's text direction is set to right-to-left mode. 2101 2102 Drawing a string is fastest in \c B_OP_COPY mode and anti-aliasing can 2103 produce undesirable effects when a string is draw in other modes, especially 2104 if the string is drawn in the same location repeatedly. 2105 2106 DrawString() doesn't erase before drawing. 2107*/ 2108 2109 2110//! @{ 2111 2112 2113/*! 2114 \fn void BView::DrawBitmapAsync(const BBitmap* bitmap, BRect bitmapRect, 2115 BRect viewRect, uint32 options) 2116 \brief Draws \a bitmap on the view within \a viewRect asynchronously. 2117 2118 \param bitmap The bitmap to draw onto the view. 2119 \param bitmapRect The portion of the bitmap to draw in the bitmap's 2120 coordinate system. 2121 \param viewRect The area in the view's coordinate system to draw the 2122 bitmap in. 2123 \param options ?? 2124*/ 2125 2126 2127/*! 2128 \fn void BView::DrawBitmapAsync(const BBitmap* bitmap, BRect bitmapRect, 2129 BRect viewRect) 2130 \brief Draws \a bitmap on the view within \a viewRect asynchronously. 2131 2132 \param bitmap The bitmap to draw onto the view. 2133 \param bitmapRect The portion of the bitmap to draw in the bitmap's 2134 coordinate system. 2135 \param viewRect The area in the view's coordinate system to draw the 2136 bitmap in. 2137*/ 2138 2139 2140/*! 2141 \fn void BView::DrawBitmapAsync(const BBitmap* bitmap, BRect viewRect) 2142 \brief Draws \a bitmap on the view within \a viewRect asynchronously. 2143 2144 \param bitmap The bitmap to draw onto the view. 2145 \param viewRect The area in the view's coordinate system to draw the 2146 bitmap in. 2147*/ 2148 2149 2150/*! 2151 \fn void BView::DrawBitmapAsync(const BBitmap* bitmap, BPoint where) 2152 \brief Draws \a bitmap on the view offset by \a where asynchronously. 2153 2154 \param bitmap The bitmap to draw onto the view. 2155 \param where The location to draw the bitmap in the view's coordinate system. 2156*/ 2157 2158 2159/*! 2160 \fn void BView::DrawBitmapAsync(const BBitmap* bitmap) 2161 \brief Draws \a bitmap on the view asynchronously. 2162 2163 \param bitmap The bitmap to draw onto the view. 2164*/ 2165 2166 2167/*! 2168 \fn void BView::DrawBitmap(const BBitmap* bitmap, BRect bitmapRect, 2169 BRect viewRect, uint32 options) 2170 \brief brief Draws \a bitmap on the view within \a viewRect. 2171 2172 \param bitmap The bitmap to draw onto the view. 2173 \param bitmapRect The portion of the bitmap to draw in the bitmap's 2174 coordinate system. 2175 \param viewRect The area in the view's coordinate system to draw the 2176 bitmap in. 2177 \param options ?? 2178*/ 2179 2180 2181/*! 2182 \fn void BView::DrawBitmap(const BBitmap* bitmap, BRect bitmapRect, 2183 BRect viewRect) 2184 \brief Draws \a bitmap on the view within \a viewRect. 2185 2186 \param bitmap The bitmap to draw onto the view. 2187 \param bitmapRect The portion of the bitmap to draw in the bitmap's 2188 coordinate system. 2189 \param viewRect The area in the view's coordinate system to draw the 2190 bitmap in. 2191*/ 2192 2193 2194/*! 2195 \fn void BView::DrawBitmap(const BBitmap* bitmap, BRect viewRect) 2196 \brief Draws \a bitmap on the view within \a viewRect. 2197 2198 \param bitmap The bitmap to draw onto the view. 2199 \param viewRect The area in the view's coordinate system to draw the 2200 bitmap in. 2201*/ 2202 2203 2204/*! 2205 \fn void BView::DrawBitmap(const BBitmap* bitmap, BPoint where) 2206 \brief Draws \a bitmap on the view offset by \a where. 2207 2208 \param bitmap The bitmap to draw onto the view. 2209 \param where The location to draw the bitmap in the view's coordinate system. 2210*/ 2211 2212 2213/*! 2214 \fn void BView::DrawBitmap(const BBitmap* bitmap) 2215 \brief Draws \a bitmap on the view. 2216 2217 \param bitmap The bitmap to draw onto the view. 2218*/ 2219 2220 2221/*! 2222 \fn void BView::DrawChar(char c) 2223 \brief Draws character \a c onto to the view at the current pen position. 2224 2225 The character is drawn in the view's current font. 2226 2227 \param c The character to draw. 2228*/ 2229 2230 2231/*! 2232 \fn void BView::DrawChar(char c, BPoint location) 2233 \brief Draws character \a c at the specified \a location in the view. 2234 2235 The character is drawn in the view's current font. 2236 2237 \param c The character to draw. 2238 \param location The location in the view to draw the character. 2239*/ 2240 2241 2242/*! 2243 \fn void BView::DrawString(const char* string, escapement_delta* delta) 2244 \brief Draw \a string onto the view at the current pen position. 2245 2246 \param string The string to draw. 2247 \param delta Adds additional width to each character according to the 2248 following fields: 2249 - nonspace(float) The amount of width to add to characters with visible 2250 glyphs. 2251 - space(float) The amount of width to add to characters with escapements 2252 but don't have visible glyphs. 2253*/ 2254 2255 2256/*! 2257 \fn void BView::DrawString(const char* string, BPoint location, 2258 escapement_delta* delta) 2259 \brief Draw \a string onto the view at the specified \a location in the view. 2260 2261 \param string The string to draw. 2262 \param location The location in the view to draw the string. 2263 \param delta Adds additional width to each character according to the 2264 following fields: 2265 - nonspace(float) The amount of width to add to characters with visible 2266 glyphs. 2267 - space(float) The amount of width to add to characters with escapements 2268 but don't have visible glyphs. 2269*/ 2270 2271 2272/*! 2273 \fn void BView::DrawString(const char* string, int32 length, 2274 escapement_delta* delta) 2275 \brief Draw \a string up to \a length characters onto the view at the current 2276 pen position. 2277 2278 \param string The string to draw. 2279 \param length The maximum number of characters in \a string to draw. 2280 \param delta Adds additional width to each character according to the 2281 following fields: 2282 - nonspace(float) The amount of width to add to characters with visible 2283 glyphs. 2284 - space(float) The amount of width to add to characters with escapements 2285 but don't have visible glyphs. 2286*/ 2287 2288 2289/*! 2290 \fn void BView::DrawString(const char* string, int32 length, BPoint location, 2291 escapement_delta* delta) 2292 \brief Draw \a string up to \a length characters onto the view at the 2293 specified \a location in the view. 2294 2295 \param string The string to draw. 2296 \param length The maximum number of characters in \a string to draw. 2297 \param location The location in the view to draw the string. 2298 \param delta Adds additional width to each character according to the 2299 following fields: 2300 - nonspace(float) The amount of width to add to characters with visible 2301 glyphs. 2302 - space(float) The amount of width to add to characters with escapements 2303 but don't have visible glyphs. 2304*/ 2305 2306 2307/*! 2308 \fn void BView::DrawString(const char* string, const BPoint* locations, 2309 int32 locationCount) 2310 \brief Draw \a string \a locationCount times at the specified \a locations. 2311 2312 \param string The string to draw. 2313 \param locations A pointer to an array of BPoint objects to draw the string. 2314 \param locationCount The number of elements in \a locations. 2315*/ 2316 2317 2318/*! 2319 \fn void BView::DrawString(const char* string, int32 length, 2320 const BPoint* locations, int32 locationCount) 2321 \brief Draw \a string up to \a length characters \a locationCount times at the 2322 specified \a locations. 2323 2324 \param string The string to draw. 2325 \param length The maximum number of characters in \a string to draw. 2326 \param locations A pointer to an array of BPoint objects to draw the string. 2327 \param locationCount The number of elements in \a locations. 2328*/ 2329 2330 2331/*! 2332 \fn void BView::StrokeEllipse(BPoint center, float xRadius, float yRadius, 2333 ::pattern pattern) 2334 \brief Stroke the outline of an ellipse starting at \a center with a 2335 horizontal radius of \a xRadius and a vertical radius of \a yRadius. 2336 2337 \param center The center point. 2338 \param xRadius The horizontal radius. 2339 \param yRadius The vertical radius. 2340 \param pattern One of the following: 2341 - \c B_SOLID_HIGH 2342 - \c B_SOLID_LOW 2343 - \c B_MIXED_COLORS 2344*/ 2345 2346 2347/*! 2348 \fn void BView::StrokeEllipse(BRect rect, ::pattern pattern) 2349 \brief Stroke the outline of an ellipse inscribed within \a rect. 2350 2351 \param rect The area within which to inscribe the shape. 2352 \param pattern One of the following: 2353 - \c B_SOLID_HIGH 2354 - \c B_SOLID_LOW 2355 - \c B_MIXED_COLORS 2356*/ 2357 2358 2359/*! 2360 \fn void BView::FillEllipse(BPoint center, float xRadius, float yRadius, 2361 ::pattern pattern) 2362 \brief Fill an ellipse starting at \a center with a horizontal radius 2363 of \a xRadius and a vertical radius of \a yRadius. 2364 2365 \param center The center point. 2366 \param xRadius The horizontal radius. 2367 \param yRadius The vertical radius. 2368 \param pattern One of the following: 2369 - \c B_SOLID_HIGH 2370 - \c B_SOLID_LOW 2371 - \c B_MIXED_COLORS 2372*/ 2373 2374 2375/*! 2376 \fn void BView::FillEllipse(BRect rect, ::pattern pattern) 2377 \brief Fill an ellipse inscribed within \a rect. 2378 2379 \param rect The area within which to inscribe the shape. 2380 \param pattern One of the following: 2381 - \c B_SOLID_HIGH 2382 - \c B_SOLID_LOW 2383 - \c B_MIXED_COLORS 2384*/ 2385 2386 2387/*! 2388 \fn void BView::FillEllipse(BPoint center, float xRadius, float yRadius, 2389 const BGradient& gradient) 2390 \brief Fill an ellipse with the specified \a gradient pattern starting at 2391 \a center with a horizontal radius of \a xRadius and a vertical radius 2392 of \a yRadius. 2393 2394 \param center The center point. 2395 \param xRadius The horizontal radius. 2396 \param yRadius The vertical radius. 2397 \param gradient The gradient pattern to fill the ellipse with. 2398*/ 2399 2400 2401/*! 2402 \fn void BView::FillEllipse(BRect rect, const BGradient& gradient) 2403 \brief Fill an ellipse with the specified \a gradient pattern inscribed within 2404 \a rect. 2405 2406 \param rect The area within which to inscribe the shape. 2407 \param gradient The gradient pattern to fill the ellipse with. 2408*/ 2409 2410 2411/*! 2412 \fn void BView::StrokeArc(BPoint center, float xRadius, float yRadius, 2413 float startAngle, float arcAngle, ::pattern pattern) 2414 \brief Stroke the outline of an arc starting at \a center with a 2415 horizontal radius of \a xRadius and a vertical radius of \a yRadius 2416 starting at \a startAngle and drawing \a arcAngle degrees. 2417 2418 \param center The center point. 2419 \param xRadius The horizontal radius. 2420 \param yRadius The vertical radius. 2421 \param startAngle The angle to begin drawing at. 2422 \param arcAngle The number of degrees of the arc to draw. 2423 \param pattern One of the following: 2424 - \c B_SOLID_HIGH 2425 - \c B_SOLID_LOW 2426 - \c B_MIXED_COLORS 2427*/ 2428 2429 2430/*! 2431 \fn void BView::StrokeArc(BRect rect, float startAngle, float arcAngle, 2432 ::pattern pattern) 2433 \brief Stroke the outline of an arc inscribed within \a rect starting at 2434 \a startAngle and drawing \a arcAngle degrees. 2435 2436 \param rect The area within which to inscribe the shape. 2437 \param startAngle The angle to begin drawing at. 2438 \param arcAngle The number of degrees of the arc to draw. 2439 \param pattern One of the following: 2440 - \c B_SOLID_HIGH 2441 - \c B_SOLID_LOW 2442 - \c B_MIXED_COLORS 2443*/ 2444 2445 2446/*! 2447 \fn void BView::FillArc(BPoint center, float xRadius, float yRadius, 2448 float startAngle, float arcAngle, ::pattern pattern) 2449 \brief Fill an arc starting at \a center with a horizontal radius of 2450 \a xRadius and a vertical radius of \a yRadius starting at 2451 \a startAngle and drawing \a arcAngle degrees. 2452 2453 \param center The center point. 2454 \param xRadius The horizontal radius. 2455 \param yRadius The vertical radius. 2456 \param startAngle The angle to begin drawing at. 2457 \param arcAngle The number of degrees of the arc to draw. 2458 \param pattern One of the following: 2459 - \c B_SOLID_HIGH 2460 - \c B_SOLID_LOW 2461 - \c B_MIXED_COLORS 2462*/ 2463 2464 2465/*! 2466 \fn void BView::FillArc(BPoint center, float xRadius, float yRadius, 2467 float startAngle, float arcAngle, const BGradient& gradient) 2468 \brief Fill an arc with the specified \a gradient pattern starting at 2469 \a center with a horizontal radius of \a xRadius and a vertical 2470 radius of \a yRadius starting at \a startAngle and drawing 2471 \a arcAngle degrees. 2472 2473 \param center The center point. 2474 \param xRadius The horizontal radius. 2475 \param yRadius The vertical radius. 2476 \param startAngle The angle to begin drawing at. 2477 \param arcAngle The number of degrees of the arc to draw. 2478 \param gradient The gradient pattern to fill the arc with. 2479*/ 2480 2481 2482/*! 2483 \fn void BView::FillArc(BRect rect, float startAngle, float arcAngle, 2484 ::pattern pattern) 2485 \brief Fill an arc inscribed within \a rect starting at startAngle and 2486 drawing \a arcAngle degrees. 2487 2488 \param rect The area within which to inscribe the shape. 2489 \param startAngle The angle to begin drawing at. 2490 \param arcAngle The number of degrees of the arc to draw. 2491 \param pattern One of the following: 2492 - \c B_SOLID_HIGH 2493 - \c B_SOLID_LOW 2494 - \c B_MIXED_COLORS 2495*/ 2496 2497 2498/*! 2499 \fn void BView::FillArc(BRect rect, float startAngle, float arcAngle, 2500 const BGradient& gradient) 2501 \brief Fill an arc with the specified \a gradient pattern inscribed within 2502 \a rect starting at startAngle and drawing \a arcAngle degrees. 2503 2504 \param rect The area within which to inscribe the shape. 2505 \param startAngle The angle to begin drawing at. 2506 \param arcAngle The number of degrees of the arc to draw. 2507 \param gradient The gradient pattern to fill the arc with. 2508*/ 2509 2510 2511/*! 2512 \fn void BView::StrokeBezier(BPoint* controlPoints, ::pattern pattern) 2513 \brief Stroke a bezier curve. 2514 2515 \param controlPoints The list of points that form the bezier curve. 2516 \param pattern One of the following: 2517 - \c B_SOLID_HIGH 2518 - \c B_SOLID_LOW 2519 - \c B_MIXED_COLORS 2520*/ 2521 2522 2523/*! 2524 \fn void BView::FillBezier(BPoint* controlPoints, ::pattern pattern) 2525 \brief Fill a bezier curve. 2526 2527 \param controlPoints The list of points that form the bezier curve. 2528 \param pattern One of the following: 2529 - \c B_SOLID_HIGH 2530 - \c B_SOLID_LOW 2531 - \c B_MIXED_COLORS 2532*/ 2533 2534 2535/*! 2536 \fn void BView::FillBezier(BPoint* controlPoints, const BGradient& gradient) 2537 2538 \brief Fill a bezier curve. 2539 2540 \param controlPoints The list of points that form the bezier curve. 2541 \param gradient The gradient pattern to fill the bezier curve with. 2542*/ 2543 2544 2545/*! 2546 \fn void BView::StrokePolygon(const BPolygon* polygon, bool closed, ::pattern pattern) 2547 \brief Stroke a polygon shape. 2548 2549 \param polygon The polygon shape to stroke. 2550 \param closed Whether or not the last line of the polygon should intersect 2551 with the initial point. 2552 \param pattern One of the following: 2553 - \c B_SOLID_HIGH 2554 - \c B_SOLID_LOW 2555 - \c B_MIXED_COLORS 2556*/ 2557 2558 2559/*! 2560 \fn void BView::StrokePolygon(const BPoint* pointArray, int32 numPoints, 2561 bool closed, ::pattern pattern) 2562 \brief Stroke a polygon shape made up of points specified by \a pointArray. 2563 2564 \param pointArray An array of points that specify the vertices of the polygon. 2565 \param numPoints The number of points in \a pointArray. 2566 \param closed Whether or not the last line of the polygon should intersect 2567 with the initial point. 2568 \param pattern One of the following: 2569 - \c B_SOLID_HIGH 2570 - \c B_SOLID_LOW 2571 - \c B_MIXED_COLORS 2572*/ 2573 2574 2575/*! 2576 \fn void BView::StrokePolygon(const BPoint* pointArray, int32 numPoints, 2577 BRect bounds, bool closed, ::pattern pattern) 2578 \brief Stroke a polygon shape made up of points specified by \a pointArray 2579 inscribed by \a bounds. 2580 2581 \param pointArray An array of points that specify the vertices of the polygon. 2582 \param numPoints The number of points in \a pointArray. 2583 \param bounds The smallest rectangle that encloses the points in \a pointArray. 2584 \param closed Whether or not the last line of the polygon should intersect 2585 with the initial point. 2586 \param pattern One of the following: 2587 - \c B_SOLID_HIGH 2588 - \c B_SOLID_LOW 2589 - \c B_MIXED_COLORS 2590*/ 2591 2592 2593/*! 2594 \fn void BView::FillPolygon(const BPolygon* polygon, ::pattern pattern) 2595 \brief Fill a polygon shape. 2596 2597 \param polygon The polygon shape to fill. 2598 \param pattern One of the following: 2599 - \c B_SOLID_HIGH 2600 - \c B_SOLID_LOW 2601 - \c B_MIXED_COLORS 2602*/ 2603 2604 2605/*! 2606 \fn void BView::FillPolygon(const BPolygon* polygon, 2607 const BGradient& gradient) 2608 \brief Fill a polygon shape with the specified \a gradient pattern. 2609 2610 \param polygon The polygon shape to fill. 2611 \param gradient The gradient pattern to fill the polygon with. 2612*/ 2613 2614 2615/*! 2616 \fn void BView::FillPolygon(const BPoint* pointArray, int32 numPoints, 2617 ::pattern pattern) 2618 \brief Fill a polygon shape made up of points specified by \a pointArray. 2619 2620 \param pointArray An array of points that specify the vertices of the polygon. 2621 \param numPoints The number of points in \a pointArray. 2622 \param pattern One of the following: 2623 - \c B_SOLID_HIGH 2624 - \c B_SOLID_LOW 2625 - \c B_MIXED_COLORS 2626*/ 2627 2628 2629/*! 2630 \fn void BView::FillPolygon(const BPoint* pointArray, int32 numPoints, 2631 const BGradient& gradient) 2632 \brief Fill a polygon shape made up of points specified by \a pointArray 2633 with the specified \a gradient pattern. 2634 2635 \param pointArray An array of points that specify the vertices of the 2636 polygon. 2637 \param numPoints The number of points in \a pointArray. 2638 \param gradient The gradient pattern to fill the polygon with. 2639*/ 2640 2641 2642/*! 2643 \fn void BView::FillPolygon(const BPoint* pointArray, int32 numPoints, 2644 BRect bounds, ::pattern pattern) 2645 \brief Fill a polygon shape made up of points specified by \a pointArray 2646 inscribed by \a bounds. 2647 2648 \param pointArray An array of points that specify the vertices of the 2649 polygon. 2650 \param numPoints The number of points in \a pointArray. 2651 \param bounds The smallest rectangle that encloses the points in 2652 \a pointArray. 2653 \param pattern One of the following: 2654 - \c B_SOLID_HIGH 2655 - \c B_SOLID_LOW 2656 - \c B_MIXED_COLORS 2657*/ 2658 2659 2660/*! 2661 \fn void BView::FillPolygon(const BPoint* pointArray, int32 numPoints, 2662 BRect bounds, const BGradient& gradient) 2663 \brief Fill a polygon shape made up of points specified by \a pointArray 2664 inscribed by \a bounds with the specified \a gradient pattern. 2665 2666 \param pointArray An array of points that specify the vertices of the 2667 polygon. 2668 \param numPoints The number of points in \a pointArray. 2669 \param bounds The smallest rectangle that encloses the points in 2670 \a pointArray. 2671 \param gradient The gradient pattern to fill the polygon with. 2672*/ 2673 2674 2675/*! 2676 \fn void BView::StrokeRect(BRect rect, ::pattern pattern) 2677 \brief Stroke the rectangle specified by \a rect. 2678 2679 \param rect The rectangular area to stroke. 2680 \param pattern One of the following: 2681 - \c B_SOLID_HIGH 2682 - \c B_SOLID_LOW 2683 - \c B_MIXED_COLORS 2684*/ 2685 2686 2687/*! 2688 \fn void BView::FillRect(BRect rect, ::pattern pattern) 2689 \brief Fill the rectangle specified by \a rect. 2690 2691 \param rect The rectangular area to fill. 2692 \param pattern One of the following: 2693 - \c B_SOLID_HIGH 2694 - \c B_SOLID_LOW 2695 - \c B_MIXED_COLORS 2696*/ 2697 2698 2699/*! 2700 \fn void BView::FillRect(BRect rect, const BGradient& gradient) 2701 \brief Fill the rectangle specified by \a rect with the specified 2702 \a gradient pattern. 2703 2704 \param rect The rectangular area to fill. 2705 \param gradient The gradient pattern to fill the rectangle with. 2706*/ 2707 2708 2709/*! 2710 \fn void BView::StrokeRoundRect(BRect rect, float xRadius, float yRadius, 2711 ::pattern pattern) 2712 \brief Stroke the rounded rectangle with horizontal radius \a xRadius and 2713 vertical radius \a yRadius. 2714 2715 \param rect The rectangular area to stroke the round rect within. 2716 \param xRadius The horizontal radius. 2717 \param yRadius The vertical radius. 2718 \param pattern One of the following: 2719 - \c B_SOLID_HIGH 2720 - \c B_SOLID_LOW 2721 - \c B_MIXED_COLORS 2722*/ 2723 2724 2725/*! 2726 \fn void BView::FillRoundRect(BRect rect, float xRadius, float yRadius, 2727 ::pattern pattern) 2728 \brief Fill the rounded rectangle with horizontal radius \a xRadius and 2729 vertical radius \a yRadius. 2730 2731 \param rect The rectangular area to fill the round rect within. 2732 \param xRadius The horizontal radius. 2733 \param yRadius The vertical radius. 2734 \param pattern One of the following: 2735 - \c B_SOLID_HIGH 2736 - \c B_SOLID_LOW 2737 - \c B_MIXED_COLORS 2738*/ 2739 2740 2741/*! 2742 \fn void BView::FillRoundRect(BRect rect, float xRadius, float yRadius, 2743 const BGradient& gradient) 2744 \brief Fill the rounded rectangle with horizontal radius \a xRadius and 2745 vertical radius \a yRadius with the specified \a gradient pattern. 2746 2747 \param rect The rectangular area to fill the round rect within. 2748 \param xRadius The horizontal radius. 2749 \param yRadius The vertical radius. 2750 \param gradient The gradient pattern to fill the round rect with. 2751*/ 2752 2753 2754/*! 2755 \fn void BView::FillRegion(BRegion* region, ::pattern pattern) 2756 \brief Fill \a region. 2757 2758 \param region The \a region to fill. 2759 \param pattern One of the following: 2760 - \c B_SOLID_HIGH 2761 - \c B_SOLID_LOW 2762 - \c B_MIXED_COLORS 2763*/ 2764 2765 2766/*! 2767 \fn void BView::FillRegion(BRegion* region, const BGradient& gradient) 2768 \brief Fill \a region with the specified \a gradient pattern. 2769 2770 \param region The \a region to fill. 2771 \param gradient The gradient pattern to fill the \a region with. 2772*/ 2773 2774 2775/*! 2776 \fn void BView::StrokeTriangle(BPoint point1, BPoint point2, BPoint point3, 2777 BRect bounds, ::pattern pattern) 2778 \brief Stroke the triangle specified by points \a point1, \a point2, and 2779 \a point3 and enclosed by \a bounds. 2780 2781 \param point1 The first point of the triangle. 2782 \param point2 The second point of the triangle. 2783 \param point3 The third point of the triangle. 2784 \param bounds The rectangular area that encloses the triangle. 2785 \param pattern One of the following: 2786 - \c B_SOLID_HIGH 2787 - \c B_SOLID_LOW 2788 - \c B_MIXED_COLORS 2789*/ 2790 2791 2792/*! 2793 \fn void BView::StrokeTriangle(BPoint point1, BPoint point2, BPoint point3, 2794 ::pattern pattern) 2795 \brief Stroke the triangle specified by points \a point1, \a point2, 2796 and \a point3. 2797 2798 \param point1 The first point of the triangle. 2799 \param point2 The second point of the triangle. 2800 \param point3 The third point of the triangle. 2801 \param pattern One of the following: 2802 - \c B_SOLID_HIGH 2803 - \c B_SOLID_LOW 2804 - \c B_MIXED_COLORS 2805*/ 2806 2807 2808/*! 2809 \fn void BView::FillTriangle(BPoint point1, BPoint point2, BPoint point3, 2810 ::pattern pattern) 2811 \brief Fill the triangle specified by points \a point1, \a point2, 2812 and \a point3. 2813 2814 \param point1 The first point of the triangle. 2815 \param point2 The second point of the triangle. 2816 \param point3 The third point of the triangle. 2817 \param pattern One of the following: 2818 - \c B_SOLID_HIGH 2819 - \c B_SOLID_LOW 2820 - \c B_MIXED_COLORS 2821*/ 2822 2823 2824/*! 2825 \fn void BView::FillTriangle(BPoint point1, BPoint point2, BPoint point3, 2826 const BGradient& gradient) 2827 \brief Fill the triangle specified by points \a point1, \a point2, 2828 and \a point3 with the specified \a gradient pattern. 2829 2830 \param point1 The first point of the triangle. 2831 \param point2 The second point of the triangle. 2832 \param point3 The third point of the triangle. 2833 \param gradient The gradient pattern to fill the triangle with. 2834*/ 2835 2836 2837/*! 2838 \fn void BView::FillTriangle(BPoint point1, BPoint point2, BPoint point3, 2839 BRect bounds, ::pattern pattern) 2840 \brief Fill the triangle specified by points \a point1, \a point2, 2841 and \a point3 and enclosed by \a bounds. 2842 2843 \param point1 The first point of the triangle. 2844 \param point2 The second point of the triangle. 2845 \param point3 The third point of the triangle. 2846 \param bounds The rectangular area that encloses the triangle. 2847 \param pattern One of the following: 2848 - \c B_SOLID_HIGH 2849 - \c B_SOLID_LOW 2850 - \c B_MIXED_COLORS 2851*/ 2852 2853 2854/*! 2855 \fn void BView::FillTriangle(BPoint point1, BPoint point2, BPoint point3, 2856 BRect bounds, const BGradient& gradient) 2857 \brief Fill the triangle specified by points \a point1, \a point2, 2858 and \a point3 and enclosed by \a bounds with the specified 2859 \a gradient pattern. 2860 2861 \param point1 The first point of the triangle. 2862 \param point2 The second point of the triangle. 2863 \param point3 The third point of the triangle. 2864 \param bounds The rectangular area that encloses the triangle. 2865 \param gradient The gradient pattern to fill the triangle with. 2866*/ 2867 2868 2869/*! 2870 \fn void BView::StrokeLine(BPoint toPoint, ::pattern pattern) 2871 \brief Stroke a line from the current pen location to the point \a toPoint. 2872 2873 \param toPoint The end point of the line. 2874 \param pattern One of the following: 2875 - \c B_SOLID_HIGH 2876 - \c B_SOLID_LOW 2877 - \c B_MIXED_COLORS 2878*/ 2879 2880 2881/*! 2882 \fn void BView::StrokeLine(BPoint start, BPoint end, ::pattern pattern) 2883 \brief Stroke a line from point \a start to point \a end. 2884 2885 \param start The start point of the line. 2886 \param end The end point of the line. 2887 \param pattern One of the following: 2888 - \c B_SOLID_HIGH 2889 - \c B_SOLID_LOW 2890 - \c B_MIXED_COLORS 2891*/ 2892 2893 2894/*! 2895 \fn void BView::StrokeShape(BShape* shape, ::pattern pattern) 2896 \brief Stroke \a shape. 2897 2898 \param shape The \a shape to stroke. 2899 \param pattern One of the following: 2900 - \c B_SOLID_HIGH 2901 - \c B_SOLID_LOW 2902 - \c B_MIXED_COLORS 2903*/ 2904 2905 2906/*! 2907 \fn void BView::FillShape(BShape* shape, ::pattern pattern) 2908 \brief Fill \a shape. 2909 2910 \param shape The \a shape to fill. 2911 \param pattern One of the following: 2912 - \c B_SOLID_HIGH 2913 - \c B_SOLID_LOW 2914 - \c B_MIXED_COLORS 2915*/ 2916 2917 2918/*! 2919 \fn void BView::FillShape(BShape* shape, const BGradient& gradient) 2920 \brief Fill \a shape with the specified \a gradient pattern. 2921 2922 \param shape The \a shape to fill. 2923 \param gradient The gradient pattern to fill the \a shape with. 2924*/ 2925 2926 2927/*! 2928 \fn void BView::BeginLineArray(int32 count) 2929 \brief Begin a line array of up to \a count lines. 2930 2931 This is a more efficient way of drawing a large number of lines than calling 2932 StrokeLine() repeatedly. First call BeginLineArray() to begin drawing lines, 2933 then call AddLine() for each line you wish to draw, and finally call 2934 EndLineArray() to finish the line array and draw the lines. 2935 2936 These methods don't move the current pen location or change the high or low 2937 colors of the view. \a count should be close to the number of lines you wish 2938 to draw and should be below 256 to draw efficiently. 2939 2940 \param count The maximum number of lines in the line array to draw. 2941 2942 \see StrokeLine() 2943*/ 2944 2945 2946/*! 2947 \fn void BView::AddLine(BPoint start, BPoint end, rgb_color color); 2948 \brief Add a line to the line array from point \a pt0 to point \a pt1. 2949 2950 \param start The \a start point of the line. 2951 \param end The \a end point of the line. 2952 \param color The line \a color. 2953*/ 2954 2955 2956/*! 2957 \fn void BView::EndLineArray() 2958 \brief End the line array drawing the lines. 2959*/ 2960 2961 2962/*! 2963 \fn void BView::SetDiskMode(char* filename, long offset) 2964 \brief Unimplemented. 2965*/ 2966 2967 2968/*! 2969 \fn void BView::BeginPicture(BPicture* picture) 2970 \brief Begins sending drawing instructions to \a picture. 2971 2972 The \a BPicture object is cleared and any successive drawing instructions sent 2973 to the view are redirected to \a picture until EndPicture() is called. To 2974 append drawing instructions to a BPicture object without clearing it first 2975 call AppendToPicture() instead. 2976 2977 The view doesn't display anything to the screen while it's recording to \a 2978 picture. Use the DrawPicture() method to render the \a picture. 2979 2980 Only drawing instructions performed directly on the view, not it's child views 2981 are send to the BPicture object and BPicture captures only primitive graphics 2982 operations. The view must be attached to a window for the drawing instruction 2983 to be recorded. Drawing instructions are recorded even if the view is hidden or 2984 resides outside the clipping region or the window is off-screen. 2985 2986 \param picture The BPicture object to record drawing instructions to. 2987*/ 2988 2989 2990/*! 2991 \fn void BView::AppendToPicture(BPicture* picture) 2992 \brief Appends drawing instructions to \a picture without clearing it first. 2993 2994 \param picture The BPicture object to record drawing instructions to. 2995*/ 2996 2997 2998/*! 2999 \fn BPicture* BView::EndPicture() 3000 \brief Ends the drawing instruction recording session and returns the 3001 BPicture object passed to BeginPicture() or AppendToPicture(). 3002 3003 \return The BPicture object passed to BeginPicture() or AppendToPicture(). 3004*/ 3005 3006 3007/*! 3008 \fn void BView::SetViewBitmap(const BBitmap* bitmap, BRect srcRect, 3009 BRect dstRect, uint32 followFlags, uint32 options) 3010 \brief Sets the background \a bitmap of the view. 3011 3012 All drawing to the view occurs over \a bitmap. Any visible regions not 3013 covered by \a bitmap are filled with the current background color. 3014 3015 Once \a bitmap has been passed in and this method returns the caller may 3016 safely delete the object. 3017 3018 \param bitmap The background bitmap to set to the view. 3019 \param srcRect Specifies the area of \a bitmap to use. 3020 \param dstRect Specifies the area of the view to set \a bitmap to. 3021 \param followFlags Specifies the as the view is resized. See the BView 3022 constructor for more details. 3023 \param options Specifies additional view options. The only option currently 3024 available is \c B_TILE_BITMAP which tiles the bitmap across the view. 3025*/ 3026 3027 3028/*! 3029 \fn void BView::SetViewBitmap(const BBitmap* bitmap, uint32 followFlags, 3030 uint32 options) 3031 \brief Sets the background \a bitmap of the view. 3032 3033 All drawing to the view occurs over \a bitmap. Any visible regions not 3034 covered by \a bitmap are filled with the current background color. 3035 3036 Once \a bitmap has been passed in and this method returns the caller may 3037 safely delete the object. 3038 3039 \param bitmap The background bitmap to set to the view. 3040 \param followFlags Specifies the as the view is resized. See the BView 3041 constructor for more details. 3042 \param options Specifies additional view options. The only option currently 3043 available is \c B_TILE_BITMAP which tiles the bitmap across the view. 3044*/ 3045 3046 3047/*! 3048 \fn void BView::ClearViewBitmap() 3049 \brief Clears the background bitmap of the view if it has one. 3050*/ 3051 3052 3053/*! 3054 \fn status_t BView::SetViewOverlay(const BBitmap* overlay, BRect srcRect, 3055 BRect dstRect, rgb_color* colorKey, uint32 followFlags, uint32 options) 3056 \brief Sets the \a overlay bitmap of the view. 3057 3058 \a colorKey specifies which color pixels in \a overlay are treated as transparent 3059 allowing the pixels of the view to show through. 3060 3061 Once \a overlay has been passed in and this method returns the caller may 3062 safely delete the object. 3063 3064 \param overlay The overlay bitmap to set to the view. 3065 \param srcRect Specifies the area of \a overlay to use. 3066 \param dstRect Specifies the area of the view to set \a overlay to. 3067 \param colorKey The color in \a overlay to treat as transparent. 3068 \param followFlags Specifies the as the view is resized. See the BView 3069 constructor for more details. 3070 \param options Specifies additional view options. The only option currently 3071 available is \c B_TILE_BITMAP which tiles the bitmap across the view. 3072*/ 3073 3074 3075/*! 3076 \fn status_t BView::SetViewOverlay(const BBitmap* overlay, 3077 rgb_color* colorKey, uint32 followFlags, uint32 options) 3078 \brief Sets the \a overlay bitmap of the view. 3079 3080 \a colorKey specifies which color pixels in \a overlay are treated as transparent 3081 allowing the pixels of the view to show through. 3082 3083 Once \a overlay has been passed in and this method returns the caller may 3084 safely delete the object. 3085 3086 \param overlay The overlay bitmap to set to the view. 3087 \param colorKey The color in \a overlay to treat as transparent. 3088 \param followFlags Specifies the as the view is resized. See the BView 3089 constructor for more details. 3090 \param options Specifies additional view options. The only option currently 3091 available is \c B_TILE_BITMAP which tiles the bitmap across the view. 3092*/ 3093 3094 3095/*! 3096 \fn void BView::ClearViewOverlay() 3097 \brief Clears the overlay bitmap of the view if it has one. 3098*/ 3099 3100 3101/*! 3102 \fn void BView::CopyBits(BRect src, BRect dst) 3103 \brief Copy the bits from the \a src rectangle to the \a dst rectangle in the 3104 view's coordinate system. 3105 3106 If the rectangles are of different sizes than \a src is scaled to fit. \a src 3107 is clipped if a part of \a dst lies outside of the visible region of the view. 3108 Only the visible portions of \a src are copied. 3109 3110 The view must be attached to a window for this method to work. 3111 3112 \param src The source rectangle to copy bits from. 3113 \param dst The destination rectangle to copy bits to. 3114*/ 3115 3116 3117/*! 3118 \fn void BView::DrawPicture(const BPicture* picture) 3119 \brief Draws the \a picture at the view's current pen position. 3120 3121 \param picture The BPicture object to draw. 3122*/ 3123 3124 3125/*! 3126 \fn void BView::DrawPicture(const BPicture* picture, BPoint where) 3127 \brief Draws the \a picture at the location in the view specified by \a where. 3128 3129 \param picture The BPicture object to draw. 3130 \param where The point on the view to draw \a picture. 3131*/ 3132 3133 3134/*! 3135 \fn void BView::DrawPicture(const char* filename, long offset, BPoint where) 3136 \brief Draws the \a picture from the file specified by \a filename offset by 3137 \a offset bytes at the location in the view specified by \a where. 3138 3139 \param filename The filename of the file containing the picture to draw. 3140 \param where The point on the view to draw the picture. 3141 \param offset The number of bytes to offset in the file to find the picture. 3142*/ 3143 3144 3145/*! 3146 \fn void BView::DrawPictureAsync(const BPicture* picture) 3147 \brief Draws the \a picture at the view's current pen position. 3148 3149 \param picture The BPicture object to draw. 3150*/ 3151 3152 3153/*! 3154 \fn void BView::DrawPictureAsync(const BPicture* picture, BPoint where) 3155 \brief Draws the \a picture at the location in the view specified by \a where. 3156 3157 \param picture The BPicture object to draw. 3158 \param where The point on the view to draw \a picture. 3159*/ 3160 3161 3162/*! 3163 \fn void BView::DrawPictureAsync(const char* filename, long offset, BPoint where) 3164 \brief Draws the \a picture from the file specified by \a filename offset by 3165 \a offset bytes at the location in the view specified by \a where. 3166 3167 \param filename The filename of the file containing the picture to draw. 3168 \param where The point on the view to draw the picture. 3169 \param offset The number of bytes to offset in the file to find the picture. 3170*/ 3171 3172 3173/*! 3174 \fn void BView::Invalidate(BRect invalRect) 3175 \brief Sends a message to App Server to redraw the portion of the view 3176 specified by \a invalRect. 3177 3178 \param invalRect The rectangular area of the view to redraw. 3179*/ 3180 3181 3182/*! 3183 \fn void BView::Invalidate(const BRegion* region) 3184 \brief Sends a message to App Server to redraw the portion of the view 3185 specified by \a region. 3186 3187 \param region The region of the view to redraw. 3188*/ 3189 3190 3191/*! 3192 \fn void BView::Invalidate() 3193 \brief Sends a message to App Server to redraw the view. 3194*/ 3195 3196 3197/*! 3198 \fn void BView::InvertRect(BRect rect) 3199 \brief Inverts the colors within \a rect. 3200 3201 This method is often used to draw a highlighted selection in a view. 3202 3203 \param rect The rectangular area in the view to invert the colors of. 3204*/ 3205 3206 3207//! @} 3208 3209 3210/*! 3211 \name View Hierarchy Methods 3212*/ 3213 3214 3215//! @{ 3216 3217 3218/*! 3219 \fn void BView::AddChild(BView* child, BView* before) 3220 \brief Adds \a child to the view hierarchy immediately before \a before. 3221 3222 A view may only have one parent at a time so \a child must not have already 3223 been added to the view hierarchy. if \a before \c NULL then \a child is added 3224 to the end of the tree. If the view is attached to a window \a child and all 3225 of its descendent views also become attached to the window invoking an 3226 AttachedToWindow() method on each view. 3227 3228 \param child The child view to add. 3229 \param before The sibling view to add \a child before. 3230*/ 3231 3232 3233/*! 3234 \fn bool BView::AddChild(BLayoutItem* child) 3235 \brief Add the \a child layout item to the view hierarchy. 3236 3237 \param child The child layout item to add. 3238 \return Whether or not \a child was added to the view layout hierarchy. 3239*/ 3240 3241 3242/*! 3243 \fn bool BView::RemoveChild(BView* child) 3244 \brief Removes \a child from the view hierarchy. 3245 3246 \param child The child view to remove. 3247 \return Whether or not \a child was removed from the view hierarchy. 3248*/ 3249 3250 3251/*! 3252 \fn int32 BView::CountChildren() const 3253 \brief Returns the number of child views that this view has. 3254 3255 \return The number of child views. 3256*/ 3257 3258 3259/*! 3260 \fn BView* BView::ChildAt(int32 index) const 3261 \brief Returns a pointer to the child view found at \a index. 3262 3263 \param index The index of the child view to return a pointer of. 3264 3265 \return A pointer to the child view at \a index or \c NULL if not found. 3266*/ 3267 3268 3269/*! 3270 \fn BView* BView::NextSibling() const 3271 \brief Returns a pointer to the next sibling view. 3272 3273 \return A pointer to the next sibling view or \a NULL if not found. 3274*/ 3275 3276 3277/*! 3278 \fn BView* BView::PreviousSibling() const 3279 \brief Returns a pointer to the previous sibling view. 3280 3281 \return A pointer to the previous sibling view or \a NULL if not found. 3282*/ 3283 3284 3285/*! 3286 \fn bool BView::RemoveSelf() 3287 \brief Removes the view and all child views from the view hierarchy. 3288 3289 \returns Whether or not the view was removed from the view hierarchy. 3290*/ 3291 3292 3293/*! 3294 \fn BView* BView::Parent() const 3295 \brief Returns a pointer to the view's parent. 3296 3297 \return A pointer to the parent view or \c NULL if not attached. 3298*/ 3299 3300 3301/*! 3302 \fn BView* BView::FindView(const char* name) const 3303 \brief Returns the view in the view hierarchy with the specified \a name. 3304 3305 \return The view in the view hierarchy with the specified \a name or \c NULL 3306 if not found. 3307*/ 3308 3309 3310//! @} 3311 3312 3313/*! 3314 \name View Frame Alteration Methods 3315 3316 As a view's frame rectangle must be aligned to pixel values all parameters are 3317 rounded to the nearest integer. If the view isn't attached these methods alter the 3318 frame rectangle without triggering FrameMoved(), FrameResized() or Invalidate(). 3319*/ 3320 3321 3322//! @{ 3323 3324 3325/*! 3326 \fn void BView::MoveBy(float deltaX, float deltaY) 3327 \brief Moves the view \a deltaX pixels horizontally and \a deltaY pixels 3328 vertically in the parent view's coordinate system. 3329 3330 \param deltaX The number of pixels to move the view horizontally. 3331 \param deltaY The number of pixels to move the view vertically. 3332*/ 3333 3334 3335/*! 3336 \fn void BView::MoveTo(BPoint where) 3337 \brief Move the view to the location specified by \a where in the parent 3338 view's coordinate system. 3339 3340 \param where The location to move the view to. 3341*/ 3342 3343 3344/*! 3345 \fn void BView::MoveTo(float x, float y) 3346 \brief Move the view to the coordinates specified by \a x in the horizontal 3347 dimension and \a y in the vertical dimension in the parent view's 3348 coordinate system. 3349 3350 \param x The horizontal coordinate to move the view to. 3351 \param y The vertical coordinate to move the view to. 3352*/ 3353 3354 3355/*! 3356 \fn void BView::ResizeBy(float deltaWidth, float deltaHeight) 3357 \brief Resize the view by \a deltaWidth horizontally and \a deltaHeight 3358 vertically without moving the top left corner of the view. 3359 3360 \param deltaWidth The number of pixels to resize the view by horizontally. 3361 \param deltaHeight The number of pixels to resize the view by vertically. 3362*/ 3363 3364 3365/*! 3366 \fn void BView::ResizeTo(float width, float height) 3367 \brief Resize the view to the specified \a width and \a height. 3368 3369 \param width The width to resize the view to. 3370 \param height The height to resize the view to. 3371*/ 3372 3373 3374/*! 3375 \fn void BView::ResizeTo(BSize size) 3376 \brief Resize the view to the dimension specified by \a size. 3377 3378 \param size The \a size to resize the view to. 3379*/ 3380 3381 3382//! @} 3383 3384 3385/*! 3386 \fn status_t BView::GetSupportedSuites(BMessage* data) 3387 \brief Reports the suites of messages and specifiers understood by the view. 3388 3389 \param data The message to use to report the suite of messages and specifiers. 3390 3391 \see BHandler::GetSupportedSuites() 3392*/ 3393 3394 3395/*! 3396 \fn BHandler* BView::ResolveSpecifier(BMessage* message, int32 index, 3397 BMessage* specifier, int32 what, const char* property) 3398 \brief Determine the proper handler for a scripting message. 3399 3400 \see BHandler::ResolveSpecifier() 3401*/ 3402 3403 3404/*! 3405 \fn status_t BView::Perform(perform_code code, void* _data) 3406 \brief Perform some action. (Internal Method) 3407 3408 The following perform codes are recognized: 3409 - \c PERFORM_CODE_MIN_SIZE: 3410 - \c PERFORM_CODE_MAX_SIZE: 3411 - \c PERFORM_CODE_PREFERRED_SIZE: 3412 - \c PERFORM_CODE_LAYOUT_ALIGNMENT: 3413 - \c PERFORM_CODE_HAS_HEIGHT_FOR_WIDTH: 3414 - \c PERFORM_CODE_GET_HEIGHT_FOR_WIDTH: 3415 - \c PERFORM_CODE_SET_LAYOUT: 3416 - \c PERFORM_CODE_INVALIDATE_LAYOUT: 3417 - \c PERFORM_CODE_DO_LAYOUT: 3418 - \c PERFORM_CODE_GET_TOOL_TIP_AT: 3419 - \c PERFORM_CODE_ALL_UNARCHIVED: 3420 - \c PERFORM_CODE_ALL_ARCHIVED: 3421 3422 \param code The perform code. 3423 \param _data A pointer to store some data. 3424 3425 \returns A status code. 3426 3427 \sa BHandler::Perform() 3428*/ 3429 3430 3431/*! 3432 \name Layout Methods 3433 3434 \note These methods were not available in BeOS R5. 3435*/ 3436 3437 3438//! @{ 3439 3440 3441/*! 3442 \fn BSize BView::MinSize() 3443 \brief Get the minimum size of the view. 3444 3445 \return The minimum size of the view as a BSize. 3446 3447 \sa BAbstractLayout::MinSize() 3448*/ 3449 3450 3451/*! 3452 \fn BSize BView::MaxSize() 3453 \brief Get the maximum size of the view. 3454 3455 \return The maximum size of the view as a BSize. 3456 3457 \sa BAbstractLayout::MaxSize() 3458*/ 3459 3460 3461/*! 3462 \fn BSize BView::PreferredSize() 3463 \brief Get the preferred size of the view. 3464 3465 \return The preferred size of the view as a BSize. 3466 3467 \sa BAbstractLayout::PreferredSize() 3468*/ 3469 3470 3471/*! 3472 \fn void BView::SetExplicitMinSize(BSize size) 3473 \brief Set this item's explicit min size, to be used by MinSize(). 3474 3475 \sa BAbstractLayout::SetExplicitMinSize() 3476*/ 3477 3478 3479/*! 3480 \fn void BView::SetExplicitMaxSize(BSize size) 3481 \brief Set this item's explicit max size, to be used by MaxSize(). 3482 3483 \sa BAbstractLayout::SetExplicitMaxSize() 3484*/ 3485 3486 3487/*! 3488 \fn void BView::SetExplicitPreferredSize(BSize size) 3489 \brief Set this item's explicit preferred size, to be used by 3490 PreferredSize(). 3491 3492 \sa BAbstractLayout::SetExplicitPreferredSize() 3493*/ 3494 3495 3496/*! 3497 \fn void BView::SetExplicitAlignment(BAlignment alignment) 3498 \brief Set this item's explicit alignment, to be used by Alignment(). 3499 3500 \sa BAbstractLayout::SetExplicitAlignment() 3501*/ 3502 3503 3504/*! 3505 \fn void BView::SetLayout(BLayout* layout) 3506 \brief Sets the \a layout of the view. 3507 3508 \param layout The \a layout to set. 3509*/ 3510 3511 3512/*! 3513 \fn BLayout* BView::GetLayout() const 3514 \brief Get the layout of the view. 3515 3516 \returns The layout of the view. 3517*/ 3518 3519 3520/*! 3521 \fn void BView::InvalidateLayout(bool descendants) 3522 \brief Invalidate layout. 3523 3524 \param descendants Also invalidate its children views. 3525*/ 3526 3527 3528/*! 3529 \fn void BView::EnableLayoutInvalidation() 3530 \brief Enable layout invalidation. 3531*/ 3532 3533 3534/*! 3535 \fn void BView::DisableLayoutInvalidation() 3536 \brief Disable layout invalidation. 3537*/ 3538 3539 3540/*! 3541 \fn bool BView::IsLayoutInvalidationDisabled() 3542 \brief Returns whether or not layout invalidation is disabled. 3543 3544 \return \c true of layout invalidation is disabled, \c false otherwise. 3545*/ 3546 3547 3548/*! 3549 \fn bool BView::IsLayoutValid() const 3550 \brief Returns whether or not the layout is valid. 3551 3552 \brief Returns \c true if the layout is valid, \c false otherwise. 3553*/ 3554 3555 3556/*! 3557 \fn void BView::ResetLayoutInvalidation() 3558 \brief Service call for BView derived classes re-enabling 3559 InvalidateLayout() notifications. 3560 3561 BLayout and BView will avoid calling InvalidateLayout on views that have 3562 already been invalidated, but if the view caches internal layout information 3563 which it updates in methods other than DoLayout(), it has to invoke this 3564 method, when it has done so, since otherwise the information might become 3565 obsolete without the layout noticing. 3566*/ 3567 3568 3569/*! 3570 \fn void BView::Layout(bool force) 3571 \brief Layout the view. 3572 3573 \param force If \c true layout even if valid. 3574*/ 3575 3576 3577/*! 3578 \fn void BView::Relayout() 3579 \brief Relayout the view. 3580*/ 3581 3582 3583/*! 3584 \fn void BView::DoLayout() 3585 \brief Layout view within the layout context. 3586*/ 3587 3588 3589//! @} 3590 3591 3592/*! 3593 \name Tool Tip Methods 3594 3595 \note These methods were not available in BeOS R5. 3596*/ 3597 3598 3599//! @{ 3600 3601 3602/*! 3603 \fn void BView::SetToolTip(const char* text) 3604 \brief Set the tool tip of the view to \a text. 3605 3606 \param text The \a text to set the view to or \c NULL or blank to unset. 3607*/ 3608 3609 3610/*! 3611 \fn void BView::SetToolTip(BToolTip* tip) 3612 \brief Set the tool tip of the view to the \a tip object. 3613 3614 \param tip The tool tip object to set the view to or \c NULL to unset. 3615*/ 3616 3617 3618/*! 3619 \fn BToolTip* BView::ToolTip() const 3620 \brief Return the tool tip set to the view or \c NULL if not set. 3621 3622 \return The BToolTip object set to the view. 3623*/ 3624 3625 3626/*! 3627 \fn void BView::ShowToolTip(BToolTip* tip) 3628 \brief Show the tool tip at the current mouse position. 3629 3630 \param tip The BToolTip object to show. 3631*/ 3632 3633 3634/*! 3635 \fn void BView::HideToolTip() 3636 \brief Hide the view's tool tip. 3637*/ 3638 3639 3640/*! 3641 \fn bool BView::GetToolTipAt(BPoint point, BToolTip** _tip) 3642 \brief Point \a _tip with the view's tool tip. 3643 3644 \param point Currently unused. 3645 \param _tip A pointer to a pointer to a BToolTip object to set. 3646*/ 3647 3648 3649//! @} 3650