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 whenever the workspaces the window is 1060 in changes. 1061 1062 \param oldWorkspaces The old set of workspaces the window was visible in. 1063 \param newWorkspaces The new set of workspaces the window is visible in. 1064 1065 \since BeOS R3 1066*/ 1067 1068 1069/*! 1070 \fn void BWindow::WorkspaceActivated(int32 workspace, bool state) 1071 \brief Hook method that gets called when the active workspace changes. 1072 1073 This method is only called when a workspace in which the window resides 1074 is activated or deactivated. 1075 1076 \param workspace The \a workspace number that was activated/deactivated. 1077 \param state \c true if activated, \c false if deactivated. 1078 1079 \since BeOS R3 1080*/ 1081 1082 1083/*! 1084 \fn void BWindow::MenusBeginning() 1085 \brief Hook method that gets called just before a menu owned by the window is 1086 shown. 1087 1088 \note This method is not invoked by a message, there is no 1089 \c B_MENUS_BEGINNING flag. 1090 1091 \since BeOS R3 1092*/ 1093 1094 1095/*! 1096 \fn void BWindow::MenusEnded() 1097 \brief Hook method that gets called just before a menu owned by the window is 1098 hidden. 1099 1100 \note This method is not invoked by a message, there is no 1101 \c B_MENUS_ENDED flag. 1102 1103 \since BeOS R3 1104*/ 1105 1106 1107/*! 1108 \fn void BWindow::SetSizeLimits(float minWidth, float maxWidth, 1109 float minHeight, float maxHeight) 1110 \brief Set size limits on the window. 1111 1112 The user won't be able to resize the window beyond the limits set by this 1113 method. SetSizeLimits() constrains the user, not the programmer, you may 1114 still resize the window outside of the size limits set by this method by 1115 calling ResizeBy() or ResizeTo(). 1116 1117 \param minWidth The minimum width of the window to set. 1118 \param maxWidth The maximum width of the window to set. 1119 \param minHeight The minimum height of the window to set. 1120 \param maxHeight The maximum height of the window to set. 1121 1122 \since BeOS R3 1123*/ 1124 1125 1126/*! 1127 \fn void BWindow::GetSizeLimits(float* _minWidth, float* _maxWidth, 1128 float* _minHeight, float* _maxHeight) 1129 \brief Fills out the size limits set on the window. 1130 1131 \param _minWidth The minimum width of the window. 1132 \param _maxWidth The maximum width of the window. 1133 \param _minHeight The minimum height of the window. 1134 \param _maxHeight The maximum height of the window. 1135 1136 \since BeOS R3 1137*/ 1138 1139 1140/*! 1141 \fn void BWindow::UpdateSizeLimits() 1142 \brief Updates the window's size limits from the minimum and maximum sizes 1143 of its top view. 1144 1145 This method does nothing unless the \c B_AUTO_UPDATE_SIZE_LIMITS window flag 1146 is set. 1147 1148 The method is called automatically after a layout invalidation. Since it is 1149 invoked asynchronously, calling this method manually is necessary, if it is 1150 desired to adjust the limits (and as a possible side effect the window size) 1151 earlier, e.g. before the first call to the Show() method.) 1152 1153 \since Haiku R1 1154*/ 1155 1156 1157/*! 1158 \fn status_t BWindow::SetDecoratorSettings(const BMessage& settings) 1159 \brief Set the window decorator settings according to \a settings. 1160 1161 \param settings The decorator \a settings message to set. 1162 1163 \returns \c B_OK if the decorator settings were set successfully or an error 1164 code otherwise. 1165 1166 \since Haiku R1 1167*/ 1168 1169 1170/*! 1171 \fn status_t BWindow::GetDecoratorSettings(BMessage* settings) const 1172 \brief Fill out the window's decorator settings into \a settings. 1173 1174 \param settings A pointer to a BMessage object to fill out. 1175 1176 \returns \c B_OK if the decorator settings were filled out successfully 1177 or an error code otherwise. 1178 1179 \since Haiku R1 1180*/ 1181 1182 1183/*! 1184 \fn void BWindow::SetZoomLimits(float maxWidth, float maxHeight) 1185 \brief Sets the maximum size that the window will zoom to when Zoom() is 1186 called. 1187 1188 The window will zoom to the minimum of the screen size, the maximum values 1189 set by SetSizeLimits(), and the maximum values set by this method. 1190 1191 /see Zoom() 1192 1193 \since BeOS R3 1194*/ 1195 1196 1197/*! 1198 \fn void BWindow::Zoom(BPoint origin, float width, float height) 1199 \brief Move window to \a origin, then resize to \a width and \a height. 1200 1201 You may call Zoom() even if the window has the \c B_NOT_ZOOMABLE flag set. 1202 1203 This method may move and resize the window resulting in both the 1204 FrameMoved() and FrameResized() hook methods to be called. 1205 1206 You can override this method to change how your window behaves when the 1207 user clicks the zoom button or when Zoom() is called. 1208 1209 \param origin The point that the window was moved to. 1210 \param width The new width of the window. 1211 \param height The new height of the window. 1212 1213 \since BeOS R3 1214*/ 1215 1216 1217/*! 1218 \fn void BWindow::Zoom() 1219 \brief Resize the window to the minimum of the screen size, the maximum 1220 values set by SetSizeLimits(), and the maximum values set by 1221 SetZoomLimits(). 1222 1223 You may call Zoom() even if the window has the \c B_NOT_ZOOMABLE flag set. 1224 1225 This is the method called when the user clicks the window's zoom button. 1226 It can also be called programmatically. 1227 1228 The window dimensions are calculated from the smallest of three rectangles: 1229 -# the screen frame, 1230 -# the rectangle defined by SetZoomLimits(), 1231 -# the rectangle defined by SetSizeLimits(). 1232 1233 However if the window frame already matches these new dimensions, Zoom() 1234 uses the previous size and location of the window instead. 1235 1236 This method calls Zoom(BPoint, float, float) to do the actualy zooming. 1237 1238 \see Zoom(BPoint, float, float); 1239 1240 \since BeOS R3 1241*/ 1242 1243 1244/*! 1245 \fn void BWindow::ScreenChanged(BRect screenSize, color_space depth) 1246 \brief Hook method that is called when the screen that the window is located 1247 on changes size or location or the color space of the screen changes. 1248 1249 \param screenSize The new screen size in the screen's coordinate system. 1250 \param depth The new color space of the screen. 1251 1252 \since BeOS R3 1253*/ 1254 1255 1256/*! 1257 \fn void BWindow::SetPulseRate(bigtime_t rate) 1258 \brief Sets how often \c B_PULSE messages are posted to the window. 1259 1260 All BViews attached to a window share the same pulse rate. 1261 1262 \a rate should not be set to less than 100,000 microseconds, differences less 1263 than 50,000 microseconds may not be noticeable. 1264 1265 Setting the \a rate to 0 disables pulsing for all views attache to the window. 1266 1267 \param rate The pulse rate to set. 1268 1269 \since BeOS R3 1270*/ 1271 1272 1273/*! 1274 \fn bigtime_t BWindow::PulseRate() const 1275 \brief Returns the pulse rate of the window. 1276 1277 \c B_PULSE messages are sent by default every 500,000 microseconds provided 1278 that no other messages are pending. 1279 1280 \returns The pulse rate of the window as a bigtime_t. 1281 1282 \since BeOS R3 1283*/ 1284 1285 1286/*! 1287 \name Shortcut Methods 1288 1289 The key parameter is specified in the form of a Unicode code point. This 1290 is generally an ASCII character such as 'A' or a key constant such as 1291 \c B_RIGHT_ARROW. To use a UTF-8 character you must first convert it to a 1292 Unicode code point using BUnicodeChar::FromUTF8(). 1293*/ 1294 1295 1296//! @{ 1297 1298 1299/*! 1300 \fn void BWindow::AddShortcut(uint32 key, uint32 modifiers, BMenuItem* item) 1301 \brief Creates a keyboard shortcut that activates a menu \a item. 1302 1303 \param key The character that activates the shortcut, case-insensitive. 1304 \param modifiers A bit mask of modifiers in addition to \c B_COMMAND_KEY, 1305 options include: 1306 - \c B_SHIFT_KEY 1307 - \c B_OPTION_KEY 1308 - \c B_CONTROL_KEY 1309 - \c B_MENU_KEY 1310 \param item The menu \a item to activate. 1311 1312 \since Haiku R1 1313*/ 1314 1315 1316/*! 1317 \fn void BWindow::AddShortcut(uint32 key, uint32 modifiers, BMessage* message) 1318 \brief Creates a keyboard shortcut that sends a \a message to the window. 1319 1320 \warning Don't use this method to a create menu shortcut, add a BMenuItem 1321 instead. 1322 1323 \param key The character that activates the shortcut, case-insensitive. 1324 \param modifiers A bit mask of modifiers in addition to \c B_COMMAND_KEY, 1325 options include: 1326 - \c B_SHIFT_KEY 1327 - \c B_OPTION_KEY 1328 - \c B_CONTROL_KEY 1329 - \c B_MENU_KEY 1330 \param message The \a message to send when the shortcut is activated. The 1331 BWindow takes ownership of the \a message. 1332 1333 \since BeOS R3 1334*/ 1335 1336 1337/*! 1338 \fn void BWindow::AddShortcut(uint32 key, uint32 modifiers, BMessage* message, 1339 BHandler* target) 1340 \brief Creates a keyboard shortcut that sends a \a message to the specified 1341 \a target. 1342 1343 \warning Don't use this method to a create menu shortcut, add a BMenuItem 1344 instead. 1345 1346 \param key The character that activates the shortcut, case-insensitive. 1347 \param modifiers A bit mask of modifiers in addition to \c B_COMMAND_KEY, 1348 options include one or more of the following: 1349 - \c B_SHIFT_KEY 1350 - \c B_OPTION_KEY 1351 - \c B_CONTROL_KEY 1352 - \c B_MENU_KEY 1353 \param message The \a message to send when the shortcut is activated. The 1354 BWindow takes ownership of the \a message. 1355 \param target The handler to send the message to. 1356 1357 \since BeOS R3 1358*/ 1359 1360 1361/*! 1362 \fn bool BWindow::HasShortcut(uint32 key, uint32 modifiers) 1363 \brief Returns whether or not the specified shortcut is set on the window. 1364 1365 \param key The character to check, case-insensitive. 1366 \param modifiers A bit mask of modifiers in addition to \c B_COMMAND_KEY, 1367 options include one or more of the following: 1368 - \c B_SHIFT_KEY 1369 - \c B_OPTION_KEY 1370 - \c B_CONTROL_KEY 1371 - \c B_MENU_KEY 1372 1373 \returns \c true if the window has the specified shortcut, \c false 1374 otherwise. 1375 1376 \since Haiku R1 1377*/ 1378 1379 1380/*! 1381 \fn void BWindow::RemoveShortcut(uint32 key, uint32 modifiers) 1382 \brief Removes the specified shortcut from the window. 1383 1384 The memory used by the shortcut message is freed. 1385 1386 \param key The character to remove, case-insensitive. 1387 \param modifiers A bit mask of modifiers in addition to \c B_COMMAND_KEY, 1388 options include one or more of the following: 1389 - \c B_SHIFT_KEY 1390 - \c B_OPTION_KEY 1391 - \c B_CONTROL_KEY 1392 - \c B_MENU_KEY 1393 1394 \since BeOS R3 1395*/ 1396 1397 1398//! @} 1399 1400 1401/*! 1402 \fn BButton* BWindow::DefaultButton() const 1403 \brief Returns a pointer to the default button set on the window. 1404 1405 \return A pointer to the window's default button or \c NULL if it doesn't 1406 have one. 1407 1408 \since BeOS R3 1409*/ 1410 1411 1412/*! 1413 \fn void BWindow::SetDefaultButton(BButton* button) 1414 \brief Set the default button of the window to \a button. 1415 1416 The default button has a grey outline and is activated by the user pushing 1417 the Enter key. The user can activate the default button even if another view 1418 is currently set to be the focus view of the window. 1419 1420 A window may only have one default button at a time, to remove the current 1421 default without setting another button you may pass in \c NULL. 1422 1423 \param button A pointer to the button to set as the default or \c NULL to 1424 unset. 1425 1426 \since BeOS R3 1427*/ 1428 1429 1430/*! 1431 \fn bool BWindow::NeedsUpdate() const 1432 \brief Returns whether or not any of the attached views need to be updated. 1433 1434 \return \c true if an attached view needs to be updated, \c false otherwise. 1435 1436 \since BeOS R3 1437*/ 1438 1439 1440/*! 1441 \fn void BWindow::UpdateIfNeeded() 1442 \brief Invokes Draw() immediately on each child view that needs updating. 1443 1444 This method is synchronous, it waits for each child view to update before 1445 returning. This method is ignored unless it is called from within the message 1446 loop of the thread that the BWindow is running in. 1447 1448 You may call this method as part of a hook function such as MouseMoved() or 1449 KeyDown() to force invalid views to be immediately redrawn without having to 1450 wait for the hook function to finish. 1451 1452 \since BeOS R3 1453*/ 1454 1455 1456/*! 1457 \fn BView* BWindow::FindView(const char* viewName) const 1458 \brief Returns the attached view with the specified \a viewName. 1459 1460 \param viewName The name of the attached view to look for. 1461 1462 \return A pointer to the BView object or \c NULL if no view is found. 1463 1464 \since BeOS R3 1465*/ 1466 1467 1468/*! 1469 \fn BView* BWindow::FindView(BPoint point) const 1470 \brief Returns a pointer to the attached view located at the specified 1471 \a point. 1472 1473 \param point The \a point to get the view at in the window's coordinate 1474 system. 1475 1476 \return A pointer to the BView object or \c NULL if no view is found. 1477 1478 \since BeOS R3 1479*/ 1480 1481 1482/*! 1483 \fn BView* BWindow::CurrentFocus() const 1484 \brief Returns a pointer to the current focus view of the window. 1485 1486 \return A pointer to the current focus view of the window or \c NULL if 1487 not found. 1488 1489 \since BeOS R3 1490*/ 1491 1492 1493/*! 1494 \fn void BWindow::Activate(bool active) 1495 \brief Activates or deactivates the window based on \a active. 1496 1497 The title tab of the active window is drawn more brightly, the window is made 1498 frontmost, and it becomes the target of keyboard events. Calling Show() 1499 automatically activates the window calling the WindowActivated() hook method. 1500 1501 \param active \c true to activate the window, \c false to deactivate the 1502 window. 1503 1504 \since BeOS R3 1505*/ 1506 1507 1508/*! 1509 \fn void BWindow::WindowActivated(bool active) 1510 \brief Hook method that gets called when the window becomes activated or 1511 deactivated. 1512 1513 \param active \c true if the window has become activated, \c false if the 1514 window has become deactivated. 1515 1516 \since BeOS R3 1517*/ 1518 1519 1520/*! 1521 \fn void BWindow::ConvertToScreen(BPoint* point) const 1522 \brief Convert \a point to the screen's coordinate system in place. 1523 1524 \param point A pointer to a BPoint object to convert. 1525 1526 \since BeOS R3 1527*/ 1528 1529 1530/*! 1531 \fn BPoint BWindow::ConvertToScreen(BPoint point) const 1532 \brief Returns \a point converted to the screen's coordinate system. 1533 1534 \param point A BPoint object to convert. 1535 1536 \return A new BPoint object in the screen's coordinate system. 1537 1538 \since BeOS R3 1539*/ 1540 1541 1542/*! 1543 \fn void BWindow::ConvertFromScreen(BPoint* point) const 1544 \brief Convert \a point from the screen's coordinate system to the 1545 window's coordinate system in place. 1546 1547 \param point A pointer to a BPoint object to convert. 1548 1549 \since BeOS R3 1550*/ 1551 1552 1553/*! 1554 \fn BPoint BWindow::ConvertFromScreen(BPoint point) const 1555 \brief Returns \a point converted from the screen's coordinate system to 1556 the window's coordinate system. 1557 1558 \param point A BPoint object to convert. 1559 1560 \return A new BPoint object in the window's coordinate system. 1561 1562 \since BeOS R3 1563*/ 1564 1565 1566/*! 1567 \fn void BWindow::ConvertToScreen(BRect* rect) const 1568 \brief Convert \a rect to the screen's coordinate system in place. 1569 1570 \param rect A pointer to a BRect object to convert. 1571 1572 \since BeOS R3 1573*/ 1574 1575 1576/*! 1577 \fn BRect BWindow::ConvertToScreen(BRect rect) const 1578 \brief Returns \a rect converted to the screen's coordinate system. 1579 1580 \param rect A BRect object to convert. 1581 1582 \return A new BRect object in the screen's coordinate system. 1583 1584 \since BeOS R3 1585*/ 1586 1587 1588/*! 1589 \fn void BWindow::ConvertFromScreen(BRect* rect) const 1590 \brief Convert \a rect from the screen's coordinate system to the 1591 window's coordinate system in place. 1592 1593 \param rect A pointer to a BRect object to convert. 1594 1595 \since BeOS R3 1596*/ 1597 1598 1599/*! 1600 \fn BRect BWindow::ConvertFromScreen(BRect rect) const 1601 \brief Returns \a rect converted from the screen's coordinate system to the 1602 window's coordinate system. 1603 1604 \param rect A BRect object to convert. 1605 1606 \return A new BRect object in the window's coordinate system. 1607 1608 \since BeOS R3 1609*/ 1610 1611 1612/*! 1613 \fn bool BWindow::IsMinimized() const 1614 \brief Returns whether or not the window is minimized. 1615 1616 \return \c true if the window is minimized, \c false otherwise. 1617 1618 \since BeOS R5 1619*/ 1620 1621 1622/*! 1623 \fn BRect BWindow::Bounds() const 1624 \brief Returns the bounding rectangle of the window. 1625 1626 \return The bounding rectangle of the window as a BRect in the window's 1627 coordinate system. 1628 1629 \sa Frame() 1630 1631 \since BeOS R3 1632*/ 1633 1634 1635/*! 1636 \fn BRect BWindow::Frame() const 1637 \brief Returns the frame rectangle of the window. 1638 1639 \return The bounding rectangle of the window as a BRect in the screen 1640 coordinate system. 1641 1642 \sa Bounds() 1643 1644 \since BeOS R3 1645*/ 1646 1647 1648/*! 1649 \fn BRect BWindow::DecoratorFrame() const 1650 \brief Returns the frame rectangle of the window decorator. 1651 1652 \return The bounding rectangle of the window decorator as a BRect in the 1653 screen coordinate system. 1654 1655 \since Haiku R1 1656*/ 1657 1658 1659/*! 1660 \fn BSize BWindow::Size() const 1661 \brief Returns the size of the window. 1662 1663 \return The size of the window as a BSize in the screen coordinate system. 1664 1665 \since Haiku R1 1666*/ 1667 1668 1669/*! 1670 \fn const char* BWindow::Title() const 1671 \brief Returns the window title as set by the constructor or SetTitle(). 1672 1673 \return A pointer to the window title. 1674 1675 \since BeOS R3 1676*/ 1677 1678 1679/*! 1680 \fn void BWindow::SetTitle(const char* title) 1681 \brief Sets the window title to \a title. 1682 1683 Also renames the window thread to "w>title" where "title" is the passed in 1684 title string. 1685 1686 \since BeOS R5 1687*/ 1688 1689 1690/*! 1691 \fn bool BWindow::IsActive() const 1692 \brief Returns whether or not the window is active. 1693 1694 \return \c true if the window is active, \c false otherwise. 1695 1696 \since BeOS R3 1697*/ 1698 1699 1700/*! 1701 \fn void BWindow::SetKeyMenuBar(BMenuBar* bar) 1702 \brief Set the specified menu \a bar as the key menu bar for the window. 1703 1704 The key menu bar is the one located at the top of the window at the root of 1705 the menu hierarchy that the user can navigate with the keyboard. 1706 1707 \param bar A pointer to the menu \a bar to set as as the key menu \a bar for 1708 the window. 1709 1710 \since BeOS R3 1711*/ 1712 1713 1714/*! 1715 \fn BMenuBar* BWindow::KeyMenuBar() const 1716 \brief Returns a pointer to the key menu bar set to the window. 1717 1718 If the window contains only one menu bar it is automatically considered to be 1719 the key menu bar for the window. If more than one menu bar is attached to the 1720 window then the last one added to the window's view hierarchy is considered 1721 to be the key menu bar for the window. 1722 1723 To explicitly set a menu bar as the key menu bar call SetKeyMenuBar(). 1724 1725 \return A pointer to the key menu bar or \c NULL is not is set. 1726 1727 \since BeOS R3 1728*/ 1729 1730 1731/*! 1732 \fn bool BWindow::IsModal() const 1733 \brief Returns whether or not the window is modal. 1734 1735 \return \c true if the window is modal, \c false otherwise. 1736 1737 \since BeOS R3 1738*/ 1739 1740 1741/*! 1742 \fn bool BWindow::IsFloating() const 1743 \brief Returns whether or not the window is floating. 1744 1745 \return \c true if the window is floating, \c false otherwise. 1746 1747 \since BeOS R3 1748*/ 1749 1750 1751/*! 1752 \fn status_t BWindow::AddToSubset(BWindow* window) 1753 \brief Adds \a window to be in the subset of the BWindow. 1754 1755 \return A status code. 1756 \retval B_OK \a window was added as a subset of the BWindow. 1757 \retval B_BAD_VALUE \c window is not \c B_NORMAL_WINDOW_FEEL or the BWindow 1758 object's feel is not set to \c B_MODAL_SUBSET_WINDOW_FEEL or 1759 \c B_FLOATING_SUBSET_WINDOW_FEEL. 1760 \retval B_ERROR Could not lock the BWindow object. 1761 1762 \since BeOS R3 1763*/ 1764 1765 1766/*! 1767 \fn status_t BWindow::RemoveFromSubset(BWindow* window) 1768 \brief Remove \a window from the subset of the BWindow. 1769 1770 \return A status code. 1771 \retval B_OK \a window was removed from the subset of the BWindow. 1772 \retval B_BAD_VALUE \c window is not \c B_NORMAL_WINDOW_FEEL or the BWindow 1773 object's feel is not set to \c B_MODAL_SUBSET_WINDOW_FEEL or 1774 \c B_FLOATING_SUBSET_WINDOW_FEEL. 1775 \retval B_ERROR Could not lock the BWindow object. 1776 1777 \since BeOS R3 1778*/ 1779 1780 1781/*! 1782 \fn status_t BWindow::SetType(window_type type) 1783 \brief Changes the window type set in the constructor to \a type. 1784 1785 \return \c B_OK on success or an error code on failure. 1786 1787 \since BeOS R3 1788*/ 1789 1790 1791/*! 1792 \fn window_type BWindow::Type() const 1793 \brief Returns the current window type flag. 1794 1795 \return The currently set window type flag. 1796 1797 \since BeOS R3 1798*/ 1799 1800 1801/*! 1802 \fn status_t BWindow::SetLook(window_look look) 1803 \brief Changes the window look set in the constructor to \a look. 1804 1805 \return \c B_OK on success or an error code on failure. 1806 1807 \since BeOS R3 1808*/ 1809 1810 1811/*! 1812 \fn window_look BWindow::Look() const 1813 \brief Returns the current window look flag. 1814 1815 \return The currently set window look flag. 1816 1817 \since BeOS R3 1818*/ 1819 1820 1821/*! 1822 \fn status_t BWindow::SetFeel(window_feel feel) 1823 \brief Changes the window feel set in the constructor to \a feel. 1824 1825 \return \c B_OK on success or an error code on failure. 1826 1827 \since BeOS R3 1828*/ 1829 1830 1831/*! 1832 \fn window_feel BWindow::Feel() const 1833 \brief Returns the current window feel flag. 1834 1835 \return The currently set window feel flag. 1836 1837 \since BeOS R3 1838*/ 1839 1840 1841/*! 1842 \fn status_t BWindow::SetFlags(uint32 flags) 1843 \brief Changes the window flags set in the constructor to \a flags. 1844 1845 \return \c B_OK on success or an error code on failure. 1846 1847 \since BeOS R3 1848*/ 1849 1850 1851/*! 1852 \fn uint32 BWindow::Flags() const 1853 \brief Returns the current window flags. 1854 1855 \return The currently set window flags. 1856 1857 \since BeOS R3 1858*/ 1859 1860 1861/*! 1862 \fn status_t BWindow::SetWindowAlignment(window_alignment mode, 1863 int32 h, int32 hOffset, int32 width, int32 widthOffset, 1864 int32 v, int32 vOffset, int32 height, int32 heightOffset) 1865 \brief Sets the alignment of the content of the window on the screen. 1866 1867 \since BeOS R3 1868*/ 1869 1870 1871/*! 1872 \fn status_t BWindow::GetWindowAlignment(window_alignment* mode, 1873 int32* h, int32* hOffset, int32* width, int32* widthOffset, 1874 int32* v, int32* vOffset, int32* height, int32* heightOffset) const 1875 \brief Fills out the pointers with the alignment of the content of the 1876 window on the screen. 1877 1878 \since BeOS R3 1879*/ 1880 1881 1882/*! 1883 \fn uint32 BWindow::Workspaces() const 1884 \brief Returns the set of workspaces where the window can be displayed. 1885 1886 \since BeOS R3 1887*/ 1888 1889 1890/*! 1891 \fn void BWindow::SetWorkspaces(uint32 workspaces) 1892 \brief Sets the set of workspaces where the window can be displayed. 1893 1894 \param workspaces 1895 - \c B_CURRENT_WORKSPACE to place the window in the currently displayed 1896 workspace removing it from all others. 1897 - \c B_ALL_WORKSPACES to make the window show up in all workspaces. 1898 1899 \since BeOS R3 1900*/ 1901 1902 1903/*! 1904 \fn BView* BWindow::LastMouseMovedView() const 1905 \brief Returns a pointer to the attached view that most recently received 1906 a \c B_MOUSE_MOVED message. 1907 1908 \return A pointer the BView object that most recently received a 1909 \c B_MOUSE_MOVED message or \c NULL if not found. 1910 1911 \since BeOS R3 1912*/ 1913 1914 1915/*! 1916 \fn void BWindow::MoveBy(float dx, float dy) 1917 \brief Move the window by \a dx pixels horizontally and \a dy pixels 1918 vertically. 1919 1920 \a dx and \a dy must be integral units. 1921 1922 \param dx The number of pixels to move the window vertically. 1923 \param dy The number of pixels to move the window horizontally. 1924 1925 \since BeOS R3 1926*/ 1927 1928 1929/*! 1930 \fn void BWindow::MoveTo(BPoint point) 1931 \brief Move the window to \a point. 1932 1933 \param point the location to move the window in the screen's coordinate 1934 system. 1935 1936 \since BeOS R3 1937*/ 1938 1939 1940/*! 1941 \fn void BWindow::MoveTo(float x, float y) 1942 \brief Move the window to the specified \a x and \a y coordinates. 1943 1944 \a x and \a y must be integral units. 1945 1946 \param x The horizontal coordinate to move the window to in the screen's 1947 coordinate system. 1948 \param y The vertical coordinate to move the window to in the screen's 1949 coordinate system. 1950 1951 \since BeOS R3 1952*/ 1953 1954 1955/*! 1956 \fn void BWindow::ResizeBy(float dx, float dy) 1957 \brief Resize the window by \a dx pixels horizontally and \a dy pixels vertically. 1958 1959 \a dx and \a dy must be integral units. 1960 1961 \brief dx The number of pixels to resize the window horizontally. 1962 \brief dy The number of pixels to resize the window vertically. 1963 1964 \since BeOS R3 1965*/ 1966 1967 1968/*! 1969 \fn void BWindow::ResizeTo(float width, float height) 1970 \brief Resize the window to the specified \a width and \a height. 1971 1972 \a width and \a height must be integral units. 1973 1974 \param width The width to resize the window to. 1975 \param height The height to resize the window to. 1976 1977 \since BeOS R3 1978*/ 1979 1980 1981/*! 1982 \fn void BWindow::ResizeToPreferred() 1983 \brief Resize the window to the preferred size of the window's layout. 1984 1985 \since Haiku R1 1986*/ 1987 1988 1989/*! 1990 \fn void BWindow::CenterIn(const BRect& rect) 1991 \brief Center the window in \a rect. 1992 1993 \param rect The rectangle to center the window in. 1994 1995 \since Haiku R1 1996*/ 1997 1998 1999/*! 2000 \fn void BWindow::CenterOnScreen() 2001 \brief Centers the window on the screen the window is currently on. 2002 2003 \since Haiku R1 2004*/ 2005 2006 2007/*! 2008 \fn void BWindow::CenterOnScreen(screen_id id) 2009 \brief Centers the window on the screen with the passed in \a id. 2010 2011 \since Haiku R1 2012*/ 2013 2014 2015/*! 2016 \fn void BWindow::MoveOnScreen(uint32 flags=0) 2017 \brief Update window size and position to make it visible on screen. 2018 2019 This convenience method helps you to automatically move and resize a window 2020 to make it visible on the screen, in case the window is partially off 2021 screen because of its size or its position. This method will do nothing if 2022 the window fits on the screen. 2023 2024 The default behavior is as follows: 2025 - If the window size is larger than the screen, the window is resized 2026 so that it fits on the screen. 2027 - If the window is still partially off-screen, it will then be centered 2028 horizontally and vertically so that it is fully visible. 2029 2030 Note that this does not affect window size and positions for windows that 2031 are currently visible on the screen. Also note that this method does not 2032 affect whether the window is covered by other windows that are on top. You 2033 can use \ref BWindow::Activate() to bring a window to the top. 2034 2035 The behavior of this method can be altered by passing either or both of the 2036 following modifiers in the \a flags parameter: 2037 - \ref B_DO_NOT_RESIZE_TO_FIT Do not resize the window. If the window 2038 is too large to be on the screen, then it will at least be moved so 2039 that the left-top of the window is visible, and only the right and/or 2040 bottom of the window will be off screen. 2041 - \ref B_MOVE_IF_PARTIALLY_OFFSCREEN Use this parameter if instead of 2042 centering the window in the middle of the screen, you only want to 2043 do the minimum movement so that at least the top left part of the 2044 window is visible on screen. 2045 2046 \param flags Can be \c 0 for the default behavior, or a any combination of 2047 \c B_DO_NOT_RESIZE_TO_FIT and \c B_MOVE_IF_PARTIALLY_OFFSCREEN. 2048 2049 \since Haiku R1 2050*/ 2051 2052 2053/*! 2054 \fn bool BWindow::IsOffscreenWindow() const 2055 \brief Tests if window is used for drawing into a BBitmap. 2056 This is mostly used by the Interface Kit itself. 2057 2058 \return True if the window is used for drawing into a BBitmap. 2059 2060 \since Haiku R1 2061*/ 2062 2063 2064/*! 2065 \fn void BWindow::Show() 2066 \brief Shows the window on screen, places it frontmost on the screen, adds 2067 the window to Deskbar's window list, and makes it the active window. 2068 2069 If this is the first time Show() has been called on the window the message loop 2070 is started and it is unlocked. 2071 2072 Calls to Hide() and Show() are cumulative. 2073 2074 \since BeOS R3 2075*/ 2076 2077 2078/*! 2079 \fn void BWindow::Hide() 2080 \brief Removes the window from the screen, removes it from Deskbar's window 2081 list, and passes active status to another window. 2082 2083 Calls to Hide() and Show() are cumulative. 2084 2085 \since BeOS R3 2086*/ 2087 2088 2089/*! 2090 \fn bool BWindow::IsHidden() const 2091 \brief Returns whether or not the window is hidden. 2092 2093 Windows are hidden by default, you must call Show() to show the window starting 2094 the message loop going. 2095 2096 \since BeOS R3 2097*/ 2098 2099 2100/*! 2101 \fn bool BWindow::QuitRequested() 2102 \brief Hook method that gets called when the window receives a 2103 \a B_QUIT_REQUESTED message. 2104 2105 \see Quit() 2106 \see BLooper::QuitRequested() 2107 2108 \since BeOS R3 2109*/ 2110 2111 2112/*! 2113 \fn thread_id BWindow::Run() 2114 \brief Spawns the message loop thread and starts the window running. 2115 2116 \see BLooper::Run() 2117 2118 \since BeOS R3 2119*/ 2120 2121 2122/*! 2123 \fn void BWindow::SetLayout(BLayout* layout) 2124 \brief Sets the \a layout of the window. 2125 2126 \param layout The \a layout to set. 2127 2128 \since Haiku R1 2129*/ 2130 2131 2132/*! 2133 \fn BLayout* BWindow::GetLayout() const 2134 \brief Get the layout of the window. 2135 2136 \returns The layout of the window. 2137 2138 \since Haiku R1 2139*/ 2140 2141 2142/*! 2143 \fn void BWindow::InvalidateLayout(bool descendants) 2144 \brief Invalidate layout. 2145 2146 \param descendants Also invalidate its children windows. 2147 2148 \since Haiku R1 2149*/ 2150 2151 2152/*! 2153 \fn void BWindow::Layout(bool force) 2154 \brief Update the size limits and do the layout of the topmost view attached 2155 to the window. 2156 2157 \param force If \c true, layout even if valid. 2158 2159 \since Haiku R1 2160*/ 2161 2162 2163/*! 2164 \fn status_t BWindow::GetSupportedSuites(BMessage* data) 2165 \brief Reports the suites of messages and specifiers understood by the window. 2166 2167 \copydetails BLooper::GetSupportedSuites() 2168*/ 2169 2170 2171/*! 2172 \fn BHandler* BWindow::ResolveSpecifier(BMessage* message, int32 index, 2173 BMessage* specifier, int32 what, const char* property) 2174 \copydoc BLooper::ResolveSpecifier() 2175*/ 2176