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