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