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