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