1/* 2 * Copyright 2011-2015 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/Window.h hrev497** 11 * src/kits/interface/Window.cpp hrev497** 12 */ 13 14 15/*! 16 \file Window.h 17 \ingroup interface 18 \ingroup libbe 19 \brief BWindow class definition and support data structures. 20*/ 21 22 23// window_type 24 25 26/*! 27 \enum window_type 28 \ingroup interface 29 30 Combined window look and feel constants. Define both the appearance and 31 behavior of a window. 32 33 \since BeOS R3 34*/ 35 36 37/*! 38 \var window_type B_UNTYPED_WINDOW 39 40 A window of unknown or undefined type. 41 42 \since BeOS R3 43*/ 44 45 46/*! 47 \var window_type B_TITLED_WINDOW 48 49 \c B_TITLED_WINDOW_LOOK and \c B_NORMAL_WINDOW_FEEL. 50 51 \since BeOS R3 52*/ 53 54 55/*! 56 \var window_type B_MODAL_WINDOW 57 58 \c B_MODAL_WINDOW_LOOK and \c B_MODAL_APP_WINDOW_FEEL. 59 60 \since BeOS R3 61*/ 62 63 64/*! 65 \var window_type B_DOCUMENT_WINDOW 66 67 \c B_DOCUMENT_WINDOW_LOOK and \c B_NORMAL_WINDOW_FEEL. 68 69 \since BeOS R3 70*/ 71 72 73/*! 74 \var window_type B_BORDERED_WINDOW 75 76 \c B_BORDERED_WINDOW_LOOK and \c B_NORMAL_WINDOW_FEEL. 77 78 \since BeOS R3 79*/ 80 81 82/*! 83 \var window_type B_FLOATING_WINDOW 84 85 \c B_FLOATING_WINDOW_LOOK and \c B_FLOATING_APP_WINDOW_FEEL. 86 87 \since BeOS R3 88*/ 89 90 91// window_look 92 93 94/*! 95 \enum window_look 96 \ingroup interface 97 98 Window look constants, define window appearance. 99 100 \since BeOS R3 101*/ 102 103 104/*! 105 \var window_look B_BORDERED_WINDOW_LOOK 106 107 No title bar, thin border, no resize control. 108 109 \since BeOS R3 110*/ 111 112 113/*! 114 \var window_look B_NO_BORDER_WINDOW_LOOK 115 116 A borderless rectangle with no provisions to move or close the window. 117 118 \since BeOS R5 119*/ 120 121 122/*! 123 \var window_look B_TITLED_WINDOW_LOOK 124 125 Like \c B_DOCUMENT_WINDOW_LOOK, but with a resize corner instead of a resize 126 thumb. 127 128 \since BeOS R3 129*/ 130 131 132/*! 133 \var window_look B_DOCUMENT_WINDOW_LOOK 134 135 Large title bar, thick border, draggable resize corner thumb. 136 137 \since BeOS R3 138*/ 139 140 141/*! 142 \var window_look B_MODAL_WINDOW_LOOK 143 144 For modal dialogs: no title bar, thick border, resize corner depending on the 145 \c B_NOT_RESIZABLE flag. 146 147 \since BeOS R3 148*/ 149 150 151/*! 152 \var window_look B_FLOATING_WINDOW_LOOK 153 154 For floating sub windows: small title bar, thin border, resize corner. 155 156 \since BeOS R3 157*/ 158 159 160// window_feel 161 162 163/*! 164 \enum window_feel 165 \ingroup interface 166 167 Window feel constants, define window behavior. 168 169 \since BeOS R3 170*/ 171 172 173/*! 174 \var window_feel B_NORMAL_WINDOW_FEEL 175 176 Behaves like a normal, non-modal, non-floating window. 177 178 \since BeOS R3 179*/ 180 181 182/*! 183 \var window_feel B_MODAL_SUBSET_WINDOW_FEEL 184 185 Blocks all windows in its subset when displayed. Visible only if a window in 186 its subset is visible. 187 188 \since BeOS R3 189*/ 190 191 192/*! 193 \var window_feel B_MODAL_APP_WINDOW_FEEL 194 195 Blocks all windows in its app when displayed. Visible only if a window in its 196 app is visible. 197 198 \since BeOS R3 199*/ 200 201 202/*! 203 \var window_feel B_MODAL_ALL_WINDOW_FEEL 204 205 Blocks all windows across the entire system when displayed. Always visible 206 in all workspaces. 207 208 \since BeOS R3 209*/ 210 211 212/*! 213 \var window_feel B_FLOATING_SUBSET_WINDOW_FEEL 214 215 Floats above all windows in its subset when displayed. Visible only if a 216 window in its subset is the frontmost window. 217 218 \since BeOS R3 219*/ 220 221 222/*! 223 \var window_feel B_FLOATING_APP_WINDOW_FEEL 224 225 Floats above all windows in its app when displayed. Visible only if a 226 window in its app is the frontmost window. 227 228 \since BeOS R3 229*/ 230 231 232/*! 233 \var window_feel B_FLOATING_ALL_WINDOW_FEEL 234 235 Floats above all windows across the entire system when displayed. Always 236 visible in all workspaces. 237 238 \since BeOS R3 239*/ 240 241 242// window_alignment 243 244 245/*! 246 \enum window_alignment 247 \ingroup interface 248 249 Define window alignment. 250 251 \since BeOS R3 252*/ 253 254 255/*! 256 \var window_alignment B_BYTE_ALIGNMENT 257 258 Aligns window in terms of frame buffer offsets. Affects only horizontal 259 origin and width, can't align right and bottom edges in this mode. 260 261 \since BeOS R3 262*/ 263 264 265/*! 266 \var window_alignment B_PIXEL_ALIGNMENT 267 268 Aligns window in pixel coordinates. 269 270 \since BeOS R3 271*/ 272 273 274// window flags 275 276 277/*! 278 \var B_NOT_MOVABLE 279 280 Window cannot be moved by the user. 281 282 \since BeOS R3 283*/ 284 285 286/*! 287 \var B_NOT_CLOSABLE 288 289 Window cannot be closed by the user, no close button is displayed. 290 291 \since BeOS R3 292*/ 293 294 295/*! 296 \var B_NOT_ZOOMABLE 297 298 Window cannot be zoomed by the user, no zoom button is displayed. 299 300 \since BeOS R3 301*/ 302 303 304/*! 305 \var B_NOT_MINIMIZABLE 306 307 Window cannot be minimized by the user. 308 309 \since BeOS R3 310*/ 311 312 313/*! 314 \var B_NOT_RESIZABLE 315 316 Window cannot be resized by the user. 317 318 \since BeOS R3 319*/ 320 321 322/*! 323 \var B_NOT_H_RESIZABLE 324 325 Window cannot be resized horizontally by the user. 326 327 \since BeOS R3 328*/ 329 330 331/*! 332 \var B_NOT_V_RESIZABLE 333 334 Window cannot be resized vertically by the user. 335 336 \since BeOS R3 337*/ 338 339 340/*! 341 \var B_AVOID_FRONT 342 343 Window cannot be brought to front. 344 345 \since BeOS R3 346*/ 347 348 349/*! 350 \var B_AVOID_FOCUS 351 352 Window cannot receive keyboard focus. 353 354 \since BeOS R3 355*/ 356 357 358/*! 359 \var B_WILL_ACCEPT_FIRST_CLICK 360 361 The first click will not just bring the window to front, it will also be 362 processed by the window. 363 364 \since BeOS R3 365*/ 366 367 368/*! 369 \var B_OUTLINE_RESIZE 370 371 Window draws only it's outline as it's resized and doesn't draw its 372 contents. 373 374 \since BeOS R3 375*/ 376 377 378/*! 379 \var B_NO_WORKSPACE_ACTIVATION 380 381 Causes the current workspace to stay active even if the window is activated 382 on another workspace. 383 384 \since BeOS R3 385*/ 386 387 388/*! 389 \var B_NOT_ANCHORED_ON_ACTIVATE 390 391 Causes the window to move to the current workspace when activated if it already 392 exists on another workspace. 393 394 \since BeOS R3 395*/ 396 397 398/*! 399 \var B_QUIT_ON_WINDOW_CLOSE 400 401 Quit the application when the window closes. 402 403 \note This flag existed but didn't function in BeOS R5. 404 405 \since BeOS R5 406*/ 407 408 409/*! 410 \var B_SAME_POSITION_IN_ALL_WORKSPACES 411 412 Window maintains its position across workspaces. 413 414 \note This flag did not exist in BeOS R5. 415 416 \since Haiku R1 417*/ 418 419 420/*! 421 \var B_AUTO_UPDATE_SIZE_LIMITS 422 423 Automatically adjust the window size according to the layout constraints. 424 425 \note This flag did not exist in BeOS R5. 426 427 \since Haiku R1 428*/ 429 430 431/*! 432 \var B_CLOSE_ON_ESCAPE 433 434 Close the window when the user pushes the Escape key. 435 436 \note This flag did not exist in BeOS R5. 437 438 \since Haiku R1 439*/ 440 441 442/*! 443 \var B_NO_SERVER_SIDE_WINDOW_MODIFIERS 444 445 \since Haiku R1 446*/ 447 448 449// workspace constants 450 451 452/*! 453 \def B_CURRENT_WORKSPACE 454 455 Applies to current workspace only. 456 457 \since BeOS R3 458*/ 459 460 461/*! 462 \def B_ALL_WORKSPACES 463 464 Applies to all workspaces. 465 466 \since BeOS R3 467*/ 468 469 470/*! 471 \class BWindow 472 \ingroup interface 473 \ingroup libbe 474 \brief Window base class. 475 476 A BWindow is an on-screen window which contains views and is the target of 477 keyboard and mouse events. A BWindow instance is nearly always subclassed. 478 479 BWindow draws by talking to App Server. If you want draw directly into the 480 graphics card by-passing App Server, you need to use a BDirectWindow or 481 BWindowScreen. 482 483 Despite the fact that BWindow inherits from BLooper, you should not invoke 484 Run() on a BWindow, instead, call Show() to get the message loop started and 485 show the window on screen. Once you've called Show() you may remove a window 486 from the screen without interrupting the message loop by calling Hide(). Other 487 message loop details such as locking and quitting are detailed in the BLooper 488 class. 489 490 BWindow has the following built-in shortcuts: 491 492 <table> 493 <tr> 494 <th>Shortcut</th> 495 <th>Action</th> 496 <th>Handler</th> 497 </tr> 498 <tr> 499 <td>\key{Command}+\key{X}</td> 500 <td>Cut</td> 501 <td>Focus view</td> 502 </tr> 503 <tr> 504 <td>\key{Command}+\key{C}</td> 505 <td>Copy</td> 506 <td>Focus view</td> 507 </tr> 508 <tr> 509 <td>\key{Command}+\key{V}</td> 510 <td>Paste</td> 511 <td>Focus view</td> 512 </tr> 513 <tr> 514 <td>\key{Command}+\key{A}</td> 515 <td>Select All</td> 516 <td>Focus view</td> 517 </tr> 518 <tr> 519 <td>\key{Command}+\key{W}</td> 520 <td>Close</td> 521 <td>Window (if closable)</td> 522 </tr> 523 <tr> 524 <td>\key{Command}+\key{Q}</td> 525 <td>Quit</td> 526 <td>Application (non-modal windows only)</td> 527 </tr> 528 <tr> 529 <td>\key{Command}+\key{Control}+\key{M}</td> 530 <td>Minimize</td> 531 <td>Window (if minimizable)</td> 532 </tr> 533 <tr> 534 <td>\key{Command}+\key{Control}+\key{Z}</td> 535 <td>Zoom</td> 536 <td>Window (if zoomable)</td> 537 </tr> 538 <tr> 539 <td>\key{Command}+\key{Control}+\key{H}</td> 540 <td>Hide</td> 541 <td>Window</td> 542 </tr> 543 <tr> 544 <td>\key{Command}+\key{Control}+\key{F}</td> 545 <td>Send to front</td> 546 <td>Window</td> 547 </tr> 548 <tr> 549 <td>\key{Command}+\key{Control}+\key{B}</td> 550 <td>Send behind</td> 551 <td>Window</td> 552 </tr> 553 <tr> 554 <td>\key{Command}+\key{Control}+\key{←}</td> 555 <td>Go to left workspace</td> 556 <td>Desktop window</td> 557 </tr> 558 <tr> 559 <td>\key{Command}+\key{Control}+\key{→}</td> 560 <td>Go to right workspace</td> 561 <td>Desktop window</td> 562 </tr> 563 <tr> 564 <td>\key{Command}+\key{Control}+\key{↑}</td> 565 <td>Go to above workspace</td> 566 <td>Desktop window</td> 567 </tr> 568 <tr> 569 <td>\key{Command}+\key{Control}+\key{↓}</td> 570 <td>Go to below workspace</td> 571 <td>Desktop window</td> 572 </tr> 573 <tr> 574 <td>\key{Command}+\key{Control}+\key{Shift}+\key{←}</td> 575 <td>Send window and go to left workspace</td> 576 <td>Desktop window</td> 577 </tr> 578 <tr> 579 <td>\key{Command}+\key{Control}+\key{Shift}+\key{→}</td> 580 <td>Send window and go to right workspace</td> 581 <td>Desktop window</td> 582 </tr> 583 <tr> 584 <td>\key{Command}+\key{Control}+\key{Shift}+\key{↑}</td> 585 <td>Send window and go to above workspace</td> 586 <td>Desktop window</td> 587 </tr> 588 <tr> 589 <td>\key{Command}+\key{Control}+\key{Shift}+\key{↓}</td> 590 <td>Send window and go to below workspace</td> 591 <td>Desktop window</td> 592 </tr> 593 </table> 594 595 \since BeOS R3 596*/ 597 598 599/*! 600 \fn BWindow::BWindow(BRect frame, const char* title, window_type type, 601 uint32 flags, uint32 workspace) 602 \brief Creates a new BWindow object. 603 604 \param frame The inner \a frame rectangle in the screen coordinate system. 605 \param title The window \a title and thread title as "w>title". 606 \param type window_type flag, one of the following: 607 - \c B_UNTYPED_WINDOW 608 - \c B_TITLED_WINDOW 609 - \c B_MODAL_WINDOW 610 - \c B_DOCUMENT_WINDOW 611 - \c B_BORDERED_WINDOW 612 - \c B_FLOATING_WINDOW 613 \param flags Mask that defines window attributes: 614 - \c B_NOT_MOVABLE cannot be moved by the user 615 - \c B_NOT_CLOSABLE cannot be closed by the user, no close button 616 displayed 617 - \c B_NOT_ZOOMABLE cannot be zoomed by the user, no zoom button 618 displayed 619 - \c B_NOT_MINIMIZABLE cannot be minimized by the user 620 - \c B_NOT_RESIZABLE cannot be resized by the user 621 - \c B_NOT_H_RESIZABLE cannot be resized horizontally by the user 622 - \c B_NOT_V_RESIZABLE cannot be resized vertically by the user 623 - \c B_AVOID_FRONT cannot be brought to front by the user 624 - \c B_AVOID_FOCUS cannot receive keyboard focus 625 - \c B_WILL_ACCEPT_FIRST_CLICK The first click is processed by the 626 window. 627 - \c B_OUTLINE_RESIZE draws only it's outline as it's resized and 628 doesn't draw its contents. 629 - \c B_NO_WORKSPACE_ACTIVATION Causes the current workspace to stay 630 active when activated on another workspace. 631 - \c B_NOT_ANCHORED_ON_ACTIVATE Causes the window to move to the current 632 workspace when activated if it already exists on another workspace. 633 - \c B_QUIT_ON_WINDOW_CLOSE Quit the application when the window closes. 634 - \c B_SAME_POSITION_IN_ALL_WORKSPACES Window maintains its position 635 across workspaces. 636 - \c B_AUTO_UPDATE_SIZE_LIMITS Automatically adjust the size according 637 to layout constraints. 638 - \c B_CLOSE_ON_ESCAPE Close when the user pushes the Escape key. 639 - \c B_NO_SERVER_SIDE_WINDOW_MODIFIERS ?? 640 \param workspace Mask that indicates which of the 32 potential workspace(s) 641 the window should be displayed in or \c B_CURRENT_WORKSPACE or 642 \c B_ALL_WORKSPACES constants. 643 644 \since BeOS R3 645*/ 646 647 648/*! 649 \fn BWindow::BWindow(BRect frame, const char* title, window_look look, 650 window_feel feel, uint32 flags, uint32 workspace) 651 \brief Creates a new BWindow object with the specified \a look and \a feel. 652 653 \param frame The inner \a frame rectangle in the screen coordinate system. 654 \param title The window \a title and thread title as "w>title". 655 \param look The window_look flags, one of the following: 656 - \c B_BORDERED_WINDOW_LOOK No title bar, thin border, no resize 657 control. 658 - \c B_NO_BORDER_WINDOW_LOOK A borderless rectangle with no provisions 659 to move or close the window. 660 - \c B_TITLED_WINDOW_LOOK Like \c B_DOCUMENT_WINDOW_LOOK, but with a 661 resize corner instead of a resize thumb. 662 - \c B_DOCUMENT_WINDOW_LOOK Large title bar, thick border, draggable 663 resize corner thumb. 664 - \c B_MODAL_WINDOW_LOOK For modal dialogs: no title bar, thick border, 665 resize corner depending on the \c B_NOT_RESIZABLE flag. 666 - \c B_FLOATING_WINDOW_LOOK For floating sub windows: small title bar, 667 thin border, resize corner. 668 \param feel The window_feel flags, one of the following: 669 - \c B_NORMAL_WINDOW_FEEL Behaves like a normal, non-modal, 670 non-floating window. 671 - \c B_MODAL_SUBSET_WINDOW_FEEL Blocks all windows in its subset when 672 displayed. Visible only if a window in its subset is visible. 673 - \c B_MODAL_APP_WINDOW_FEEL Blocks all windows in its app when 674 displayed. Visible only if a window in its app is visible. 675 - \c B_MODAL_ALL_WINDOW_FEEL Blocks all windows across the entire 676 system when displayed. Always visible in all workspaces. 677 - \c B_FLOATING_SUBSET_WINDOW_FEEL Floats above all windows in its 678 subset when displayed. Visible only if a window in its subset is the 679 frontmost window. 680 - \c B_FLOATING_APP_WINDOW_FEEL Floats above all windows in its app 681 when displayed. Visible only if a window in its app is the frontmost 682 window. 683 - \c B_FLOATING_ALL_WINDOW_FEEL Floats above all windows across the 684 entire system when displayed. Always visible in all workspaces. 685 \param flags Mask that defines window attributes: 686 - \c B_NOT_MOVABLE cannot be moved by the user 687 - \c B_NOT_CLOSABLE cannot be closed by the user, no close button 688 displayed 689 - \c B_NOT_ZOOMABLE cannot be zoomed by the user, no zoom button 690 displayed 691 - \c B_NOT_MINIMIZABLE cannot be minimized by the user 692 - \c B_NOT_RESIZABLE cannot be resized by the user 693 - \c B_NOT_H_RESIZABLE cannot be resized horizontally by the user 694 - \c B_NOT_V_RESIZABLE cannot be resized vertically by the user 695 - \c B_AVOID_FRONT cannot be brought to front by the user 696 - \c B_AVOID_FOCUS cannot receive keyboard focus 697 - \c B_WILL_ACCEPT_FIRST_CLICK The first click is processed by the 698 window. 699 - \c B_OUTLINE_RESIZE draws only it's outline as it's resized and 700 doesn't draw its contents. 701 - \c B_NO_WORKSPACE_ACTIVATION Causes the current workspace to stay 702 active when activated on another workspace. 703 - \c B_NOT_ANCHORED_ON_ACTIVATE Causes the window to move to the current 704 workspace when activated if it already exists on another workspace. 705 - \c B_QUIT_ON_WINDOW_CLOSE Quit the application when the window closes. 706 - \c B_SAME_POSITION_IN_ALL_WORKSPACES Window maintains its position 707 across workspaces. 708 - \c B_AUTO_UPDATE_SIZE_LIMITS Automatically adjust the size according 709 to layout constraints. 710 - \c B_CLOSE_ON_ESCAPE Close when the user pushes the Escape key. 711 - \c B_NO_SERVER_SIDE_WINDOW_MODIFIERS ?? 712 \param workspace Mask that indicates which of the 32 potential workspace(s) 713 the window should be displayed in or \c B_CURRENT_WORKSPACE or 714 \c B_ALL_WORKSPACES constants. 715 716 \since BeOS R3 717*/ 718 719 720/*! 721 \fn BWindow::BWindow(BMessage* data) 722 \brief Archive constructor. 723 724 \param data A pointer to the BMessage object to build the object from. 725 726 \since BeOS R3 727*/ 728 729 730/*! 731 \fn BWindow::BWindow(BRect frame, int32 bitmapToken) 732 \brief Offscreen bitmap constructor. 733 734 \param frame The inner \a frame rectangle in the screen coordinate system. 735 \param bitmapToken Token to pass into App Server for offscreen window bitmap. 736 737 \since Haiku R1 738*/ 739 740 741/*! 742 \fn BWindow::~BWindow() 743 \brief Destroys the BWindow object and all attached views. 744 745 \since BeOS R3 746*/ 747 748 749/*! 750 \fn BArchivable* BWindow::Instantiate(BMessage* data) 751 \brief Creates a new BWindow object from the \a data message. 752 753 \param data A pointer to the BMessage object to build the object from. 754 755 \returns A newly created BWindow object or \c NULL if the message doesn't 756 contain an archived BWindow. 757 758 \since BeOS R3 759*/ 760 761 762/*! 763 \fn status_t BWindow::Archive(BMessage* data, bool deep) const 764 \brief Archives the object into the \a data message. 765 766 \param data A pointer to the BMessage object to archive the object into. 767 \param deep Whether or not to archive child views as well. 768 769 \return A status code, \c B_OK if the object was archived or an error code 770 otherwise. 771 772 \since BeOS R3 773*/ 774 775 776/*! 777 \fn void BWindow::Quit() 778 \brief Deletes the window and all child views, destroys the window thread, 779 removes the window's connection to the Application Server, and deletes 780 the object. 781 782 Use this method to destroy a window rather than using the delete operator. 783 784 This method works much like the BLooper::Quit(), it doesn't return when 785 called from the BWindow's thread and it returns after all messages have been 786 processed when called from another thread and the BWindow and its thread has 787 been destroyed. 788 789 \warning The window must first be locked before calling Quit(). 790 791 \see BLooper::Quit() 792 793 \since BeOS R3 794*/ 795 796 797/*! 798 \fn void BWindow::AddChild(BView* child, BView* before) 799 \brief Adds \a child to the view hierarchy immediately before \a before. 800 801 A view may only have one parent at a time so \a child must not have already 802 been added to the view hierarchy. If \a before is \c NULL then \a child is 803 added to the end of the view hierarchy. 804 805 The AttachedToWindow() method is invoked on \a child and all of its 806 descendent views. 807 808 \param child The child view to add. 809 \param before The sibling view to add \a child before. 810 811 \since BeOS R3 812*/ 813 814 815/*! 816 \fn void BWindow::AddChild(BLayoutItem* child) 817 \brief Add the \a child layout item to the view hierarchy. 818 819 \param child The child layout item to add. 820 821 \since Haiku R1 822*/ 823 824 825/*! 826 \fn bool BWindow::RemoveChild(BView* child) 827 \brief Removes \a child from the view hierarchy. 828 829 \param child The child view to remove. 830 831 \return Whether or not \a child was removed from the view hierarchy. 832 833 \since BeOS R3 834*/ 835 836 837/*! 838 \fn int32 BWindow::CountChildren() const 839 \brief Returns the number of child views that the window has. 840 841 \return The number of child views as an int32. 842 843 \since BeOS R3 844*/ 845 846 847/*! 848 \fn BView* BWindow::ChildAt(int32 index) const 849 \brief Returns a pointer to the child view found at \a index. 850 851 \param index The index of the child view to return a pointer of. 852 853 \return A pointer to the child view at \a index or \c NULL if not found. 854 855 \since BeOS R3 856*/ 857 858 859/*! 860 \fn void BWindow::Minimize(bool minimize) 861 \brief Minimizes or un-minimizes the window based on \a minimize. 862 863 Unlike Hide() an Show(), Minimize() dims and un-dims the entry for the window 864 in Deskbar's window list rather than removing it. Also Minimize() calls are not 865 cumulative like Hide() and Show(); one \c false call will undo multiple \c true 866 calls. 867 868 Minimize() also acts as a hook method that is invoked when the user double- 869 clicks on the title tab of the window or selects the window from the DeskBar 870 window list. The \a minimize parameter is \c true if the window is about to be 871 hidden and \c false if it is about to be shown. 872 873 If you override Minimize() and you want to inherit BWindow's behavior, you 874 must call BWindow::Minimize(). 875 876 \since BeOS R3 877*/ 878 879 880/*! 881 \fn status_t BWindow::SendBehind(const BWindow* window) 882 \brief Moves the BWindow object behind \a window. 883 884 \param window A pointer to the window to move behind. 885 886 \returns \c B_OK on success or \c B_ERROR on failure. 887 888 \since BeOS R3 889*/ 890 891 892/*! 893 \fn void BWindow::Flush() const 894 \brief Flushes the window's connection to App Server causing any pending 895 messages to be processed then returns immediately. 896 897 \since BeOS R3 898*/ 899 900 901/*! 902 \fn void BWindow::Sync() const 903 \brief Synchronizes the attached window's connection to App Server 904 causing any pending messages to be processed and then waits for 905 the App Server to respond. 906 907 \since BeOS R3 908*/ 909 910 911/*! 912 \fn void BWindow::DisableUpdates() 913 \brief Suppresses drawing within the window. 914 915 If you want the results of several drawing operations to appear in the 916 window all at once you disable updates, draw, and then re-enable updates. 917 918 \since BeOS R3 919*/ 920 921 922/*! 923 \fn void BWindow::EnableUpdates() 924 \brief Re-enable drawing within the window. 925 926 If you want the results of several drawing operations to appear in the window 927 all at once you disable updates, draw, and then re-enable updates. 928 929 \since BeOS R3 930*/ 931 932 933/*! 934 \fn void BWindow::BeginViewTransaction() 935 \brief Stall updates to App Server allowing you to batch drawing commands to 936 limit flickering. 937 938 Unlike DisableUpdates() the messages are sent but are not processed. 939 940 \since Haiku R1 941*/ 942 943 944/*! 945 \fn void BWindow::EndViewTransaction() 946 \brief Ends a view transaction allowing update to go to App Server again. 947 948 \since Haiku R1 949*/ 950 951 952/*! 953 \fn bool BWindow::InViewTransaction() const 954 \brief Returns whether or not the window is currently in a view transaction. 955 956 \returns \c true if the window is currently in a view transaction, 957 \c false otherwise. 958 959 \since Haiku R1 960*/ 961 962 963/*! 964 \fn bool BWindow::IsFront() const 965 \brief Returns whether or not the window is the frontmost on screen. 966 967 \returns \c true if window is the frontmost on screen, \c false otherwise. 968 969 \since BeOS R3 970*/ 971 972 973/*! 974 \fn void BWindow::MessageReceived(BMessage* message) 975 \brief Handle \a message received by the associated looper. 976 977 \param message The \a message received by the looper. 978 979 \see BHandler::MessageReceived() 980 981 \since BeOS R3 982*/ 983 984 985/*! 986 \fn void BWindow::DispatchMessage(BMessage* message, BHandler* target) 987 \brief Window's central message-processing method. 988 989 This method called automatically as messages arrive in the queue, you should 990 never call DispatchMessage() yourself. 991 992 \warning Don't override this method in your BWindow subclass. Override 993 MessageReceived() instead to alter the window's message dispatching 994 mechanism. 995 996 \see BLooper::DispatchMessage() 997 998 \since BeOS R3 999*/ 1000 1001 1002/*! 1003 \fn void BWindow::FrameMoved(BPoint newPosition) 1004 \brief Hook method that gets called when the window is moved. 1005 1006 \param newPosition The point of the top left corner of the frame 1007 rectangle that the window has been moved to. 1008 1009 \since BeOS R3 1010*/ 1011 1012 1013/*! 1014 \fn void BWindow::FrameResized(float newWidth, float newHeight) 1015 \brief Hook method that gets called when the window is resized. 1016 1017 \param newWidth The new \a width of the window. 1018 \param newHeight The new \a height of the window. 1019 1020 \since BeOS R3 1021*/ 1022 1023 1024/*! 1025 \fn void BWindow::WorkspacesChanged(uint32 oldWorkspaces, 1026 uint32 newWorkspaces) 1027 \brief Hook method that gets called when the number of workspaces changes. 1028 1029 \param oldWorkspaces The old number of workspaces. 1030 \param newWorkspaces The new number of workspaces. 1031 1032 \since BeOS R3 1033*/ 1034 1035 1036/*! 1037 \fn void BWindow::WorkspaceActivated(int32 workspace, bool state) 1038 \brief Hook method that gets called when the active workspace changes. 1039 1040 \param workspace The \a workspace number that was activated/deactivated. 1041 \param state \c true if activated, \c false if deactivated. 1042 1043 \since BeOS R3 1044*/ 1045 1046 1047/*! 1048 \fn void BWindow::MenusBeginning() 1049 \brief Hook method that gets called just before a menu owned by the window is 1050 shown. 1051 1052 \note This method is not invoked by a message, there is no 1053 \c B_MENUS_BEGINNING flag. 1054 1055 \since BeOS R3 1056*/ 1057 1058 1059/*! 1060 \fn void BWindow::MenusEnded() 1061 \brief Hook method that gets called just before a menu owned by the window is 1062 hidden. 1063 1064 \note This method is not invoked by a message, there is no 1065 \c B_MENUS_ENDED flag. 1066 1067 \since BeOS R3 1068*/ 1069 1070 1071/*! 1072 \fn void BWindow::SetSizeLimits(float minWidth, float maxWidth, 1073 float minHeight, float maxHeight) 1074 \brief Set size limits on the window. 1075 1076 The user won't be able to resize the window beyond the limits set by this 1077 method. SetSizeLimits() constrains the user, not the programmer, you may 1078 still resize the window outside of the size limits set by this method by 1079 calling ResizeBy() or ResizeTo(). 1080 1081 \param minWidth The minimum width of the window to set. 1082 \param maxWidth The maximum width of the window to set. 1083 \param minHeight The minimum height of the window to set. 1084 \param maxHeight The maximum height of the window to set. 1085 1086 \since BeOS R3 1087*/ 1088 1089 1090/*! 1091 \fn void BWindow::GetSizeLimits(float* _minWidth, float* _maxWidth, 1092 float* _minHeight, float* _maxHeight) 1093 \brief Fills out the size limits set on the window. 1094 1095 \param _minWidth The minimum width of the window. 1096 \param _maxWidth The maximum width of the window. 1097 \param _minHeight The minimum height of the window. 1098 \param _maxHeight The maximum height of the window. 1099 1100 \since BeOS R3 1101*/ 1102 1103 1104/*! 1105 \fn void BWindow::UpdateSizeLimits() 1106 \brief Updates the window's size limits from the minimum and maximum sizes 1107 of its top view. 1108 1109 This method does nothing unless the \c B_AUTO_UPDATE_SIZE_LIMITS window flag 1110 is set. 1111 1112 The method is called automatically after a layout invalidation. Since it is 1113 invoked asynchronously, calling this method manually is necessary, if it is 1114 desired to adjust the limits (and as a possible side effect the window size) 1115 earlier, e.g. before the first call to the Show() method.) 1116 1117 \since Haiku R1 1118*/ 1119 1120 1121/*! 1122 \fn status_t BWindow::SetDecoratorSettings(const BMessage& settings) 1123 \brief Set the window decorator settings according to \a settings. 1124 1125 \param settings The decorator \a settings message to set. 1126 1127 \returns \c B_OK if the decorator settings were set successfully or an error 1128 code otherwise. 1129 1130 \since Haiku R1 1131*/ 1132 1133 1134/*! 1135 \fn status_t BWindow::GetDecoratorSettings(BMessage* settings) const 1136 \brief Fill out the window's decorator settings into \a settings. 1137 1138 \param settings A pointer to a BMessage object to fill out. 1139 1140 \returns \c B_OK if the decorator settings were filled out successfully 1141 or an error code otherwise. 1142 1143 \since Haiku R1 1144*/ 1145 1146 1147/*! 1148 \fn void BWindow::SetZoomLimits(float maxWidth, float maxHeight) 1149 \brief Sets the maximum size that the window will zoom to when Zoom() is 1150 called. 1151 1152 The window will zoom to the minimum of the screen size, the maximum values 1153 set by SetSizeLimits(), and the maximum values set by this method. 1154 1155 /see Zoom() 1156 1157 \since BeOS R3 1158*/ 1159 1160 1161/*! 1162 \fn void BWindow::Zoom(BPoint origin, float width, float height) 1163 \brief Move window to \a origin, then resize to \a width and \a height. 1164 1165 You may call Zoom() even if the window has the \c B_NOT_ZOOMABLE flag set. 1166 1167 This method may move and resize the window resulting in both the 1168 FrameMoved() and FrameResized() hook methods to be called. 1169 1170 You can override this method to change how your window behaves when the 1171 user clicks the zoom button or when Zoom() is called. 1172 1173 \param origin The point that the window was moved to. 1174 \param width The new width of the window. 1175 \param height The new height of the window. 1176 1177 \since BeOS R3 1178*/ 1179 1180 1181/*! 1182 \fn void BWindow::Zoom() 1183 \brief Resize the window to the minimum of the screen size, the maximum 1184 values set by SetSizeLimits(), and the maximum values set by 1185 SetZoomLimits(). 1186 1187 You may call Zoom() even if the window has the \c B_NOT_ZOOMABLE flag set. 1188 1189 This is the method called when the user clicks the window's zoom button. 1190 It can also be called programmatically. 1191 1192 The window dimensions are calculated from the smallest of three rectangles: 1193 -# the screen frame, 1194 -# the rectangle defined by SetZoomLimits(), 1195 -# the rectangle defined by SetSizeLimits(). 1196 1197 However if the window frame already matches these new dimensions, Zoom() 1198 uses the previous size and location of the window instead. 1199 1200 This method calls Zoom(BPoint, float, float) to do the actualy zooming. 1201 1202 \see Zoom(BPoint, float, float); 1203 1204 \since BeOS R3 1205*/ 1206 1207 1208/*! 1209 \fn void BWindow::ScreenChanged(BRect screenSize, color_space depth) 1210 \brief Hook method that is called when the screen that the window is located 1211 on changes size or location or the color space of the screen changes. 1212 1213 \param screenSize The new screen size in the screen's coordinate system. 1214 \param depth The new color space of the screen. 1215 1216 \since BeOS R3 1217*/ 1218 1219 1220/*! 1221 \fn void BWindow::SetPulseRate(bigtime_t rate) 1222 \brief Sets how often \c B_PULSE messages are posted to the window. 1223 1224 All BViews attached to a window share the same pulse rate. 1225 1226 \a rate should not be set to less than 100,000 microseconds, differences less 1227 than 50,000 microseconds may not be noticeable. 1228 1229 Setting the \a rate to 0 disables pulsing for all views attache to the window. 1230 1231 \param rate The pulse rate to set. 1232 1233 \since BeOS R3 1234*/ 1235 1236 1237/*! 1238 \fn bigtime_t BWindow::PulseRate() const 1239 \brief Returns the pulse rate of the window. 1240 1241 \c B_PULSE messages are sent by default every 500,000 microseconds provided 1242 that no other messages are pending. 1243 1244 \returns The pulse rate of the window as a bigtime_t. 1245 1246 \since BeOS R3 1247*/ 1248 1249 1250/*! 1251 \name Shortcut Methods 1252 1253 The key parameter is specified in the form of a Unicode code point. This 1254 is generally an ASCII character such as 'A' or a key constant such as 1255 \c B_RIGHT_ARROW. To use a UTF-8 character you must first convert it to a 1256 Unicode code point using BUnicodeChar::FromUTF8(). 1257*/ 1258 1259 1260//! @{ 1261 1262 1263/*! 1264 \fn void BWindow::AddShortcut(uint32 key, uint32 modifiers, BMenuItem* item) 1265 \brief Creates a keyboard shortcut that activates a menu \a item. 1266 1267 \param key The character that activates the shortcut, case-insensitive. 1268 \param modifiers A bit mask of modifiers in addition to \c B_COMMAND_KEY, 1269 options include: 1270 - \c B_SHIFT_KEY 1271 - \c B_OPTION_KEY 1272 - \c B_CONTROL_KEY 1273 - \c B_MENU_KEY 1274 \param item The menu \a item to activate. 1275 1276 \since Haiku R1 1277*/ 1278 1279 1280/*! 1281 \fn void BWindow::AddShortcut(uint32 key, uint32 modifiers, BMessage* message) 1282 \brief Creates a keyboard shortcut that sends a \a message to the window. 1283 1284 \warning Don't use this method to a create menu shortcut, add a BMenuItem 1285 instead. 1286 1287 \param key The character that activates the shortcut, case-insensitive. 1288 \param modifiers A bit mask of modifiers in addition to \c B_COMMAND_KEY, 1289 options include: 1290 - \c B_SHIFT_KEY 1291 - \c B_OPTION_KEY 1292 - \c B_CONTROL_KEY 1293 - \c B_MENU_KEY 1294 \param message The \a message to send when the shortcut is activated. The 1295 BWindow takes ownership of the \a message. 1296 1297 \since BeOS R3 1298*/ 1299 1300 1301/*! 1302 \fn void BWindow::AddShortcut(uint32 key, uint32 modifiers, BMessage* message, 1303 BHandler* target) 1304 \brief Creates a keyboard shortcut that sends a \a message to the specified 1305 \a target. 1306 1307 \warning Don't use this method to a create menu shortcut, add a BMenuItem 1308 instead. 1309 1310 \param key The character that activates the shortcut, case-insensitive. 1311 \param modifiers A bit mask of modifiers in addition to \c B_COMMAND_KEY, 1312 options include one or more of the following: 1313 - \c B_SHIFT_KEY 1314 - \c B_OPTION_KEY 1315 - \c B_CONTROL_KEY 1316 - \c B_MENU_KEY 1317 \param message The \a message to send when the shortcut is activated. The 1318 BWindow takes ownership of the \a message. 1319 \param target The handler to send the message to. 1320 1321 \since BeOS R3 1322*/ 1323 1324 1325/*! 1326 \fn bool BWindow::HasShortcut(uint32 key, uint32 modifiers) 1327 \brief Returns whether or not the specified shortcut is set on the window. 1328 1329 \param key The character to check, case-insensitive. 1330 \param modifiers A bit mask of modifiers in addition to \c B_COMMAND_KEY, 1331 options include one or more of the following: 1332 - \c B_SHIFT_KEY 1333 - \c B_OPTION_KEY 1334 - \c B_CONTROL_KEY 1335 - \c B_MENU_KEY 1336 1337 \returns \c true if the window has the specified shortcut, \c false 1338 otherwise. 1339 1340 \since Haiku R1 1341*/ 1342 1343 1344/*! 1345 \fn void BWindow::RemoveShortcut(uint32 key, uint32 modifiers) 1346 \brief Removes the specified shortcut from the window. 1347 1348 The memory used by the shortcut message is freed. 1349 1350 \param key The character to remove, case-insensitive. 1351 \param modifiers A bit mask of modifiers in addition to \c B_COMMAND_KEY, 1352 options include one or more of the following: 1353 - \c B_SHIFT_KEY 1354 - \c B_OPTION_KEY 1355 - \c B_CONTROL_KEY 1356 - \c B_MENU_KEY 1357 1358 \since BeOS R3 1359*/ 1360 1361 1362//! @} 1363 1364 1365/*! 1366 \fn BButton* BWindow::DefaultButton() const 1367 \brief Returns a pointer to the default button set on the window. 1368 1369 \return A pointer to the window's default button or \c NULL if it doesn't 1370 have one. 1371 1372 \since BeOS R3 1373*/ 1374 1375 1376/*! 1377 \fn void BWindow::SetDefaultButton(BButton* button) 1378 \brief Set the default button of the window to \a button. 1379 1380 The default button has a grey outline and is activated by the user pushing 1381 the Enter key. The user can activate the default button even if another view 1382 is currently set to be the focus view of the window. 1383 1384 A window may only have one default button at a time, to remove the current 1385 default without setting another button you may pass in \c NULL. 1386 1387 \param button A pointer to the button to set as the default or \c NULL to 1388 unset. 1389 1390 \since BeOS R3 1391*/ 1392 1393 1394/*! 1395 \fn bool BWindow::NeedsUpdate() const 1396 \brief Returns whether or not any of the attached views need to be updated. 1397 1398 \return \c true if an attached view needs to be updated, \c false otherwise. 1399 1400 \since BeOS R3 1401*/ 1402 1403 1404/*! 1405 \fn void BWindow::UpdateIfNeeded() 1406 \brief Invokes Draw() immediately on each child view that needs updating. 1407 1408 This method is synchronous, it waits for each child view to update before 1409 returning. This method is ignored unless it is called from within the message 1410 loop of the thread that the BWindow is running in. 1411 1412 You may call this method as part of a hook function such as MouseMoved() or 1413 KeyDown() to force invalid views to be immediately redrawn without having to 1414 wait for the hook function to finish. 1415 1416 \since BeOS R3 1417*/ 1418 1419 1420/*! 1421 \fn BView* BWindow::FindView(const char* viewName) const 1422 \brief Returns the attached view with the specified \a viewName. 1423 1424 \param viewName The name of the attached view to look for. 1425 1426 \return A pointer to the BView object or \c NULL if no view is found. 1427 1428 \since BeOS R3 1429*/ 1430 1431 1432/*! 1433 \fn BView* BWindow::FindView(BPoint point) const 1434 \brief Returns a pointer to the attached view located at the specified 1435 \a point. 1436 1437 \param point The \a point to get the view at in the window's coordinate 1438 system. 1439 1440 \return A pointer to the BView object or \c NULL if no view is found. 1441 1442 \since BeOS R3 1443*/ 1444 1445 1446/*! 1447 \fn BView* BWindow::CurrentFocus() const 1448 \brief Returns a pointer to the current focus view of the window. 1449 1450 \return A pointer to the current focus view of the window or \c NULL if 1451 not found. 1452 1453 \since BeOS R3 1454*/ 1455 1456 1457/*! 1458 \fn void BWindow::Activate(bool active) 1459 \brief Activates or deactivates the window based on \a active. 1460 1461 The title tab of the active window is drawn more brightly, the window is made 1462 frontmost, and it becomes the target of keyboard events. Calling Show() 1463 automatically activates the window calling the WindowActivated() hook method. 1464 1465 \param active \c true to activate the window, \c false to deactivate the 1466 window. 1467 1468 \since BeOS R3 1469*/ 1470 1471 1472/*! 1473 \fn void BWindow::WindowActivated(bool active) 1474 \brief Hook method that gets called when the window becomes activated or 1475 deactivated. 1476 1477 \param active \c true if the window has become activated, \c false if the 1478 window has become deactivated. 1479 1480 \since BeOS R3 1481*/ 1482 1483 1484/*! 1485 \fn void BWindow::ConvertToScreen(BPoint* point) const 1486 \brief Convert \a point to the screen's coordinate system in place. 1487 1488 \param point A pointer to a BPoint object to convert. 1489 1490 \since BeOS R3 1491*/ 1492 1493 1494/*! 1495 \fn BPoint BWindow::ConvertToScreen(BPoint point) const 1496 \brief Returns \a point converted to the screen's coordinate system. 1497 1498 \param point A BPoint object to convert. 1499 1500 \return A new BPoint object in the screen's coordinate system. 1501 1502 \since BeOS R3 1503*/ 1504 1505 1506/*! 1507 \fn void BWindow::ConvertFromScreen(BPoint* point) const 1508 \brief Convert \a point from the screen's coordinate system to the 1509 window's coordinate system in place. 1510 1511 \param point A pointer to a BPoint object to convert. 1512 1513 \since BeOS R3 1514*/ 1515 1516 1517/*! 1518 \fn BPoint BWindow::ConvertFromScreen(BPoint point) const 1519 \brief Returns \a point converted from the screen's coordinate system to 1520 the window's coordinate system. 1521 1522 \param point A BPoint object to convert. 1523 1524 \return A new BPoint object in the window's coordinate system. 1525 1526 \since BeOS R3 1527*/ 1528 1529 1530/*! 1531 \fn void BWindow::ConvertToScreen(BRect* rect) const 1532 \brief Convert \a rect to the screen's coordinate system in place. 1533 1534 \param rect A pointer to a BRect object to convert. 1535 1536 \since BeOS R3 1537*/ 1538 1539 1540/*! 1541 \fn BRect BWindow::ConvertToScreen(BRect rect) const 1542 \brief Returns \a rect converted to the screen's coordinate system. 1543 1544 \param rect A BRect object to convert. 1545 1546 \return A new BRect object in the screen's coordinate system. 1547 1548 \since BeOS R3 1549*/ 1550 1551 1552/*! 1553 \fn void BWindow::ConvertFromScreen(BRect* rect) const 1554 \brief Convert \a rect from the screen's coordinate system to the 1555 window's coordinate system in place. 1556 1557 \param rect A pointer to a BRect object to convert. 1558 1559 \since BeOS R3 1560*/ 1561 1562 1563/*! 1564 \fn BRect BWindow::ConvertFromScreen(BRect rect) const 1565 \brief Returns \a rect converted from the screen's coordinate system to the 1566 window's coordinate system. 1567 1568 \param rect A BRect object to convert. 1569 1570 \return A new BRect object in the window's coordinate system. 1571 1572 \since BeOS R3 1573*/ 1574 1575 1576/*! 1577 \fn bool BWindow::IsMinimized() const 1578 \brief Returns whether or not the window is minimized. 1579 1580 \return \c true if the window is minimized, \c false otherwise. 1581 1582 \since BeOS R5 1583*/ 1584 1585 1586/*! 1587 \fn BRect BWindow::Bounds() const 1588 \brief Returns the bounding rectangle of the window. 1589 1590 \return The bounding rectangle of the window as a BRect in the window's 1591 coordinate system. 1592 1593 \sa Frame() 1594 1595 \since BeOS R3 1596*/ 1597 1598 1599/*! 1600 \fn BRect BWindow::Frame() const 1601 \brief Returns the frame rectangle of the window. 1602 1603 \return The bounding rectangle of the window as a BRect in the screen 1604 coordinate system. 1605 1606 \sa Bounds() 1607 1608 \since BeOS R3 1609*/ 1610 1611 1612/*! 1613 \fn BRect BWindow::DecoratorFrame() const 1614 \brief Returns the frame rectangle of the window decorator. 1615 1616 \return The bounding rectangle of the window decorator as a BRect in the 1617 screen coordinate system. 1618 1619 \since Haiku R1 1620*/ 1621 1622 1623/*! 1624 \fn BSize BWindow::Size() const 1625 \brief Returns the size of the window. 1626 1627 \return The size of the window as a BSize in the screen coordinate system. 1628 1629 \since Haiku R1 1630*/ 1631 1632 1633/*! 1634 \fn const char* BWindow::Title() const 1635 \brief Returns the window title as set by the constructor or SetTitle(). 1636 1637 \return A pointer to the window title. 1638 1639 \since BeOS R3 1640*/ 1641 1642 1643/*! 1644 \fn void BWindow::SetTitle(const char* title) 1645 \brief Sets the window title to \a title. 1646 1647 Also renames the window thread to "w>title" where "title" is the passed in 1648 title string. 1649 1650 \since BeOS R5 1651*/ 1652 1653 1654/*! 1655 \fn bool BWindow::IsActive() const 1656 \brief Returns whether or not the window is active. 1657 1658 \return \c true if the window is active, \c false otherwise. 1659 1660 \since BeOS R3 1661*/ 1662 1663 1664/*! 1665 \fn void BWindow::SetKeyMenuBar(BMenuBar* bar) 1666 \brief Set the specified menu \a bar as the key menu bar for the window. 1667 1668 The key menu bar is the one located at the top of the window at the root of 1669 the menu hierarchy that the user can navigate with the keyboard. 1670 1671 \param bar A pointer to the menu \a bar to set as as the key menu \a bar for 1672 the window. 1673 1674 \since BeOS R3 1675*/ 1676 1677 1678/*! 1679 \fn BMenuBar* BWindow::KeyMenuBar() const 1680 \brief Returns a pointer to the key menu bar set to the window. 1681 1682 If the window contains only one menu bar it is automatically considered to be 1683 the key menu bar for the window. If more than one menu bar is attached to the 1684 window then the last one added to the window's view hierarchy is considered 1685 to be the key menu bar for the window. 1686 1687 To explicitly set a menu bar as the key menu bar call SetKeyMenuBar(). 1688 1689 \return A pointer to the key menu bar or \c NULL is not is set. 1690 1691 \since BeOS R3 1692*/ 1693 1694 1695/*! 1696 \fn bool BWindow::IsModal() const 1697 \brief Returns whether or not the window is modal. 1698 1699 \return \c true if the window is modal, \c false otherwise. 1700 1701 \since BeOS R3 1702*/ 1703 1704 1705/*! 1706 \fn bool BWindow::IsFloating() const 1707 \brief Returns whether or not the window is floating. 1708 1709 \return \c true if the window is floating, \c false otherwise. 1710 1711 \since BeOS R3 1712*/ 1713 1714 1715/*! 1716 \fn status_t BWindow::AddToSubset(BWindow* window) 1717 \brief Adds \a window to be in the subset of the BWindow. 1718 1719 \return A status code. 1720 \retval B_OK \a window was added as a subset of the BWindow. 1721 \retval B_BAD_VALUE \c window is not \c B_NORMAL_WINDOW_FEEL or the BWindow 1722 object's feel is not set to \c B_MODAL_SUBSET_WINDOW_FEEL or 1723 \c B_FLOATING_SUBSET_WINDOW_FEEL. 1724 \retval B_ERROR Could not lock the BWindow object. 1725 1726 \since BeOS R3 1727*/ 1728 1729 1730/*! 1731 \fn status_t BWindow::RemoveFromSubset(BWindow* window) 1732 \brief Remove \a window from the subset of the BWindow. 1733 1734 \return A status code. 1735 \retval B_OK \a window was removed from the subset of the BWindow. 1736 \retval B_BAD_VALUE \c window is not \c B_NORMAL_WINDOW_FEEL or the BWindow 1737 object's feel is not set to \c B_MODAL_SUBSET_WINDOW_FEEL or 1738 \c B_FLOATING_SUBSET_WINDOW_FEEL. 1739 \retval B_ERROR Could not lock the BWindow object. 1740 1741 \since BeOS R3 1742*/ 1743 1744 1745/*! 1746 \fn status_t BWindow::SetType(window_type type) 1747 \brief Changes the window type set in the constructor to \a type. 1748 1749 \return \c B_OK on success or an error code on failure. 1750 1751 \since BeOS R3 1752*/ 1753 1754 1755/*! 1756 \fn window_type BWindow::Type() const 1757 \brief Returns the current window type flag. 1758 1759 \return The currently set window type flag. 1760 1761 \since BeOS R3 1762*/ 1763 1764 1765/*! 1766 \fn status_t BWindow::SetLook(window_look look) 1767 \brief Changes the window look set in the constructor to \a look. 1768 1769 \return \c B_OK on success or an error code on failure. 1770 1771 \since BeOS R3 1772*/ 1773 1774 1775/*! 1776 \fn window_look BWindow::Look() const 1777 \brief Returns the current window look flag. 1778 1779 \return The currently set window look flag. 1780 1781 \since BeOS R3 1782*/ 1783 1784 1785/*! 1786 \fn status_t BWindow::SetFeel(window_feel feel) 1787 \brief Changes the window feel set in the constructor to \a feel. 1788 1789 \return \c B_OK on success or an error code on failure. 1790 1791 \since BeOS R3 1792*/ 1793 1794 1795/*! 1796 \fn window_feel BWindow::Feel() const 1797 \brief Returns the current window feel flag. 1798 1799 \return The currently set window feel flag. 1800 1801 \since BeOS R3 1802*/ 1803 1804 1805/*! 1806 \fn status_t BWindow::SetFlags(uint32 flags) 1807 \brief Changes the window flags set in the constructor to \a flags. 1808 1809 \return \c B_OK on success or an error code on failure. 1810 1811 \since BeOS R3 1812*/ 1813 1814 1815/*! 1816 \fn uint32 BWindow::Flags() const 1817 \brief Returns the current window flags. 1818 1819 \return The currently set window flags. 1820 1821 \since BeOS R3 1822*/ 1823 1824 1825/*! 1826 \fn status_t BWindow::SetWindowAlignment(window_alignment mode, 1827 int32 h, int32 hOffset, int32 width, int32 widthOffset, 1828 int32 v, int32 vOffset, int32 height, int32 heightOffset) 1829 \brief Sets the alignment of the content of the window on the screen. 1830 1831 \since BeOS R3 1832*/ 1833 1834 1835/*! 1836 \fn status_t BWindow::GetWindowAlignment(window_alignment* mode, 1837 int32* h, int32* hOffset, int32* width, int32* widthOffset, 1838 int32* v, int32* vOffset, int32* height, int32* heightOffset) const 1839 \brief Fills out the pointers with the alignment of the content of the 1840 window on the screen. 1841 1842 \since BeOS R3 1843*/ 1844 1845 1846/*! 1847 \fn uint32 BWindow::Workspaces() const 1848 \brief Returns the set of workspaces where the window can be displayed. 1849 1850 \since BeOS R3 1851*/ 1852 1853 1854/*! 1855 \fn void BWindow::SetWorkspaces(uint32 workspaces) 1856 \brief Sets the set of workspaces where the window can be displayed. 1857 1858 \param workspaces 1859 - \c B_CURRENT_WORKSPACE to place the window in the currently displayed 1860 workspace removing it from all others. 1861 - \c B_ALL_WORKSPACES to make the window show up in all workspaces. 1862 1863 \since BeOS R3 1864*/ 1865 1866 1867/*! 1868 \fn BView* BWindow::LastMouseMovedView() const 1869 \brief Returns a pointer to the attached view that most recently received 1870 a \c B_MOUSE_MOVED message. 1871 1872 \return A pointer the BView object that most recently received a 1873 \c B_MOUSE_MOVED message or \c NULL if not found. 1874 1875 \since BeOS R3 1876*/ 1877 1878 1879/*! 1880 \fn void BWindow::MoveBy(float dx, float dy) 1881 \brief Move the window by \a dx pixels horizontally and \a dy pixels 1882 vertically. 1883 1884 \a dx and \a dy must be integral units. 1885 1886 \param dx The number of pixels to move the window vertically. 1887 \param dy The number of pixels to move the window horizontally. 1888 1889 \since BeOS R3 1890*/ 1891 1892 1893/*! 1894 \fn void BWindow::MoveTo(BPoint point) 1895 \brief Move the window to \a point. 1896 1897 \param point the location to move the window in the screen's coordinate 1898 system. 1899 1900 \since BeOS R3 1901*/ 1902 1903 1904/*! 1905 \fn void BWindow::MoveTo(float x, float y) 1906 \brief Move the window to the specified \a x and \a y coordinates. 1907 1908 \a x and \a y must be integral units. 1909 1910 \param x The horizontal coordinate to move the window to in the screen's 1911 coordinate system. 1912 \param y The vertical coordinate to move the window to in the screen's 1913 coordinate system. 1914 1915 \since BeOS R3 1916*/ 1917 1918 1919/*! 1920 \fn void BWindow::ResizeBy(float dx, float dy) 1921 \brief Resize the window by \a dx pixels horizontally and \a dy pixels vertically. 1922 1923 \a dx and \a dy must be integral units. 1924 1925 \brief dx The number of pixels to resize the window horizontally. 1926 \brief dy The number of pixels to resize the window vertically. 1927 1928 \since BeOS R3 1929*/ 1930 1931 1932/*! 1933 \fn void BWindow::ResizeTo(float width, float height) 1934 \brief Resize the window to the specified \a width and \a height. 1935 1936 \a width and \a height must be integral units. 1937 1938 \param width The width to resize the window to. 1939 \param height The height to resize the window to. 1940 1941 \since BeOS R3 1942*/ 1943 1944 1945/*! 1946 \fn void BWindow::CenterIn(const BRect& rect) 1947 \brief Center the window in \a rect. 1948 1949 \param rect The rectangle to center the window in. 1950 1951 \since Haiku R1 1952*/ 1953 1954 1955/*! 1956 \fn void BWindow::CenterOnScreen() 1957 \brief Centers the window on the screen the window is currently on. 1958 1959 \since Haiku R1 1960*/ 1961 1962 1963/*! 1964 \fn void BWindow::CenterOnScreen(screen_id id) 1965 \brief Centers the window on the screen with the passed in \a id. 1966 1967 \since Haiku R1 1968*/ 1969 1970 1971/*! 1972 \fn bool BWindow::IsOffscreenWindow() const 1973 \brief Tests if window is used for drawing into a BBitmap. 1974 This is mostly used by the Interface Kit itself. 1975 1976 \return True if the window is used for drawing into a BBitmap. 1977 1978 \since Haiku R1 1979*/ 1980 1981 1982/*! 1983 \fn void BWindow::Show() 1984 \brief Shows the window on screen, places it frontmost on the screen, adds 1985 the window to Deskbar's window list, and makes it the active window. 1986 1987 If this is the first time Show() has been called on the window the message loop 1988 is started and it is unlocked. 1989 1990 Calls to Hide() and Show() are cumulative. 1991 1992 \since BeOS R3 1993*/ 1994 1995 1996/*! 1997 \fn void BWindow::Hide() 1998 \brief Removes the window from the screen, removes it from Deskbar's window 1999 list, and passes active status to another window. 2000 2001 Calls to Hide() and Show() are cumulative. 2002 2003 \since BeOS R3 2004*/ 2005 2006 2007/*! 2008 \fn bool BWindow::IsHidden() const 2009 \brief Returns whether or not the window is hidden. 2010 2011 Windows are hidden by default, you must call Show() to show the window starting 2012 the message loop going. 2013 2014 \since BeOS R3 2015*/ 2016 2017 2018/*! 2019 \fn bool BWindow::QuitRequested() 2020 \brief Hook method that gets called when the window receives a 2021 \a B_QUIT_REQUESTED message. 2022 2023 \see Quit() 2024 \see BLooper::QuitRequested() 2025 2026 \since BeOS R3 2027*/ 2028 2029 2030/*! 2031 \fn thread_id BWindow::Run() 2032 \brief Spawns the message loop thread and starts the window running. 2033 2034 \see BLooper::Run() 2035 2036 \since BeOS R3 2037*/ 2038 2039 2040/*! 2041 \fn void BWindow::SetLayout(BLayout* layout) 2042 \brief Sets the \a layout of the window. 2043 2044 \param layout The \a layout to set. 2045 2046 \since Haiku R1 2047*/ 2048 2049 2050/*! 2051 \fn BLayout* BWindow::GetLayout() const 2052 \brief Get the layout of the window. 2053 2054 \returns The layout of the window. 2055 2056 \since Haiku R1 2057*/ 2058 2059 2060/*! 2061 \fn void BWindow::InvalidateLayout(bool descendants) 2062 \brief Invalidate layout. 2063 2064 \param descendants Also invalidate its children windows. 2065 2066 \since Haiku R1 2067*/ 2068 2069 2070/*! 2071 \fn void BWindow::Layout(bool force) 2072 \brief Update the size limits and do the layout of the topmost view attached 2073 to the window. 2074 2075 \param force If \c true, layout even if valid. 2076 2077 \since Haiku R1 2078*/ 2079 2080 2081/*! 2082 \fn status_t BWindow::GetSupportedSuites(BMessage* data) 2083 \brief Reports the suites of messages and specifiers understood by the window. 2084 2085 \copydetails BLooper::GetSupportedSuites() 2086*/ 2087 2088 2089/*! 2090 \fn BHandler* BWindow::ResolveSpecifier(BMessage* message, int32 index, 2091 BMessage* specifier, int32 what, const char* property) 2092 \copydoc BLooper::ResolveSpecifier() 2093*/ 2094