/** Copyright 2011-2025 Haiku, Inc. All rights reserved.* Distributed under the terms of the MIT License.** Authors:* John Scipione, jscipione@gmail.com* Joseph Groover, looncraz@looncraz.net** Corresponds to:* headers/os/interface/Window.h hrev50816* src/kits/interface/Window.cpp hrev54774*//*!\file Window.h\ingroup interface\ingroup libbe\brief BWindow class definition and support data structures.*/// window_type/*!\enum window_type\ingroup interfaceCombined window look and feel constants. Define both the appearance andbehavior of a window.\since BeOS R3*//*!\var window_type B_UNTYPED_WINDOWA window of unknown or undefined type.\since BeOS R3*//*!\var window_type B_TITLED_WINDOW\c B_TITLED_WINDOW_LOOK and \c B_NORMAL_WINDOW_FEEL.\since BeOS R3*//*!\var window_type B_MODAL_WINDOW\c B_MODAL_WINDOW_LOOK and \c B_MODAL_APP_WINDOW_FEEL.\since BeOS R3*//*!\var window_type B_DOCUMENT_WINDOW\c B_DOCUMENT_WINDOW_LOOK and \c B_NORMAL_WINDOW_FEEL.\since BeOS R3*//*!\var window_type B_BORDERED_WINDOW\c B_BORDERED_WINDOW_LOOK and \c B_NORMAL_WINDOW_FEEL.\since BeOS R3*//*!\var window_type B_FLOATING_WINDOW\c B_FLOATING_WINDOW_LOOK and \c B_FLOATING_APP_WINDOW_FEEL.\since BeOS R3*/// window_look/*!\enum window_look\ingroup interfaceWindow look constants, define window appearance.\since BeOS R3*//*!\var window_look B_BORDERED_WINDOW_LOOKNo title bar, thin border, no resize control.\since BeOS R3*//*!\var window_look B_NO_BORDER_WINDOW_LOOKA borderless rectangle with no provisions to move or close the window.\since BeOS R5*//*!\var window_look B_TITLED_WINDOW_LOOKLike \c B_DOCUMENT_WINDOW_LOOK, but with a resize corner instead of a resizethumb.\since BeOS R3*//*!\var window_look B_DOCUMENT_WINDOW_LOOKLarge title bar, thick border, draggable resize corner thumb.\since BeOS R3*//*!\var window_look B_MODAL_WINDOW_LOOKFor modal dialogs: no title bar, thick border, resize corner depending on the\c B_NOT_RESIZABLE flag.\since BeOS R3*//*!\var window_look B_FLOATING_WINDOW_LOOKFor floating sub windows: small title bar, thin border, resize corner.\since BeOS R3*/// window_feel/*!\enum window_feel\ingroup interfaceWindow feel constants, define window behavior.\since BeOS R3*//*!\var window_feel B_NORMAL_WINDOW_FEELBehaves like a normal, non-modal, non-floating window.\since BeOS R3*//*!\var window_feel B_MODAL_SUBSET_WINDOW_FEELBlocks all windows in its subset when displayed. Visible only if a window inits subset is visible.\since BeOS R3*//*!\var window_feel B_MODAL_APP_WINDOW_FEELBlocks all windows in its app when displayed. Visible only if a window in itsapp is visible.\since BeOS R3*//*!\var window_feel B_MODAL_ALL_WINDOW_FEELBlocks all windows across the entire system when displayed. Always visiblein all workspaces.\since BeOS R3*//*!\var window_feel B_FLOATING_SUBSET_WINDOW_FEELFloats above all windows in its subset when displayed. Visible only if awindow in its subset is the frontmost window.\since BeOS R3*//*!\var window_feel B_FLOATING_APP_WINDOW_FEELFloats above all windows in its app when displayed. Visible only if awindow in its app is the frontmost window.\since BeOS R3*//*!\var window_feel B_FLOATING_ALL_WINDOW_FEELFloats above all windows across the entire system when displayed. Alwaysvisible in all workspaces.\since BeOS R3*/// window_alignment/*!\enum window_alignment\ingroup interfaceDefine window alignment.\since BeOS R3*//*!\var window_alignment B_BYTE_ALIGNMENTAligns window in terms of frame buffer offsets. Affects only horizontalorigin and width, can't align right and bottom edges in this mode.\since BeOS R3*//*!\var window_alignment B_PIXEL_ALIGNMENTAligns window in pixel coordinates.\since BeOS R3*/// window flags/*!\var B_NOT_MOVABLEWindow cannot be moved by the user.\since BeOS R3*//*!\var B_NOT_CLOSABLEWindow cannot be closed by the user, no close button is displayed.\since BeOS R3*//*!\var B_NOT_ZOOMABLEWindow cannot be zoomed by the user, no zoom button is displayed.\since BeOS R3*//*!\var B_NOT_MINIMIZABLEWindow cannot be minimized by the user.\since BeOS R3*//*!\var B_NOT_RESIZABLEWindow cannot be resized by the user.\since BeOS R3*//*!\var B_NOT_H_RESIZABLEWindow cannot be resized horizontally by the user.\since BeOS R3*//*!\var B_NOT_V_RESIZABLEWindow cannot be resized vertically by the user.\since BeOS R3*//*!\var B_AVOID_FRONTWindow cannot be brought to front.\since BeOS R3*//*!\var B_AVOID_FOCUSWindow cannot receive keyboard focus.\since BeOS R3*//*!\var B_WILL_ACCEPT_FIRST_CLICKThe first click will not just bring the window to front, it will also beprocessed by the window.\since BeOS R3*//*!\var B_OUTLINE_RESIZEWindow draws only its outline as it's resized and doesn't draw itscontents.\since BeOS R3*//*!\var B_NO_WORKSPACE_ACTIVATIONCauses the current workspace to stay active even if the window is activatedon another workspace.\since BeOS R3*//*!\var B_NOT_ANCHORED_ON_ACTIVATECauses the window to move to the current workspace when activated if it alreadyexists on another workspace.\since BeOS R3*//*!\var B_QUIT_ON_WINDOW_CLOSEQuit the application when the window closes.\note This flag existed but didn't function in BeOS R5.\since BeOS R5*//*!\var B_SAME_POSITION_IN_ALL_WORKSPACESWindow maintains its position across workspaces.\note This flag did not exist in BeOS R5.\since Haiku R1*//*!\var B_AUTO_UPDATE_SIZE_LIMITSAutomatically adjust the window size according to the layout constraints.\note This flag did not exist in BeOS R5.\since Haiku R1*//*!\var B_CLOSE_ON_ESCAPEClose the window when the user pushes the Escape key.\note This flag did not exist in BeOS R5.\since Haiku R1*//*!\var B_NO_SERVER_SIDE_WINDOW_MODIFIERS\since Haiku R1*/// workspace constants/*!\def B_CURRENT_WORKSPACEApplies to current workspace only.\since BeOS R3*//*!\def B_ALL_WORKSPACESApplies to all workspaces.\since BeOS R3*/// MoveOnScreen() flags/*!\var B_DO_NOT_RESIZE_TO_FIT\brief Flag to not resize the window to fit the screen when using\ref BWindow::MoveOnScreen()\since Haiku R1*//*!\var B_MOVE_IF_PARTIALLY_OFFSCREEN\brief Flag to only move a window to make the top left corner visible, whenit is partially off screen (instead of centering it) when using\ref BWindow::MoveOnScreen()\since Haiku R1*//*!\class BWindow\ingroup interface\ingroup libbe\brief Window base class.A BWindow is an on-screen window which contains views and is the target ofkeyboard and mouse events. A BWindow instance is nearly always subclassed.BWindow draws by talking to App Server. If you want draw directly into thegraphics card by-passing App Server, you need to use a BDirectWindow orBWindowScreen.Despite the fact that BWindow inherits from BLooper, you should not invokeRun() on a BWindow, instead, call Show() to get the message loop started andshow the window on screen. Once you've called Show() you may remove a windowfrom the screen without interrupting the message loop by calling Hide(). Othermessage loop details such as locking and quitting are detailed in the BLooperclass.BWindow has the following built-in shortcuts:<table><tr><th>Shortcut</th><th>Action</th><th>Handler</th></tr><tr><td>\key{Command}+\key{X}</td><td>Cut</td><td>Focus view</td></tr><tr><td>\key{Command}+\key{C}</td><td>Copy</td><td>Focus view</td></tr><tr><td>\key{Command}+\key{V}</td><td>Paste</td><td>Focus view</td></tr><tr><td>\key{Command}+\key{A}</td><td>Select All</td><td>Focus view</td></tr><tr><td>\key{Command}+\key{W}</td><td>Close</td><td>Window (if closable)</td></tr><tr><td>\key{Command}+\key{Q}</td><td>Quit</td><td>Application (non-modal windows only)</td></tr><tr><td>\key{Command}+\key{Control}+\key{M}</td><td>Minimize</td><td>Window (if minimizable)</td></tr><tr><td>\key{Command}+\key{Control}+\key{Z}</td><td>Zoom</td><td>Window (if zoomable)</td></tr><tr><td>\key{Command}+\key{Control}+\key{H}</td><td>Hide</td><td>Window</td></tr><tr><td>\key{Command}+\key{Control}+\key{F}</td><td>Send to front</td><td>Window</td></tr><tr><td>\key{Command}+\key{Control}+\key{B}</td><td>Send behind</td><td>Window</td></tr><tr><td>\key{Command}+\key{Control}+\key{←}</td><td>Go to left workspace</td><td>Desktop window</td></tr><tr><td>\key{Command}+\key{Control}+\key{→}</td><td>Go to right workspace</td><td>Desktop window</td></tr><tr><td>\key{Command}+\key{Control}+\key{↑}</td><td>Go to above workspace</td><td>Desktop window</td></tr><tr><td>\key{Command}+\key{Control}+\key{↓}</td><td>Go to below workspace</td><td>Desktop window</td></tr><tr><td>\key{Command}+\key{Control}+\key{Shift}+\key{←}</td><td>Send window and go to left workspace</td><td>Desktop window</td></tr><tr><td>\key{Command}+\key{Control}+\key{Shift}+\key{→}</td><td>Send window and go to right workspace</td><td>Desktop window</td></tr><tr><td>\key{Command}+\key{Control}+\key{Shift}+\key{↑}</td><td>Send window and go to above workspace</td><td>Desktop window</td></tr><tr><td>\key{Command}+\key{Control}+\key{Shift}+\key{↓}</td><td>Send window and go to below workspace</td><td>Desktop window</td></tr></table>\since BeOS R3*//*!\fn BWindow::BWindow(BRect frame, const char* title, window_type type,uint32 flags, uint32 workspace)\brief Creates a new BWindow object.\param frame The inner \a frame rectangle in the screen coordinate system.\param title The window \a title and thread title as "w>title".\param type window_type flag, one of the following:- \c B_UNTYPED_WINDOW- \c B_TITLED_WINDOW- \c B_MODAL_WINDOW- \c B_DOCUMENT_WINDOW- \c B_BORDERED_WINDOW- \c B_FLOATING_WINDOW\param flags Mask that defines window attributes:- \c B_NOT_MOVABLE cannot be moved by the user- \c B_NOT_CLOSABLE cannot be closed by the user, no close buttondisplayed- \c B_NOT_ZOOMABLE cannot be zoomed by the user, no zoom buttondisplayed- \c B_NOT_MINIMIZABLE cannot be minimized by the user- \c B_NOT_RESIZABLE cannot be resized by the user- \c B_NOT_H_RESIZABLE cannot be resized horizontally by the user- \c B_NOT_V_RESIZABLE cannot be resized vertically by the user- \c B_AVOID_FRONT cannot be brought to front by the user- \c B_AVOID_FOCUS cannot receive keyboard focus- \c B_WILL_ACCEPT_FIRST_CLICK The first click is processed by thewindow.- \c B_OUTLINE_RESIZE draws only its outline as it's resized anddoesn't draw its contents.- \c B_NO_WORKSPACE_ACTIVATION Causes the current workspace to stayactive when activated on another workspace.- \c B_NOT_ANCHORED_ON_ACTIVATE Causes the window to move to the currentworkspace when activated if it already exists on another workspace.- \c B_QUIT_ON_WINDOW_CLOSE Quit the application when the window closes.- \c B_SAME_POSITION_IN_ALL_WORKSPACES Window maintains its positionacross workspaces.- \c B_AUTO_UPDATE_SIZE_LIMITS Automatically adjust the size accordingto layout constraints.- \c B_CLOSE_ON_ESCAPE Close when the user pushes the Escape key.- \c B_NO_SERVER_SIDE_WINDOW_MODIFIERS ??\param workspace Mask that indicates which of the 32 potential workspace(s)the window should be displayed in or \c B_CURRENT_WORKSPACE or\c B_ALL_WORKSPACES constants.\since BeOS R3*//*!\fn BWindow::BWindow(BRect frame, const char* title, window_look look,window_feel feel, uint32 flags, uint32 workspace)\brief Creates a new BWindow object with the specified \a look and \a feel.\param frame The inner \a frame rectangle in the screen coordinate system.\param title The window \a title and thread title as "w>title".\param look The window_look flags, one of the following:- \c B_BORDERED_WINDOW_LOOK No title bar, thin border, no resizecontrol.- \c B_NO_BORDER_WINDOW_LOOK A borderless rectangle with no provisionsto move or close the window.- \c B_TITLED_WINDOW_LOOK Like \c B_DOCUMENT_WINDOW_LOOK, but with aresize corner instead of a resize thumb.- \c B_DOCUMENT_WINDOW_LOOK Large title bar, thick border, draggableresize corner thumb.- \c B_MODAL_WINDOW_LOOK For modal dialogs: no title bar, thick border,resize corner depending on the \c B_NOT_RESIZABLE flag.- \c B_FLOATING_WINDOW_LOOK For floating sub windows: small title bar,thin border, resize corner.\param feel The window_feel flags, one of the following:- \c B_NORMAL_WINDOW_FEEL Behaves like a normal, non-modal,non-floating window.- \c B_MODAL_SUBSET_WINDOW_FEEL Blocks all windows in its subset whendisplayed. Visible only if a window in its subset is visible.- \c B_MODAL_APP_WINDOW_FEEL Blocks all windows in its app whendisplayed. Visible only if a window in its app is visible.- \c B_MODAL_ALL_WINDOW_FEEL Blocks all windows across the entiresystem when displayed. Always visible in all workspaces.- \c B_FLOATING_SUBSET_WINDOW_FEEL Floats above all windows in itssubset when displayed. Visible only if a window in its subset is thefrontmost window.- \c B_FLOATING_APP_WINDOW_FEEL Floats above all windows in its appwhen displayed. Visible only if a window in its app is the frontmostwindow.- \c B_FLOATING_ALL_WINDOW_FEEL Floats above all windows across theentire system when displayed. Always visible in all workspaces.\param flags Mask that defines window attributes:- \c B_NOT_MOVABLE cannot be moved by the user- \c B_NOT_CLOSABLE cannot be closed by the user, no close buttondisplayed- \c B_NOT_ZOOMABLE cannot be zoomed by the user, no zoom buttondisplayed- \c B_NOT_MINIMIZABLE cannot be minimized by the user- \c B_NOT_RESIZABLE cannot be resized by the user- \c B_NOT_H_RESIZABLE cannot be resized horizontally by the user- \c B_NOT_V_RESIZABLE cannot be resized vertically by the user- \c B_AVOID_FRONT cannot be brought to front by the user- \c B_AVOID_FOCUS cannot receive keyboard focus- \c B_WILL_ACCEPT_FIRST_CLICK The first click is processed by thewindow.- \c B_OUTLINE_RESIZE draws only its outline as it's resized anddoesn't draw its contents.- \c B_NO_WORKSPACE_ACTIVATION Causes the current workspace to stayactive when activated on another workspace.- \c B_NOT_ANCHORED_ON_ACTIVATE Causes the window to move to the currentworkspace when activated if it already exists on another workspace.- \c B_QUIT_ON_WINDOW_CLOSE Quit the application when the window closes.- \c B_SAME_POSITION_IN_ALL_WORKSPACES Window maintains its positionacross workspaces.- \c B_AUTO_UPDATE_SIZE_LIMITS Automatically adjust the size accordingto layout constraints.- \c B_CLOSE_ON_ESCAPE Close when the user pushes the Escape key.- \c B_NO_SERVER_SIDE_WINDOW_MODIFIERS ??\param workspace Mask that indicates which of the 32 potential workspace(s)the window should be displayed in or \c B_CURRENT_WORKSPACE or\c B_ALL_WORKSPACES constants.\since BeOS R3*//*!\fn BWindow::BWindow(BMessage* data)\brief Archive constructor.\param data A pointer to the BMessage object to build the object from.\since BeOS R3*//*!\fn BWindow::BWindow(BRect frame, int32 bitmapToken)\brief Offscreen bitmap constructor.\param frame The inner \a frame rectangle in the screen coordinate system.\param bitmapToken Token to pass into App Server for offscreen window bitmap.\since Haiku R1*//*!\fn BWindow::~BWindow()\brief Destroys the BWindow object and all attached views.\since BeOS R3*//*!\fn BArchivable* BWindow::Instantiate(BMessage* data)\brief Creates a new BWindow object from the \a data message.\param data A pointer to the BMessage object to build the object from.\returns A newly created BWindow object or \c NULL if the message doesn'tcontain an archived BWindow.\since BeOS R3*//*!\fn status_t BWindow::Archive(BMessage* data, bool deep) const\brief Archives the object into the \a data message.\param data A pointer to the BMessage object to archive the object into.\param deep Whether or not to archive child views as well.\return A status code, \c B_OK if the object was archived or an error codeotherwise.\since BeOS R3*//*!\fn void BWindow::Quit()\brief Deletes the window and all child views, destroys the window thread,removes the window's connection to the Application Server, and deletesthe object.Use this method to destroy a window rather than using the delete operator.This method works much like the BLooper::Quit(), it doesn't return whencalled from the BWindow's thread and it returns after all messages have beenprocessed when called from another thread and the BWindow and its thread hasbeen destroyed.\warning The window must first be locked before calling Quit().\see BLooper::Quit()\since BeOS R3*//*!\fn void BWindow::Close()\brief Deprecated alias for BWindow::Quit().The advised way to close a window is to use BWindow::Quit().\since BeOS R3*//*!\fn void BWindow::AddChild(BView* child, BView* before)\brief Adds \a child to the view hierarchy immediately before \a before.A view may only have one parent at a time so \a child must not have alreadybeen added to the view hierarchy. If \a before is \c NULL then \a child isadded to the end of the view hierarchy.The AttachedToWindow() method is invoked on \a child and all of itsdescendent views.\param child The child view to add.\param before The sibling view to add \a child before.\since BeOS R3*//*!\fn void BWindow::AddChild(BLayoutItem* child)\brief Add the \a child layout item to the view hierarchy.\param child The child layout item to add.\since Haiku R1*//*!\fn bool BWindow::RemoveChild(BView* child)\brief Removes \a child from the view hierarchy.\param child The child view to remove.\return Whether or not \a child was removed from the view hierarchy.\since BeOS R3*//*!\fn int32 BWindow::CountChildren() const\brief Returns the number of child views that the window has.\return The number of child views as an int32.\since BeOS R3*//*!\fn BView* BWindow::ChildAt(int32 index) const\brief Returns a pointer to the child view found at \a index.\param index The index of the child view to return a pointer of.\return A pointer to the child view at \a index or \c NULL if not found.\since BeOS R3*//*!\fn void BWindow::Minimize(bool minimize)\brief Minimizes or un-minimizes the window based on \a minimize.Unlike Hide() an Show(), Minimize() dims and un-dims the entry for the windowin Deskbar's window list rather than removing it. Also Minimize() calls are notcumulative like Hide() and Show(); one \c false call will undo multiple \c truecalls.Minimize() also acts as a hook method that is invoked when the user double-clicks on the title tab of the window or selects the window from the DeskBarwindow list. The \a minimize parameter is \c true if the window is about to behidden and \c false if it is about to be shown.If you override Minimize() and you want to inherit BWindow's behavior, youmust call BWindow::Minimize().\since BeOS R3*//*!\fn status_t BWindow::SendBehind(const BWindow* window)\brief Moves the BWindow object behind \a window.\param window A pointer to the window to move behind.\returns \c B_OK on success or \c B_ERROR on failure.\since BeOS R3*//*!\fn void BWindow::Flush() const\brief Flushes the window's connection to App Server causing any pendingmessages to be processed then returns immediately.\since BeOS R3*//*!\fn void BWindow::Sync() const\brief Synchronizes the attached window's connection to App Servercausing any pending messages to be processed and then waits forthe App Server to respond.\since BeOS R3*//*!\fn void BWindow::DisableUpdates()\brief Suppresses drawing within the window.If you want the results of several drawing operations to appear in thewindow all at once you disable updates, draw, and then re-enable updates.\since BeOS R3*//*!\fn void BWindow::EnableUpdates()\brief Re-enable drawing within the window.If you want the results of several drawing operations to appear in the windowall at once you disable updates, draw, and then re-enable updates.\since BeOS R3*//*!\fn void BWindow::BeginViewTransaction()\brief Stall updates to App Server allowing you to batch drawing commands tolimit flickering.Unlike DisableUpdates() the messages are sent but are not processed.\since Haiku R1*//*!\fn void BWindow::EndViewTransaction()\brief Ends a view transaction allowing update to go to App Server again.\since Haiku R1*//*!\fn bool BWindow::InViewTransaction() const\brief Returns whether or not the window is currently in a view transaction.\returns \c true if the window is currently in a view transaction,\c false otherwise.\since Haiku R1*//*!\fn bool BWindow::IsFront() const\brief Returns whether or not the window is the frontmost on screen.\returns \c true if window is the frontmost on screen, \c false otherwise.\since BeOS R3*//*!\fn void BWindow::MessageReceived(BMessage* message)\brief Handle \a message received by the associated looper.\param message The \a message received by the looper.\see BHandler::MessageReceived()\since BeOS R3*//*!\fn void BWindow::DispatchMessage(BMessage* message, BHandler* target)\brief Window's central message-processing method.This method called automatically as messages arrive in the queue, you shouldnever call DispatchMessage() yourself.\warning Don't override this method in your BWindow subclass. OverrideMessageReceived() instead to alter the window's message dispatchingmechanism.\see BLooper::DispatchMessage()\since BeOS R3*//*!\fn void BWindow::FrameMoved(BPoint newPosition)\brief Hook method that gets called when the window is moved.\param newPosition The point of the top left corner of the framerectangle that the window has been moved to.\since BeOS R3*//*!\fn void BWindow::FrameResized(float newWidth, float newHeight)\brief Hook method that gets called when the window is resized.\param newWidth The new \a width of the window.\param newHeight The new \a height of the window.\since BeOS R3*//*!\fn void BWindow::WorkspacesChanged(uint32 oldWorkspaces,uint32 newWorkspaces)\brief Hook method that gets called whenever the workspaces the window isin changes.\param oldWorkspaces The old set of workspaces the window was visible in.\param newWorkspaces The new set of workspaces the window is visible in.\since BeOS R3*//*!\fn void BWindow::WorkspaceActivated(int32 workspace, bool state)\brief Hook method that gets called when the active workspace changes.This method is only called when a workspace in which the window residesis activated or deactivated.\param workspace The \a workspace number that was activated/deactivated.\param state \c true if activated, \c false if deactivated.\since BeOS R3*//*!\fn void BWindow::MenusBeginning()\brief Hook method that gets called just before a menu owned by the window isshown.It will also be invoked while dispatching shortcuts.\note This method is not invoked by a message.\since BeOS R3*//*!\fn void BWindow::MenusEnded()\brief Hook method that gets called just before a menu owned by the window ishidden.It will also be invoked after dispatching shortcuts.\note This method is not invoked by a message.\since BeOS R3*//*!\fn void BWindow::SetSizeLimits(float minWidth, float maxWidth,float minHeight, float maxHeight)\brief Set size limits on the window.The user won't be able to resize the window beyond the limits set by thismethod. SetSizeLimits() constrains the user, not the programmer, you maystill resize the window outside of the size limits set by this method bycalling ResizeBy() or ResizeTo().\param minWidth The minimum width of the window to set.\param maxWidth The maximum width of the window to set.\param minHeight The minimum height of the window to set.\param maxHeight The maximum height of the window to set.\since BeOS R3*//*!\fn void BWindow::GetSizeLimits(float* _minWidth, float* _maxWidth,float* _minHeight, float* _maxHeight)\brief Fills out the size limits set on the window.\param _minWidth The minimum width of the window.\param _maxWidth The maximum width of the window.\param _minHeight The minimum height of the window.\param _maxHeight The maximum height of the window.\since BeOS R3*//*!\fn void BWindow::UpdateSizeLimits()\brief Updates the window's size limits from the minimum and maximum sizesof its top view.This method does nothing unless the \c B_AUTO_UPDATE_SIZE_LIMITS window flagis set.The method is called automatically after a layout invalidation. Since it isinvoked asynchronously, calling this method manually is necessary, if it isdesired to adjust the limits (and as a possible side effect the window size)earlier, e.g. before the first call to the Show() method.)\since Haiku R1*//*!\fn status_t BWindow::SetDecoratorSettings(const BMessage& settings)\brief Set the window decorator settings according to \a settings.\param settings The decorator \a settings message to set.\returns \c B_OK if the decorator settings were set successfully or an errorcode otherwise.\since Haiku R1*//*!\fn status_t BWindow::GetDecoratorSettings(BMessage* settings) const\brief Fill out the window's decorator settings into \a settings.\param settings A pointer to a BMessage object to fill out.\returns \c B_OK if the decorator settings were filled out successfullyor an error code otherwise.\since Haiku R1*//*!\fn void BWindow::SetZoomLimits(float maxWidth, float maxHeight)\brief Sets the maximum size that the window will zoom to when Zoom() iscalled.The window will zoom to the minimum of the screen size, the maximum valuesset by SetSizeLimits(), and the maximum values set by this method./see Zoom()\since BeOS R3*//*!\fn void BWindow::Zoom(BPoint origin, float width, float height)\brief Move window to \a origin, then resize to \a width and \a height.You may call Zoom() even if the window has the \c B_NOT_ZOOMABLE flag set.This method may move and resize the window resulting in both theFrameMoved() and FrameResized() hook methods to be called.You can override this method to change how your window behaves when theuser clicks the zoom button or when Zoom() is called.\param origin The point that the window was moved to.\param width The new width of the window.\param height The new height of the window.\since BeOS R3*//*!\fn void BWindow::Zoom()\brief Resize the window to the minimum of the screen size, the maximumvalues set by SetSizeLimits(), and the maximum values set bySetZoomLimits().You may call Zoom() even if the window has the \c B_NOT_ZOOMABLE flag set.This is the method called when the user clicks the window's zoom button.It can also be called programmatically.The window dimensions are calculated from the smallest of three rectangles:-# the screen frame,-# the rectangle defined by SetZoomLimits(),-# the rectangle defined by SetSizeLimits().However if the window frame already matches these new dimensions, Zoom()uses the previous size and location of the window instead.This method calls Zoom(BPoint, float, float) to do the actualy zooming.\see Zoom(BPoint, float, float);\since BeOS R3*//*!\fn void BWindow::ScreenChanged(BRect screenSize, color_space depth)\brief Hook method that is called when the screen that the window is locatedon changes size or location or the color space of the screen changes.\param screenSize The new screen size in the screen's coordinate system.\param depth The new color space of the screen.\since BeOS R3*//*!\fn void BWindow::SetPulseRate(bigtime_t rate)\brief Sets how often \c B_PULSE messages are posted to the window.All BViews attached to a window share the same pulse rate.\a rate should not be set to less than 100,000 microseconds, differences lessthan 50,000 microseconds may not be noticeable.Setting the \a rate to 0 disables pulsing for all views attache to the window.\param rate The pulse rate to set.\since BeOS R3*//*!\fn bigtime_t BWindow::PulseRate() const\brief Returns the pulse rate of the window.\c B_PULSE messages are sent by default every 500,000 microseconds providedthat no other messages are pending.\returns The pulse rate of the window as a bigtime_t.\since BeOS R3*//*!\name Shortcut MethodsThe key parameter is specified in the form of a Unicode code point. Thisis generally an ASCII character such as 'A' or a key constant such as\c B_RIGHT_ARROW. To use a UTF-8 character you must first convert it to aUnicode code point using BUnicodeChar::FromUTF8().*///! @{/*!\fn void BWindow::AddShortcut(uint32 key, uint32 modifiers, BMessage* message)\brief Creates a keyboard shortcut that sends a \a message to the window.\warning Don't use this method to a create menu shortcut, add a BMenuIteminstead.\param key The character that activates the shortcut, case-insensitive.\param modifiers A bit mask of modifiers in addition to \c B_COMMAND_KEY,options include:- \c B_SHIFT_KEY- \c B_OPTION_KEY- \c B_CONTROL_KEY- \c B_MENU_KEYTo remove \c B_COMMAND_KEY specify \c B_NO_COMMAND_KEY.\param message The \a message to send when the shortcut is activated. TheBWindow takes ownership of the \a message.\since BeOS R3*//*!\fn void BWindow::AddShortcut(uint32 key, uint32 modifiers, BMessage* message,BHandler* target)\brief Creates a keyboard shortcut that sends a \a message to the specified\a target.\warning Don't use this method to a create menu shortcut, add a BMenuIteminstead.\param key The character that activates the shortcut, case-insensitive.\param modifiers A bit mask of modifiers in addition to \c B_COMMAND_KEY,options include one or more of the following:- \c B_SHIFT_KEY- \c B_OPTION_KEY- \c B_CONTROL_KEY- \c B_MENU_KEYTo remove \c B_COMMAND_KEY specify \c B_NO_COMMAND_KEY.\param message The \a message to send when the shortcut is activated. TheBWindow takes ownership of the \a message.\param target The handler to send the message to.\since BeOS R3*//*!\fn bool BWindow::HasShortcut(uint32 key, uint32 modifiers)\brief Returns whether or not the specified shortcut is set on the window.\param key The character to check, case-insensitive.\param modifiers A bit mask of modifiers in addition to \c B_COMMAND_KEY,options include one or more of the following:- \c B_SHIFT_KEY- \c B_OPTION_KEY- \c B_CONTROL_KEY- \c B_MENU_KEYTo remove \c B_COMMAND_KEY specify \c B_NO_COMMAND_KEY.\returns \c true if the window has the specified shortcut, \c falseotherwise.\since Haiku R1*//*!\fn void BWindow::RemoveShortcut(uint32 key, uint32 modifiers)\brief Removes the specified shortcut from the window.The memory used by the shortcut message is freed.\param key The character to remove, case-insensitive.\param modifiers A bit mask of modifiers in addition to \c B_COMMAND_KEY,options include one or more of the following:- \c B_SHIFT_KEY- \c B_OPTION_KEY- \c B_CONTROL_KEY- \c B_MENU_KEYTo remove \c B_COMMAND_KEY specify \c B_NO_COMMAND_KEY.\since BeOS R3*///! @}/*!\fn BButton* BWindow::DefaultButton() const\brief Returns a pointer to the default button set on the window.\return A pointer to the window's default button or \c NULL if it doesn'thave one.\since BeOS R3*//*!\fn void BWindow::SetDefaultButton(BButton* button)\brief Set the default button of the window to \a button.The default button has a grey outline and is activated by the user pushingthe Enter key. The user can activate the default button even if another viewis currently set to be the focus view of the window.A window may only have one default button at a time, to remove the currentdefault without setting another button you may pass in \c NULL.\param button A pointer to the button to set as the default or \c NULL tounset.\since BeOS R3*//*!\fn bool BWindow::NeedsUpdate() const\brief Returns whether or not any of the attached views need to be updated.\return \c true if an attached view needs to be updated, \c false otherwise.\since BeOS R3*//*!\fn void BWindow::UpdateIfNeeded()\brief Invokes Draw() immediately on each child view that needs updating.This method is synchronous, it waits for each child view to update beforereturning. This method is ignored unless it is called from within the messageloop of the thread that the BWindow is running in.You may call this method as part of a hook function such as MouseMoved() orKeyDown() to force invalid views to be immediately redrawn without having towait for the hook function to finish.\since BeOS R3*//*!\fn BView* BWindow::FindView(const char* viewName) const\brief Returns the attached view with the specified \a viewName.\param viewName The name of the attached view to look for.\return A pointer to the BView object or \c NULL if no view is found.\since BeOS R3*//*!\fn BView* BWindow::FindView(BPoint point) const\brief Returns a pointer to the attached view located at the specified\a point.\param point The \a point to get the view at in the window's coordinatesystem.\return A pointer to the BView object or \c NULL if no view is found.\since BeOS R3*//*!\fn BView* BWindow::CurrentFocus() const\brief Returns a pointer to the current focus view of the window.\return A pointer to the current focus view of the window or \c NULL ifnot found.\since BeOS R3*//*!\fn void BWindow::Activate(bool active)\brief Activates or deactivates the window based on \a active.The title tab of the active window is drawn more brightly, the window is madefrontmost, and it becomes the target of keyboard events. Calling Show()automatically activates the window calling the WindowActivated() hook method.\param active \c true to activate the window, \c false to deactivate thewindow.\since BeOS R3*//*!\fn void BWindow::WindowActivated(bool active)\brief Hook method that gets called when the window becomes activated ordeactivated.\param active \c true if the window has become activated, \c false if thewindow has become deactivated.\since BeOS R3*//*!\fn void BWindow::ConvertToScreen(BPoint* point) const\brief Convert \a point to the screen's coordinate system in place.\param point A pointer to a BPoint object to convert.\since BeOS R3*//*!\fn BPoint BWindow::ConvertToScreen(BPoint point) const\brief Returns \a point converted to the screen's coordinate system.\param point A BPoint object to convert.\return A new BPoint object in the screen's coordinate system.\since BeOS R3*//*!\fn void BWindow::ConvertFromScreen(BPoint* point) const\brief Convert \a point from the screen's coordinate system to thewindow's coordinate system in place.\param point A pointer to a BPoint object to convert.\since BeOS R3*//*!\fn BPoint BWindow::ConvertFromScreen(BPoint point) const\brief Returns \a point converted from the screen's coordinate system tothe window's coordinate system.\param point A BPoint object to convert.\return A new BPoint object in the window's coordinate system.\since BeOS R3*//*!\fn void BWindow::ConvertToScreen(BRect* rect) const\brief Convert \a rect to the screen's coordinate system in place.\param rect A pointer to a BRect object to convert.\since BeOS R3*//*!\fn BRect BWindow::ConvertToScreen(BRect rect) const\brief Returns \a rect converted to the screen's coordinate system.\param rect A BRect object to convert.\return A new BRect object in the screen's coordinate system.\since BeOS R3*//*!\fn void BWindow::ConvertFromScreen(BRect* rect) const\brief Convert \a rect from the screen's coordinate system to thewindow's coordinate system in place.\param rect A pointer to a BRect object to convert.\since BeOS R3*//*!\fn BRect BWindow::ConvertFromScreen(BRect rect) const\brief Returns \a rect converted from the screen's coordinate system to thewindow's coordinate system.\param rect A BRect object to convert.\return A new BRect object in the window's coordinate system.\since BeOS R3*//*!\fn bool BWindow::IsMinimized() const\brief Returns whether or not the window is minimized.\return \c true if the window is minimized, \c false otherwise.\since BeOS R5*//*!\fn BRect BWindow::Bounds() const\brief Returns the bounding rectangle of the window.\return The bounding rectangle of the window as a BRect in the window'scoordinate system.\sa Frame()\since BeOS R3*//*!\fn BRect BWindow::Frame() const\brief Returns the frame rectangle of the window.\return The bounding rectangle of the window as a BRect in the screencoordinate system.\sa Bounds()\since BeOS R3*//*!\fn BRect BWindow::DecoratorFrame() const\brief Returns the frame rectangle of the window decorator.\return The bounding rectangle of the window decorator as a BRect in thescreen coordinate system.\since Haiku R1*//*!\fn BSize BWindow::Size() const\brief Returns the size of the window.\return The size of the window as a BSize in the screen coordinate system.\since Haiku R1*//*!\fn const char* BWindow::Title() const\brief Returns the window title as set by the constructor or SetTitle().\return A pointer to the window title.\since BeOS R3*//*!\fn void BWindow::SetTitle(const char* title)\brief Sets the window title to \a title.Also renames the window thread to "w>title" where "title" is the passed intitle string.\since BeOS R5*//*!\fn bool BWindow::IsActive() const\brief Returns whether or not the window is active.\return \c true if the window is active, \c false otherwise.\since BeOS R3*//*!\fn void BWindow::SetKeyMenuBar(BMenuBar* bar)\brief Set the specified menu \a bar as the key menu bar for the window.The key menu bar is the one located at the top of the window at the root ofthe menu hierarchy that the user can navigate with the keyboard.\param bar A pointer to the menu \a bar to set as as the key menu \a bar forthe window.\since BeOS R3*//*!\fn BMenuBar* BWindow::KeyMenuBar() const\brief Returns a pointer to the key menu bar set to the window.If the window contains only one menu bar it is automatically considered to bethe key menu bar for the window. If more than one menu bar is attached to thewindow then the last one added to the window's view hierarchy is consideredto be the key menu bar for the window.To explicitly set a menu bar as the key menu bar call SetKeyMenuBar().\return A pointer to the key menu bar or \c NULL is not is set.\since BeOS R3*//*!\fn bool BWindow::IsModal() const\brief Returns whether or not the window is modal.\return \c true if the window is modal, \c false otherwise.\since BeOS R3*//*!\fn bool BWindow::IsFloating() const\brief Returns whether or not the window is floating.\return \c true if the window is floating, \c false otherwise.\since BeOS R3*//*!\fn status_t BWindow::AddToSubset(BWindow* window)\brief Adds \a window to be in the subset of the BWindow.\return A status code.\retval B_OK \a window was added as a subset of the BWindow.\retval B_BAD_VALUE \c window is not \c B_NORMAL_WINDOW_FEEL or the BWindowobject's feel is not set to \c B_MODAL_SUBSET_WINDOW_FEEL or\c B_FLOATING_SUBSET_WINDOW_FEEL.\retval B_ERROR Could not lock the BWindow object.\since BeOS R3*//*!\fn status_t BWindow::RemoveFromSubset(BWindow* window)\brief Remove \a window from the subset of the BWindow.\return A status code.\retval B_OK \a window was removed from the subset of the BWindow.\retval B_BAD_VALUE \c window is not \c B_NORMAL_WINDOW_FEEL or the BWindowobject's feel is not set to \c B_MODAL_SUBSET_WINDOW_FEEL or\c B_FLOATING_SUBSET_WINDOW_FEEL.\retval B_ERROR Could not lock the BWindow object.\since BeOS R3*//*!\fn status_t BWindow::SetType(window_type type)\brief Changes the window type set in the constructor to \a type.\return \c B_OK on success or an error code on failure.\since BeOS R3*//*!\fn window_type BWindow::Type() const\brief Returns the current window type flag.\return The currently set window type flag.\since BeOS R3*//*!\fn status_t BWindow::SetLook(window_look look)\brief Changes the window look set in the constructor to \a look.\return \c B_OK on success or an error code on failure.\since BeOS R3*//*!\fn window_look BWindow::Look() const\brief Returns the current window look flag.\return The currently set window look flag.\since BeOS R3*//*!\fn status_t BWindow::SetFeel(window_feel feel)\brief Changes the window feel set in the constructor to \a feel.\return \c B_OK on success or an error code on failure.\since BeOS R3*//*!\fn window_feel BWindow::Feel() const\brief Returns the current window feel flag.\return The currently set window feel flag.\since BeOS R3*//*!\fn status_t BWindow::SetFlags(uint32 flags)\brief Changes the window flags set in the constructor to \a flags.\return \c B_OK on success or an error code on failure.\since BeOS R3*//*!\fn uint32 BWindow::Flags() const\brief Returns the current window flags.\return The currently set window flags.\since BeOS R3*//*!\fn status_t BWindow::SetWindowAlignment(window_alignment mode,int32 h, int32 hOffset, int32 width, int32 widthOffset,int32 v, int32 vOffset, int32 height, int32 heightOffset)\brief Sets the alignment of the content of the window on the screen.\since BeOS R3*//*!\fn status_t BWindow::GetWindowAlignment(window_alignment* mode,int32* h, int32* hOffset, int32* width, int32* widthOffset,int32* v, int32* vOffset, int32* height, int32* heightOffset) const\brief Fills out the pointers with the alignment of the content of thewindow on the screen.\since BeOS R3*//*!\fn uint32 BWindow::Workspaces() const\brief Returns the set of workspaces where the window can be displayed.\since BeOS R3*//*!\fn void BWindow::SetWorkspaces(uint32 workspaces)\brief Sets the set of workspaces where the window can be displayed.\param workspaces- \c B_CURRENT_WORKSPACE to place the window in the currently displayedworkspace removing it from all others.- \c B_ALL_WORKSPACES to make the window show up in all workspaces.\since BeOS R3*//*!\fn BView* BWindow::LastMouseMovedView() const\brief Returns a pointer to the attached view that most recently receiveda \c B_MOUSE_MOVED message.\return A pointer the BView object that most recently received a\c B_MOUSE_MOVED message or \c NULL if not found.\since BeOS R3*//*!\fn void BWindow::MoveBy(float dx, float dy)\brief Move the window by \a dx pixels horizontally and \a dy pixelsvertically.\a dx and \a dy must be integral units.\param dx The number of pixels to move the window vertically.\param dy The number of pixels to move the window horizontally.\since BeOS R3*//*!\fn void BWindow::MoveTo(BPoint point)\brief Move the window to \a point.\param point the location to move the window in the screen's coordinatesystem.\since BeOS R3*//*!\fn void BWindow::MoveTo(float x, float y)\brief Move the window to the specified \a x and \a y coordinates.\a x and \a y must be integral units.\param x The horizontal coordinate to move the window to in the screen'scoordinate system.\param y The vertical coordinate to move the window to in the screen'scoordinate system.\since BeOS R3*//*!\fn void BWindow::ResizeBy(float dx, float dy)\brief Resize the window by \a dx pixels horizontally and \a dy pixels vertically.\a dx and \a dy must be integral units.\brief dx The number of pixels to resize the window horizontally.\brief dy The number of pixels to resize the window vertically.\since BeOS R3*//*!\fn void BWindow::ResizeTo(float width, float height)\brief Resize the window to the specified \a width and \a height.\a width and \a height must be integral units.\param width The width to resize the window to.\param height The height to resize the window to.\since BeOS R3*//*!\fn void BWindow::ResizeToPreferred()\brief Resize the window to the preferred size of the window's layout.\since Haiku R1*//*!\fn void BWindow::CenterIn(const BRect& rect)\brief Center the window in \a rect.\param rect The rectangle to center the window in.\since Haiku R1*//*!\fn void BWindow::CenterOnScreen()\brief Centers the window on the screen the window is currently on.\since Haiku R1*//*!\fn void BWindow::CenterOnScreen(screen_id id)\brief Centers the window on the screen with the passed in \a id.\since Haiku R1*//*!\fn void BWindow::MoveOnScreen(uint32 flags=0)\brief Update window size and position to make it visible on screen.This convenience method helps you to automatically move and resize a windowto make it visible on the screen, in case the window is partially offscreen because of its size or its position. This method will do nothing ifthe window fits on the screen.The default behavior is as follows:- If the window size is larger than the screen, the window is resizedso that it fits on the screen.- If the window is still partially off-screen, it will then be centeredhorizontally and vertically so that it is fully visible.Note that this does not affect window size and positions for windows thatare currently visible on the screen. Also note that this method does notaffect whether the window is covered by other windows that are on top. Youcan use \ref BWindow::Activate() to bring a window to the top.The behavior of this method can be altered by passing either or both of thefollowing modifiers in the \a flags parameter:- \ref B_DO_NOT_RESIZE_TO_FIT Do not resize the window. If the windowis too large to be on the screen, then it will at least be moved sothat the left-top of the window is visible, and only the right and/orbottom of the window will be off screen.- \ref B_MOVE_IF_PARTIALLY_OFFSCREEN Use this parameter if instead ofcentering the window in the middle of the screen, you only want todo the minimum movement so that at least the top left part of thewindow is visible on screen.\param flags Can be \c 0 for the default behavior, or a any combination of\c B_DO_NOT_RESIZE_TO_FIT and \c B_MOVE_IF_PARTIALLY_OFFSCREEN.\since Haiku R1*//*!\fn bool BWindow::IsOffscreenWindow() const\brief Tests if window is used for drawing into a BBitmap.This is mostly used by the Interface Kit itself.\return True if the window is used for drawing into a BBitmap.\since Haiku R1*//*!\fn void BWindow::Show()\brief Shows the window on screen, places it frontmost on the screen, addsthe window to Deskbar's window list, and makes it the active window.If this is the first time Show() has been called on the window the message loopis started and it is unlocked.Calls to Hide() and Show() are cumulative.\since BeOS R3*//*!\fn void BWindow::Hide()\brief Removes the window from the screen, removes it from Deskbar's windowlist, and passes active status to another window.Calls to Hide() and Show() are cumulative.\since BeOS R3*//*!\fn bool BWindow::IsHidden() const\brief Returns whether or not the window is hidden.Windows are hidden by default, you must call Show() to show the window startingthe message loop going.\since BeOS R3*//*!\fn bool BWindow::QuitRequested()\brief Hook method that gets called when the window receives a\a B_QUIT_REQUESTED message.\see Quit()\see BLooper::QuitRequested()\since BeOS R3*//*!\fn thread_id BWindow::Run()\brief Spawns the message loop thread and starts the window running.\see BLooper::Run()\since BeOS R3*//*!\fn void BWindow::SetLayout(BLayout* layout)\brief Sets the \a layout of the window.\param layout The \a layout to set.\since Haiku R1*//*!\fn BLayout* BWindow::GetLayout() const\brief Get the layout of the window.\returns The layout of the window.\since Haiku R1*//*!\fn void BWindow::InvalidateLayout(bool descendants)\brief Invalidate layout.\param descendants Also invalidate its children windows.\since Haiku R1*//*!\fn void BWindow::Layout(bool force)\brief Update the size limits and do the layout of the topmost view attachedto the window.\param force If \c true, layout even if valid.\since Haiku R1*//*!\fn status_t BWindow::GetSupportedSuites(BMessage* data)\brief Reports the suites of messages and specifiers understood by the window.\copydetails BLooper::GetSupportedSuites()*//*!\fn BHandler* BWindow::ResolveSpecifier(BMessage* message, int32 index,BMessage* specifier, int32 what, const char* property)\copydoc BLooper::ResolveSpecifier()*/