Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
BWindow Class Reference

Window base class. More...

Inherits BLooper.

Inherited by BAlert, BDirectWindow, and BWindowScreen.

Public Member Functions

 BWindow (BMessage *archive)
 Archive constructor.
 
 BWindow (BRect frame, const char *title, window_look look, window_feel feel, uint32 flags, uint32 workspace=B_CURRENT_WORKSPACE)
 Creates a new BWindow object with the specified look and feel.
 
 BWindow (BRect frame, const char *title, window_type type, uint32 flags, uint32 workspace=B_CURRENT_WORKSPACE)
 Creates a new BWindow object.
 
virtual ~BWindow ()
 Destroys the BWindow object and all attached views.
 
void Activate (bool=true)
 Activates or deactivates the window based on active.
 
void AddChild (BLayoutItem *child)
 Add the child layout item to the view hierarchy.
 
void AddChild (BView *child, BView *before=NULL)
 Adds child to the view hierarchy immediately before before.
 
status_t AddToSubset (BWindow *window)
 Adds window to be in the subset of the BWindow.
 
virtual status_t Archive (BMessage *archive, bool deep=true) const
 Archives the object into the data message.
 
void BeginViewTransaction ()
 Stall updates to App Server allowing you to batch drawing commands to limit flickering.
 
BRect Bounds () const
 Returns the bounding rectangle of the window.
 
void CenterIn (const BRect &rect)
 Center the window in rect.
 
void CenterOnScreen ()
 Centers the window on the screen the window is currently on.
 
void CenterOnScreen (screen_id id)
 Centers the window on the screen with the passed in id.
 
BViewChildAt (int32 index) const
 Returns a pointer to the child view found at index.
 
void Close ()
 Deprecated alias for BWindow::Quit().
 
void ConvertFromScreen (BPoint *point) const
 Convert point from the screen's coordinate system to the window's coordinate system in place.
 
BPoint ConvertFromScreen (BPoint point) const
 Returns point converted from the screen's coordinate system to the window's coordinate system.
 
void ConvertFromScreen (BRect *rect) const
 Convert rect from the screen's coordinate system to the window's coordinate system in place.
 
BRect ConvertFromScreen (BRect rect) const
 Returns rect converted from the screen's coordinate system to the window's coordinate system.
 
void ConvertToScreen (BPoint *point) const
 Convert point to the screen's coordinate system in place.
 
BPoint ConvertToScreen (BPoint point) const
 Returns point converted to the screen's coordinate system.
 
void ConvertToScreen (BRect *rect) const
 Convert rect to the screen's coordinate system in place.
 
BRect ConvertToScreen (BRect rect) const
 Returns rect converted to the screen's coordinate system.
 
int32 CountChildren () const
 Returns the number of child views that the window has.
 
BViewCurrentFocus () const
 Returns a pointer to the current focus view of the window.
 
BRect DecoratorFrame () const
 Returns the frame rectangle of the window decorator.
 
BButtonDefaultButton () const
 Returns a pointer to the default button set on the window.
 
void DisableUpdates ()
 Suppresses drawing within the window.
 
virtual void DispatchMessage (BMessage *message, BHandler *handler)
 Window's central message-processing method.
 
void EnableUpdates ()
 Re-enable drawing within the window.
 
void EndViewTransaction ()
 Ends a view transaction allowing update to go to App Server again.
 
window_feel Feel () const
 Returns the current window feel flag.
 
BViewFindView (BPoint) const
 Returns a pointer to the attached view located at the specified point.
 
BViewFindView (const char *viewName) const
 Returns the attached view with the specified viewName.
 
uint32 Flags () const
 Returns the current window flags.
 
void Flush () const
 Flushes the window's connection to App Server causing any pending messages to be processed then returns immediately.
 
BRect Frame () const
 Returns the frame rectangle of the window.
 
virtual void FrameMoved (BPoint newPosition)
 Hook method that gets called when the window is moved.
 
virtual void FrameResized (float newWidth, float newHeight)
 Hook method that gets called when the window is resized.
 
status_t GetDecoratorSettings (BMessage *settings) const
 Fill out the window's decorator settings into settings.
 
BLayoutGetLayout () const
 Get the layout of the window.
 
void GetSizeLimits (float *minWidth, float *maxWidth, float *minHeight, float *maxHeight)
 Fills out the size limits set on the window.
 
virtual status_t GetSupportedSuites (BMessage *data)
 Reports the suites of messages and specifiers understood by the window.
 
status_t GetWindowAlignment (window_alignment *mode=NULL, int32 *h=NULL, int32 *hOffset=NULL, int32 *width=NULL, int32 *widthOffset=NULL, int32 *v=NULL, int32 *vOffset=NULL, int32 *height=NULL, int32 *heightOffset=NULL) const
 Fills out the pointers with the alignment of the content of the window on the screen.
 
virtual void Hide ()
 Removes the window from the screen, removes it from Deskbar's window list, and passes active status to another window.
 
void InvalidateLayout (bool descendants=false)
 Invalidate layout.
 
bool InViewTransaction () const
 Returns whether or not the window is currently in a view transaction.
 
bool IsActive () const
 Returns whether or not the window is active.
 
bool IsFloating () const
 Returns whether or not the window is floating.
 
bool IsFront () const
 Returns whether or not the window is the frontmost on screen.
 
bool IsHidden () const
 Returns whether or not the window is hidden.
 
bool IsMinimized () const
 Returns whether or not the window is minimized.
 
bool IsModal () const
 Returns whether or not the window is modal.
 
bool IsOffscreenWindow () const
 Tests if window is used for drawing into a BBitmap. This is mostly used by the Interface Kit itself.
 
BMenuBarKeyMenuBar () const
 Returns a pointer to the key menu bar set to the window.
 
BViewLastMouseMovedView () const
 Returns a pointer to the attached view that most recently received a B_MOUSE_MOVED message.
 
void Layout (bool force)
 Update the size limits and do the layout of the topmost view attached to the window.
 
window_look Look () const
 Returns the current window look flag.
 
virtual void MenusBeginning ()
 Hook method that gets called just before a menu owned by the window is shown.
 
virtual void MenusEnded ()
 Hook method that gets called just before a menu owned by the window is hidden.
 
virtual void MessageReceived (BMessage *message)
 Handle message received by the associated looper.
 
virtual void Minimize (bool minimize)
 Minimizes or un-minimizes the window based on minimize.
 
void MoveBy (float dx, float dy)
 Move the window by dx pixels horizontally and dy pixels vertically.
 
void MoveOnScreen (uint32 flags=0)
 Update window size and position to make it visible on screen.
 
void MoveTo (BPoint)
 Move the window to point.
 
void MoveTo (float x, float y)
 Move the window to the specified x and y coordinates.
 
bool NeedsUpdate () const
 Returns whether or not any of the attached views need to be updated.
 
virtual status_t Perform (perform_code code, void *data)
 Internal method.
 
bigtime_t PulseRate () const
 Returns the pulse rate of the window.
 
virtual void Quit ()
 Deletes the window and all child views, destroys the window thread, removes the window's connection to the Application Server, and deletes the object.
 
virtual bool QuitRequested ()
 Hook method that gets called when the window receives a B_QUIT_REQUESTED message.
 
bool RemoveChild (BView *child)
 Removes child from the view hierarchy.
 
status_t RemoveFromSubset (BWindow *window)
 Remove window from the subset of the BWindow.
 
void ResizeBy (float dx, float dy)
 Resize the window by dx pixels horizontally and dy pixels vertically.
 
void ResizeTo (float width, float height)
 Resize the window to the specified width and height.
 
void ResizeToPreferred ()
 Resize the window to the preferred size of the window's layout.
 
virtual BHandlerResolveSpecifier (BMessage *message, int32 index, BMessage *specifier, int32 what, const char *property)
 
virtual thread_id Run ()
 Spawns the message loop thread and starts the window running.
 
virtual void ScreenChanged (BRect screenSize, color_space depth)
 Hook method that is called when the screen that the window is located on changes size or location or the color space of the screen changes.
 
status_t SendBehind (const BWindow *window)
 Moves the BWindow object behind window.
 
status_t SetDecoratorSettings (const BMessage &settings)
 Set the window decorator settings according to settings.
 
void SetDefaultButton (BButton *button)
 Set the default button of the window to button.
 
status_t SetFeel (window_feel feel)
 Changes the window feel set in the constructor to feel.
 
status_t SetFlags (uint32)
 Changes the window flags set in the constructor to flags.
 
void SetKeyMenuBar (BMenuBar *bar)
 Set the specified menu bar as the key menu bar for the window.
 
virtual void SetLayout (BLayout *layout)
 Sets the layout of the window.
 
status_t SetLook (window_look look)
 Changes the window look set in the constructor to look.
 
void SetPulseRate (bigtime_t rate)
 Sets how often B_PULSE messages are posted to the window.
 
void SetSizeLimits (float minWidth, float maxWidth, float minHeight, float maxHeight)
 Set size limits on the window.
 
void SetTitle (const char *title)
 Sets the window title to title.
 
status_t SetType (window_type type)
 Changes the window type set in the constructor to type.
 
status_t SetWindowAlignment (window_alignment mode, int32 h, int32 hOffset=0, int32 width=0, int32 widthOffset=0, int32 v=0, int32 vOffset=0, int32 height=0, int32 heightOffset=0)
 Sets the alignment of the content of the window on the screen.
 
void SetWorkspaces (uint32)
 Sets the set of workspaces where the window can be displayed.
 
void SetZoomLimits (float maxWidth, float maxHeight)
 Sets the maximum size that the window will zoom to when Zoom() is called.
 
virtual void Show ()
 Shows the window on screen, places it frontmost on the screen, adds the window to Deskbar's window list, and makes it the active window.
 
BSize Size () const
 Returns the size of the window.
 
void Sync () const
 Synchronizes the attached window's connection to App Server causing any pending messages to be processed and then waits for the App Server to respond.
 
const char * Title () const
 Returns the window title as set by the constructor or SetTitle().
 
window_type Type () const
 Returns the current window type flag.
 
void UpdateIfNeeded ()
 Invokes Draw() immediately on each child view that needs updating.
 
void UpdateSizeLimits ()
 Updates the window's size limits from the minimum and maximum sizes of its top view.
 
virtual void WindowActivated (bool focus)
 Hook method that gets called when the window becomes activated or deactivated.
 
virtual void WorkspaceActivated (int32 workspace, bool state)
 Hook method that gets called when the active workspace changes.
 
uint32 Workspaces () const
 Returns the set of workspaces where the window can be displayed.
 
virtual void WorkspacesChanged (uint32 oldWorkspaces, uint32 newWorkspaces)
 Hook method that gets called whenever the workspaces the window is in changes.
 
void Zoom ()
 Resize the window to the minimum of the screen size, the maximum values set by SetSizeLimits(), and the maximum values set by SetZoomLimits().
 
virtual void Zoom (BPoint origin, float width, float height)
 Move window to origin, then resize to width and height.
 
- Public Member Functions inherited from BLooper
 BLooper (const char *name=NULL, int32 priority=B_NORMAL_PRIORITY, int32 portCapacity=B_LOOPER_PORT_DEFAULT_CAPACITY)
 Construct a new BLooper with a priority and an capacity.
 
virtual ~BLooper ()
 Destruct the looper.
 
virtual status_t Perform (perform_code d, void *arg)
 Internal method.
 
status_t PostMessage (uint32 command)
 Post a message with the command as what identifier to this looper.
 
status_t PostMessage (BMessage *message)
 Post a message to this looper.
 
status_t PostMessage (uint32 command, BHandler *handler, BHandler *replyTo=NULL)
 Sends a message with command what identifier to the handler associated with this looper. A response may be sent to the replyTo handler asynchronously.
 
status_t PostMessage (BMessage *message, BHandler *handler, BHandler *replyTo=NULL)
 Send a message to the handler associated with this looper. A response may be sent to the replyTo handler asynchronously.
 
BMessageCurrentMessage () const
 Retrieve the current message.
 
BMessageDetachCurrentMessage ()
 Get ownership of the message currently being processed.
 
void DispatchExternalMessage (BMessage *message, BHandler *handler, bool &_detached)
 Internal method to support single-threaded GUI toolkits.
 
BMessageQueueMessageQueue () const
 Get a pointer to the internal message queue of this looper.
 
bool IsMessageWaiting () const
 Check if there is a message waiting.
 
void AddHandler (BHandler *handler)
 Associate a handler to this looper.
 
bool RemoveHandler (BHandler *handler)
 Disassociate a handler from this looper.
 
int32 CountHandlers () const
 Get the number of handlers associated with this looper.
 
BHandlerHandlerAt (int32 index) const
 Get the handler at an index of the list of associated handlers.
 
int32 IndexOf (BHandler *handler) const
 Get the index of the handler that is in the associated handler list.
 
BHandlerPreferredHandler () const
 Get the preferred handler.
 
void SetPreferredHandler (BHandler *handler)
 Set a preferred handler.
 
thread_id LockingThread () const
 Return the thread id of the thread that currently holds the lock.
 
int32 CountLocks () const
 Return the number of recursive locks that are currently being held on this looper.
 
int32 CountLockRequests () const
 Return the number of pending locks.
 
sem_id Sem () const
 Return the id of the semaphore that is used to lock this looper.
 
virtual void AddCommonFilter (BMessageFilter *filter)
 Add a common filter to the list of filters that are applied to all incoming messages.
 
virtual bool RemoveCommonFilter (BMessageFilter *filter)
 Remove a filter from the common message filter list.
 
virtual void SetCommonFilterList (BList *filters)
 Set a new list of filters that need to be applied to all incoming messages.
 
BListCommonFilterList () const
 Return a list of filters applied to all incoming messages.
 
 BLooper (BMessage *data)
 Construct a looper from an archived message.
 
void Loop ()
 Run the event loop in the current thread.
 
bool Lock ()
 Lock the looper.
 
void Unlock ()
 Unlock a locked looper.
 
bool IsLocked () const
 Check if a looper is locked.
 
status_t LockWithTimeout (bigtime_t timeout)
 Lock a looper with a timeout.
 
thread_id Thread () const
 Return the thread id of the internal message looper thread.
 
team_id Team () const
 Return the team id in which this looper exists.
 
- Public Member Functions inherited from BHandler
 BHandler (const char *name=NULL)
 Construct a new handler with a name.
 
virtual ~BHandler ()
 Free the filters of this handler, as well as the list of observers.
 
virtual status_t Perform (perform_code d, void *arg)
 Perform some action (Internal method defined for binary compatibility purposes).
 
 BHandler (BMessage *data)
 Construct a handler from an archived message.
 
BLooperLooper () const
 Return a pointer to the looper that this handler is associated with.
 
void SetName (const char *name)
 Set or change the name of this handler.
 
const char * Name () const
 Return the name of this handler.
 
virtual void SetNextHandler (BHandler *handler)
 Set the next handler in the chain that the message is passed on to if this handler cannot process it.
 
BHandlerNextHandler () const
 Return the next hander in the chain to which the message is passed on.
 
virtual void AddFilter (BMessageFilter *filter)
 Add filter as a prerequisite to this handler.
 
virtual bool RemoveFilter (BMessageFilter *filter)
 Remove filter from the filter list.
 
virtual void SetFilterList (BList *filters)
 Set the internal list of filters to filters.
 
BListFilterList ()
 Return a pointer to the list of filters.
 
bool LockLooper ()
 Lock the looper associated with this handler.
 
status_t LockLooperWithTimeout (bigtime_t timeout)
 Lock the looper associated with this handler, with a time out value.
 
void UnlockLooper ()
 Unlock the looper.
 
status_t StartWatching (BMessenger target, uint32 what)
 Subscribe this handler to watch a specific state change of a target.
 
status_t StartWatchingAll (BMessenger target)
 Subscribe this handler to watch a target for all events.
 
status_t StopWatching (BMessenger target, uint32 what)
 Unsubscribe this handler from watching a specific state.
 
status_t StopWatchingAll (BMessenger target)
 Unsubscribe this handler from watching all states.
 
status_t StartWatching (BHandler *observer, uint32 what)
 Subscribe an observer for a specific state change of this handler.
 
status_t StartWatchingAll (BHandler *observer)
 Subscribe an observer for a all state changes.
 
status_t StopWatching (BHandler *observer, uint32 what)
 Unsubscribe an observer from watching a specific state.
 
status_t StopWatchingAll (BHandler *observer)
 Unsubscribe an observer from watching all states.
 
virtual void SendNotices (uint32 what, const BMessage *notice=NULL)
 Emit a state change to the observers.
 
bool IsWatched () const
 Check if there are any observers watching this handler.
 
- Public Member Functions inherited from BArchivable
 BArchivable ()
 Constructor. Does nothing.
 
 BArchivable (BMessage *from)
 Constructor. Does important behind-the-scenes work in the unarchiving process.
 
virtual ~BArchivable ()
 Destructor. Does nothing.
 
virtual status_t AllArchived (BMessage *archive) const
 Method relating to the use of BArchiver.
 
virtual status_t AllUnarchived (const BMessage *archive)
 Method relating to the use of BUnarchiver.
 
virtual status_t Archive (BMessage *into, bool deep=true) const
 Archive the object into a BMessage.
 
virtual status_t Perform (perform_code d, void *arg)
 Perform some action (Internal method defined for binary compatibility purposes).
 

Static Public Member Functions

static BArchivableInstantiate (BMessage *archive)
 Creates a new BWindow object from the data message.
 
- Static Public Member Functions inherited from BLooper
static BArchivableInstantiate (BMessage *data)
 Static method to instantiate a looper from an archived message.
 
static BLooperLooperForThread (thread_id thread)
 Static method to retrieve a BLooper for a specified thread.
 
- Static Public Member Functions inherited from BHandler
static BArchivableInstantiate (BMessage *data)
 Static method to instantiate a handler from an archived message.
 
- Static Public Member Functions inherited from BArchivable
static BArchivableInstantiate (BMessage *archive)
 Static member to restore objects from messages.
 

Shortcut Methods

The key parameter is specified in the form of a Unicode code point. This is generally an ASCII character such as 'A' or a key constant such as B_RIGHT_ARROW. To use a UTF-8 character you must first convert it to a Unicode code point using BUnicodeChar::FromUTF8().

void AddShortcut (uint32 key, uint32 modifiers, BMessage *message)
 Creates a keyboard shortcut that sends a message to the window.
 
void AddShortcut (uint32 key, uint32 modifiers, BMessage *message, BHandler *target)
 Creates a keyboard shortcut that sends a message to the specified target.
 
bool HasShortcut (uint32 key, uint32 modifiers)
 Returns whether or not the specified shortcut is set on the window.
 
void RemoveShortcut (uint32 key, uint32 modifiers)
 Removes the specified shortcut from the window.
 

Additional Inherited Members

- Protected Member Functions inherited from BLooper
BMessageMessageFromPort (bigtime_t=B_INFINITE_TIMEOUT)
 Hook method to retrieve a message from the looper's port.
 

Detailed Description

Window base class.

A BWindow is an on-screen window which contains views and is the target of keyboard and mouse events. A BWindow instance is nearly always subclassed.

BWindow draws by talking to App Server. If you want draw directly into the graphics card by-passing App Server, you need to use a BDirectWindow or BWindowScreen.

Despite the fact that BWindow inherits from BLooper, you should not invoke Run() on a BWindow, instead, call Show() to get the message loop started and show the window on screen. Once you've called Show() you may remove a window from the screen without interrupting the message loop by calling Hide(). Other message loop details such as locking and quitting are detailed in the BLooper class.

BWindow has the following built-in shortcuts:

Shortcut Action Handler
Command+X Cut Focus view
Command+C Copy Focus view
Command+V Paste Focus view
Command+A Select All Focus view
Command+W Close Window (if closable)
Command+Q Quit Application (non-modal windows only)
Command+Control+M Minimize Window (if minimizable)
Command+Control+Z Zoom Window (if zoomable)
Command+Control+H Hide Window
Command+Control+F Send to front Window
Command+Control+B Send behind Window
Command+Control+ Go to left workspace Desktop window
Command+Control+ Go to right workspace Desktop window
Command+Control+ Go to above workspace Desktop window
Command+Control+ Go to below workspace Desktop window
Command+Control+Shift+ Send window and go to left workspace Desktop window
Command+Control+Shift+ Send window and go to right workspace Desktop window
Command+Control+Shift+ Send window and go to above workspace Desktop window
Command+Control+Shift+ Send window and go to below workspace Desktop window
Since
BeOS R3

Constructor & Destructor Documentation

◆ BWindow() [1/3]

BWindow::BWindow ( BRect  frame,
const char *  title,
window_type  type,
uint32  flags,
uint32  workspace = B_CURRENT_WORKSPACE 
)

Creates a new BWindow object.

Parameters
frameThe inner frame rectangle in the screen coordinate system.
titleThe window title and thread title as "w>title".
typewindow_type flag, one of the following:
  • B_UNTYPED_WINDOW
  • B_TITLED_WINDOW
  • B_MODAL_WINDOW
  • B_DOCUMENT_WINDOW
  • B_BORDERED_WINDOW
  • B_FLOATING_WINDOW
flagsMask that defines window attributes:
  • B_NOT_MOVABLE cannot be moved by the user
  • B_NOT_CLOSABLE cannot be closed by the user, no close button displayed
  • B_NOT_ZOOMABLE cannot be zoomed by the user, no zoom button displayed
  • B_NOT_MINIMIZABLE cannot be minimized by the user
  • B_NOT_RESIZABLE cannot be resized by the user
  • B_NOT_H_RESIZABLE cannot be resized horizontally by the user
  • B_NOT_V_RESIZABLE cannot be resized vertically by the user
  • B_AVOID_FRONT cannot be brought to front by the user
  • B_AVOID_FOCUS cannot receive keyboard focus
  • B_WILL_ACCEPT_FIRST_CLICK The first click is processed by the window.
  • B_OUTLINE_RESIZE draws only its outline as it's resized and doesn't draw its contents.
  • B_NO_WORKSPACE_ACTIVATION Causes the current workspace to stay active when activated on another workspace.
  • B_NOT_ANCHORED_ON_ACTIVATE Causes the window to move to the current workspace when activated if it already exists on another workspace.
  • B_QUIT_ON_WINDOW_CLOSE Quit the application when the window closes.
  • B_SAME_POSITION_IN_ALL_WORKSPACES Window maintains its position across workspaces.
  • B_AUTO_UPDATE_SIZE_LIMITS Automatically adjust the size according to layout constraints.
  • B_CLOSE_ON_ESCAPE Close when the user pushes the Escape key.
  • B_NO_SERVER_SIDE_WINDOW_MODIFIERS ??
workspaceMask that indicates which of the 32 potential workspace(s) the window should be displayed in or B_CURRENT_WORKSPACE or B_ALL_WORKSPACES constants.
Since
BeOS R3

◆ BWindow() [2/3]

BWindow::BWindow ( BRect  frame,
const char *  title,
window_look  look,
window_feel  feel,
uint32  flags,
uint32  workspace = B_CURRENT_WORKSPACE 
)

Creates a new BWindow object with the specified look and feel.

Parameters
frameThe inner frame rectangle in the screen coordinate system.
titleThe window title and thread title as "w>title".
lookThe window_look flags, one of the following:
  • B_BORDERED_WINDOW_LOOK No title bar, thin border, no resize control.
  • B_NO_BORDER_WINDOW_LOOK A borderless rectangle with no provisions to move or close the window.
  • B_TITLED_WINDOW_LOOK Like B_DOCUMENT_WINDOW_LOOK, but with a resize corner instead of a resize thumb.
  • B_DOCUMENT_WINDOW_LOOK Large title bar, thick border, draggable resize corner thumb.
  • B_MODAL_WINDOW_LOOK For modal dialogs: no title bar, thick border, resize corner depending on the B_NOT_RESIZABLE flag.
  • B_FLOATING_WINDOW_LOOK For floating sub windows: small title bar, thin border, resize corner.
feelThe window_feel flags, one of the following:
  • B_NORMAL_WINDOW_FEEL Behaves like a normal, non-modal, non-floating window.
  • B_MODAL_SUBSET_WINDOW_FEEL Blocks all windows in its subset when displayed. Visible only if a window in its subset is visible.
  • B_MODAL_APP_WINDOW_FEEL Blocks all windows in its app when displayed. Visible only if a window in its app is visible.
  • B_MODAL_ALL_WINDOW_FEEL Blocks all windows across the entire system when displayed. Always visible in all workspaces.
  • B_FLOATING_SUBSET_WINDOW_FEEL Floats above all windows in its subset when displayed. Visible only if a window in its subset is the frontmost window.
  • B_FLOATING_APP_WINDOW_FEEL Floats above all windows in its app when displayed. Visible only if a window in its app is the frontmost window.
  • B_FLOATING_ALL_WINDOW_FEEL Floats above all windows across the entire system when displayed. Always visible in all workspaces.
flagsMask that defines window attributes:
  • B_NOT_MOVABLE cannot be moved by the user
  • B_NOT_CLOSABLE cannot be closed by the user, no close button displayed
  • B_NOT_ZOOMABLE cannot be zoomed by the user, no zoom button displayed
  • B_NOT_MINIMIZABLE cannot be minimized by the user
  • B_NOT_RESIZABLE cannot be resized by the user
  • B_NOT_H_RESIZABLE cannot be resized horizontally by the user
  • B_NOT_V_RESIZABLE cannot be resized vertically by the user
  • B_AVOID_FRONT cannot be brought to front by the user
  • B_AVOID_FOCUS cannot receive keyboard focus
  • B_WILL_ACCEPT_FIRST_CLICK The first click is processed by the window.
  • B_OUTLINE_RESIZE draws only its outline as it's resized and doesn't draw its contents.
  • B_NO_WORKSPACE_ACTIVATION Causes the current workspace to stay active when activated on another workspace.
  • B_NOT_ANCHORED_ON_ACTIVATE Causes the window to move to the current workspace when activated if it already exists on another workspace.
  • B_QUIT_ON_WINDOW_CLOSE Quit the application when the window closes.
  • B_SAME_POSITION_IN_ALL_WORKSPACES Window maintains its position across workspaces.
  • B_AUTO_UPDATE_SIZE_LIMITS Automatically adjust the size according to layout constraints.
  • B_CLOSE_ON_ESCAPE Close when the user pushes the Escape key.
  • B_NO_SERVER_SIDE_WINDOW_MODIFIERS ??
workspaceMask that indicates which of the 32 potential workspace(s) the window should be displayed in or B_CURRENT_WORKSPACE or B_ALL_WORKSPACES constants.
Since
BeOS R3

◆ ~BWindow()

BWindow::~BWindow ( )
virtual

Destroys the BWindow object and all attached views.

Since
BeOS R3

◆ BWindow() [3/3]

BWindow::BWindow ( BMessage data)

Archive constructor.

Parameters
dataA pointer to the BMessage object to build the object from.
Since
BeOS R3

Member Function Documentation

◆ Activate()

void BWindow::Activate ( bool  active = true)

Activates or deactivates the window based on active.

The title tab of the active window is drawn more brightly, the window is made frontmost, and it becomes the target of keyboard events. Calling Show() automatically activates the window calling the WindowActivated() hook method.

Parameters
activetrue to activate the window, false to deactivate the window.
Since
BeOS R3

◆ AddChild() [1/2]

void BWindow::AddChild ( BLayoutItem child)

Add the child layout item to the view hierarchy.

Parameters
childThe child layout item to add.
Since
Haiku R1

◆ AddChild() [2/2]

void BWindow::AddChild ( BView child,
BView before = NULL 
)

Adds child to the view hierarchy immediately before before.

A view may only have one parent at a time so child must not have already been added to the view hierarchy. If before is NULL then child is added to the end of the view hierarchy.

The AttachedToWindow() method is invoked on child and all of its descendent views.

Parameters
childThe child view to add.
beforeThe sibling view to add child before.
Since
BeOS R3

◆ AddShortcut() [1/2]

void BWindow::AddShortcut ( uint32  key,
uint32  modifiers,
BMessage message 
)

Creates a keyboard shortcut that sends a message to the window.

Warning
Don't use this method to a create menu shortcut, add a BMenuItem instead.
Parameters
keyThe character that activates the shortcut, case-insensitive.
modifiersA bit mask of modifiers in addition to B_COMMAND_KEY, options include:
  • B_SHIFT_KEY
  • B_OPTION_KEY
  • B_CONTROL_KEY
  • B_MENU_KEY
messageThe message to send when the shortcut is activated. The BWindow takes ownership of the message.
Since
BeOS R3

◆ AddShortcut() [2/2]

void BWindow::AddShortcut ( uint32  key,
uint32  modifiers,
BMessage message,
BHandler target 
)

Creates a keyboard shortcut that sends a message to the specified target.

Warning
Don't use this method to a create menu shortcut, add a BMenuItem instead.
Parameters
keyThe character that activates the shortcut, case-insensitive.
modifiersA bit mask of modifiers in addition to B_COMMAND_KEY, options include one or more of the following:
  • B_SHIFT_KEY
  • B_OPTION_KEY
  • B_CONTROL_KEY
  • B_MENU_KEY
messageThe message to send when the shortcut is activated. The BWindow takes ownership of the message.
targetThe handler to send the message to.
Since
BeOS R3

◆ AddToSubset()

status_t BWindow::AddToSubset ( BWindow window)

Adds window to be in the subset of the BWindow.

Returns
A status code.
Return values
B_OKwindow was added as a subset of the BWindow.
B_BAD_VALUEwindow is not B_NORMAL_WINDOW_FEEL or the BWindow object's feel is not set to B_MODAL_SUBSET_WINDOW_FEEL or B_FLOATING_SUBSET_WINDOW_FEEL.
B_ERRORCould not lock the BWindow object.
Since
BeOS R3

◆ Archive()

status_t BWindow::Archive ( BMessage data,
bool  deep = true 
) const
virtual

Archives the object into the data message.

Parameters
dataA pointer to the BMessage object to archive the object into.
deepWhether or not to archive child views as well.
Returns
A status code, B_OK if the object was archived or an error code otherwise.
Since
BeOS R3

Reimplemented from BLooper.

Reimplemented in BDirectWindow, and BAlert.

◆ BeginViewTransaction()

void BWindow::BeginViewTransaction ( )

Stall updates to App Server allowing you to batch drawing commands to limit flickering.

Unlike DisableUpdates() the messages are sent but are not processed.

Since
Haiku R1

◆ Bounds()

BRect BWindow::Bounds ( ) const

Returns the bounding rectangle of the window.

Returns
The bounding rectangle of the window as a BRect in the window's coordinate system.
See also
Frame()
Since
BeOS R3

◆ CenterIn()

void BWindow::CenterIn ( const BRect rect)

Center the window in rect.

Parameters
rectThe rectangle to center the window in.
Since
Haiku R1

◆ CenterOnScreen() [1/2]

void BWindow::CenterOnScreen ( )

Centers the window on the screen the window is currently on.

Since
Haiku R1

◆ CenterOnScreen() [2/2]

void BWindow::CenterOnScreen ( screen_id  id)

Centers the window on the screen with the passed in id.

Since
Haiku R1

◆ ChildAt()

BView * BWindow::ChildAt ( int32  index) const

Returns a pointer to the child view found at index.

Parameters
indexThe index of the child view to return a pointer of.
Returns
A pointer to the child view at index or NULL if not found.
Since
BeOS R3

◆ Close()

void BWindow::Close ( )
inline

Deprecated alias for BWindow::Quit().

The advised way to close a window is to use BWindow::Quit().

Since
BeOS R3

References Quit().

◆ ConvertFromScreen() [1/4]

void BWindow::ConvertFromScreen ( BPoint point) const

Convert point from the screen's coordinate system to the window's coordinate system in place.

Parameters
pointA pointer to a BPoint object to convert.
Since
BeOS R3

◆ ConvertFromScreen() [2/4]

BPoint BWindow::ConvertFromScreen ( BPoint  point) const

Returns point converted from the screen's coordinate system to the window's coordinate system.

Parameters
pointA BPoint object to convert.
Returns
A new BPoint object in the window's coordinate system.
Since
BeOS R3

◆ ConvertFromScreen() [3/4]

void BWindow::ConvertFromScreen ( BRect rect) const

Convert rect from the screen's coordinate system to the window's coordinate system in place.

Parameters
rectA pointer to a BRect object to convert.
Since
BeOS R3

◆ ConvertFromScreen() [4/4]

BRect BWindow::ConvertFromScreen ( BRect  rect) const

Returns rect converted from the screen's coordinate system to the window's coordinate system.

Parameters
rectA BRect object to convert.
Returns
A new BRect object in the window's coordinate system.
Since
BeOS R3

◆ ConvertToScreen() [1/4]

void BWindow::ConvertToScreen ( BPoint point) const

Convert point to the screen's coordinate system in place.

Parameters
pointA pointer to a BPoint object to convert.
Since
BeOS R3

◆ ConvertToScreen() [2/4]

BPoint BWindow::ConvertToScreen ( BPoint  point) const

Returns point converted to the screen's coordinate system.

Parameters
pointA BPoint object to convert.
Returns
A new BPoint object in the screen's coordinate system.
Since
BeOS R3

◆ ConvertToScreen() [3/4]

void BWindow::ConvertToScreen ( BRect rect) const

Convert rect to the screen's coordinate system in place.

Parameters
rectA pointer to a BRect object to convert.
Since
BeOS R3

◆ ConvertToScreen() [4/4]

BRect BWindow::ConvertToScreen ( BRect  rect) const

Returns rect converted to the screen's coordinate system.

Parameters
rectA BRect object to convert.
Returns
A new BRect object in the screen's coordinate system.
Since
BeOS R3

◆ CountChildren()

int32 BWindow::CountChildren ( ) const

Returns the number of child views that the window has.

Returns
The number of child views as an int32.
Since
BeOS R3

◆ CurrentFocus()

BView * BWindow::CurrentFocus ( ) const

Returns a pointer to the current focus view of the window.

Returns
A pointer to the current focus view of the window or NULL if not found.
Since
BeOS R3

◆ DecoratorFrame()

BRect BWindow::DecoratorFrame ( ) const

Returns the frame rectangle of the window decorator.

Returns
The bounding rectangle of the window decorator as a BRect in the screen coordinate system.
Since
Haiku R1

◆ DefaultButton()

BButton * BWindow::DefaultButton ( ) const

Returns a pointer to the default button set on the window.

Returns
A pointer to the window's default button or NULL if it doesn't have one.
Since
BeOS R3

◆ DisableUpdates()

void BWindow::DisableUpdates ( )

Suppresses drawing within the window.

If you want the results of several drawing operations to appear in the window all at once you disable updates, draw, and then re-enable updates.

Since
BeOS R3

◆ DispatchMessage()

void BWindow::DispatchMessage ( BMessage message,
BHandler target 
)
virtual

Window's central message-processing method.

This method called automatically as messages arrive in the queue, you should never call DispatchMessage() yourself.

Warning
Don't override this method in your BWindow subclass. Override MessageReceived() instead to alter the window's message dispatching mechanism.
See also
BLooper::DispatchMessage()
Since
BeOS R3

Reimplemented from BLooper.

Reimplemented in BDirectWindow, and BAlert.

◆ EnableUpdates()

void BWindow::EnableUpdates ( )

Re-enable drawing within the window.

If you want the results of several drawing operations to appear in the window all at once you disable updates, draw, and then re-enable updates.

Since
BeOS R3

◆ EndViewTransaction()

void BWindow::EndViewTransaction ( )

Ends a view transaction allowing update to go to App Server again.

Since
Haiku R1

◆ Feel()

window_feel BWindow::Feel ( ) const

Returns the current window feel flag.

Returns
The currently set window feel flag.
Since
BeOS R3

◆ FindView() [1/2]

BView * BWindow::FindView ( BPoint  point) const

Returns a pointer to the attached view located at the specified point.

Parameters
pointThe point to get the view at in the window's coordinate system.
Returns
A pointer to the BView object or NULL if no view is found.
Since
BeOS R3

◆ FindView() [2/2]

BView * BWindow::FindView ( const char *  viewName) const

Returns the attached view with the specified viewName.

Parameters
viewNameThe name of the attached view to look for.
Returns
A pointer to the BView object or NULL if no view is found.
Since
BeOS R3

◆ Flags()

uint32 BWindow::Flags ( ) const

Returns the current window flags.

Returns
The currently set window flags.
Since
BeOS R3

◆ Flush()

void BWindow::Flush ( ) const

Flushes the window's connection to App Server causing any pending messages to be processed then returns immediately.

Since
BeOS R3

◆ Frame()

BRect BWindow::Frame ( ) const

Returns the frame rectangle of the window.

Returns
The bounding rectangle of the window as a BRect in the screen coordinate system.
See also
Bounds()
Since
BeOS R3

◆ FrameMoved()

void BWindow::FrameMoved ( BPoint  newPosition)
virtual

Hook method that gets called when the window is moved.

Parameters
newPositionThe point of the top left corner of the frame rectangle that the window has been moved to.
Since
BeOS R3

Reimplemented in BDirectWindow.

◆ FrameResized()

void BWindow::FrameResized ( float  newWidth,
float  newHeight 
)
virtual

Hook method that gets called when the window is resized.

Parameters
newWidthThe new width of the window.
newHeightThe new height of the window.
Since
BeOS R3

Reimplemented in BDirectWindow, and BAlert.

◆ GetDecoratorSettings()

status_t BWindow::GetDecoratorSettings ( BMessage settings) const

Fill out the window's decorator settings into settings.

Parameters
settingsA pointer to a BMessage object to fill out.
Returns
B_OK if the decorator settings were filled out successfully or an error code otherwise.
Since
Haiku R1

◆ GetLayout()

BLayout * BWindow::GetLayout ( ) const

Get the layout of the window.

Returns
The layout of the window.
Since
Haiku R1

◆ GetSizeLimits()

void BWindow::GetSizeLimits ( float *  _minWidth,
float *  _maxWidth,
float *  _minHeight,
float *  _maxHeight 
)

Fills out the size limits set on the window.

Parameters
_minWidthThe minimum width of the window.
_maxWidthThe maximum width of the window.
_minHeightThe minimum height of the window.
_maxHeightThe maximum height of the window.
Since
BeOS R3

◆ GetSupportedSuites()

status_t BWindow::GetSupportedSuites ( BMessage data)
virtual

Reports the suites of messages and specifiers understood by the window.

Since
BeOS R3

Reimplemented from BLooper.

Reimplemented in BDirectWindow, and BAlert.

◆ GetWindowAlignment()

status_t BWindow::GetWindowAlignment ( window_alignment mode = NULL,
int32 h = NULL,
int32 hOffset = NULL,
int32 width = NULL,
int32 widthOffset = NULL,
int32 v = NULL,
int32 vOffset = NULL,
int32 height = NULL,
int32 heightOffset = NULL 
) const

Fills out the pointers with the alignment of the content of the window on the screen.

Since
BeOS R3

◆ HasShortcut()

bool BWindow::HasShortcut ( uint32  key,
uint32  modifiers 
)

Returns whether or not the specified shortcut is set on the window.

Parameters
keyThe character to check, case-insensitive.
modifiersA bit mask of modifiers in addition to B_COMMAND_KEY, options include one or more of the following:
  • B_SHIFT_KEY
  • B_OPTION_KEY
  • B_CONTROL_KEY
  • B_MENU_KEY
Returns
true if the window has the specified shortcut, false otherwise.
Since
Haiku R1

◆ Hide()

void BWindow::Hide ( )
virtual

Removes the window from the screen, removes it from Deskbar's window list, and passes active status to another window.

Calls to Hide() and Show() are cumulative.

Since
BeOS R3

Reimplemented in BDirectWindow.

◆ Instantiate()

BArchivable * BWindow::Instantiate ( BMessage data)
static

Creates a new BWindow object from the data message.

Parameters
dataA pointer to the BMessage object to build the object from.
Returns
A newly created BWindow object or NULL if the message doesn't contain an archived BWindow.
Since
BeOS R3

◆ InvalidateLayout()

void BWindow::InvalidateLayout ( bool  descendants = false)

Invalidate layout.

Parameters
descendantsAlso invalidate its children windows.
Since
Haiku R1

◆ InViewTransaction()

bool BWindow::InViewTransaction ( ) const

Returns whether or not the window is currently in a view transaction.

Returns
true if the window is currently in a view transaction, false otherwise.
Since
Haiku R1

◆ IsActive()

bool BWindow::IsActive ( ) const

Returns whether or not the window is active.

Returns
true if the window is active, false otherwise.
Since
BeOS R3

◆ IsFloating()

bool BWindow::IsFloating ( ) const

Returns whether or not the window is floating.

Returns
true if the window is floating, false otherwise.
Since
BeOS R3

◆ IsFront()

bool BWindow::IsFront ( ) const

Returns whether or not the window is the frontmost on screen.

Returns
true if window is the frontmost on screen, false otherwise.
Since
BeOS R3

◆ IsHidden()

bool BWindow::IsHidden ( ) const

Returns whether or not the window is hidden.

Windows are hidden by default, you must call Show() to show the window starting the message loop going.

Since
BeOS R3

◆ IsMinimized()

bool BWindow::IsMinimized ( ) const

Returns whether or not the window is minimized.

Returns
true if the window is minimized, false otherwise.
Since
BeOS R5

◆ IsModal()

bool BWindow::IsModal ( ) const

Returns whether or not the window is modal.

Returns
true if the window is modal, false otherwise.
Since
BeOS R3

◆ IsOffscreenWindow()

bool BWindow::IsOffscreenWindow ( ) const

Tests if window is used for drawing into a BBitmap. This is mostly used by the Interface Kit itself.

Returns
True if the window is used for drawing into a BBitmap.
Since
Haiku R1

◆ KeyMenuBar()

BMenuBar * BWindow::KeyMenuBar ( ) const

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 be the key menu bar for the window. If more than one menu bar is attached to the window then the last one added to the window's view hierarchy is considered to be the key menu bar for the window.

To explicitly set a menu bar as the key menu bar call SetKeyMenuBar().

Returns
A pointer to the key menu bar or NULL is not is set.
Since
BeOS R3

◆ LastMouseMovedView()

BView * BWindow::LastMouseMovedView ( ) const

Returns a pointer to the attached view that most recently received a B_MOUSE_MOVED message.

Returns
A pointer the BView object that most recently received a B_MOUSE_MOVED message or NULL if not found.
Since
BeOS R3

◆ Layout()

void BWindow::Layout ( bool  force)

Update the size limits and do the layout of the topmost view attached to the window.

Parameters
forceIf true, layout even if valid.
Since
Haiku R1

◆ Look()

window_look BWindow::Look ( ) const

Returns the current window look flag.

Returns
The currently set window look flag.
Since
BeOS R3

◆ MenusBeginning()

void BWindow::MenusBeginning ( )
virtual

Hook method that gets called just before a menu owned by the window is shown.

Note
This method is not invoked by a message, there is no B_MENUS_BEGINNING flag.
Since
BeOS R3

Reimplemented in BDirectWindow.

◆ MenusEnded()

void BWindow::MenusEnded ( )
virtual

Hook method that gets called just before a menu owned by the window is hidden.

Note
This method is not invoked by a message, there is no B_MENUS_ENDED flag.
Since
BeOS R3

Reimplemented in BDirectWindow.

◆ MessageReceived()

void BWindow::MessageReceived ( BMessage message)
virtual

Handle message received by the associated looper.

Parameters
messageThe message received by the looper.
See also
BHandler::MessageReceived()
Since
BeOS R3

Reimplemented from BLooper.

Reimplemented in BDirectWindow, and BAlert.

◆ Minimize()

void BWindow::Minimize ( bool  minimize)
virtual

Minimizes or un-minimizes the window based on minimize.

Unlike Hide() an Show(), Minimize() dims and un-dims the entry for the window in Deskbar's window list rather than removing it. Also Minimize() calls are not cumulative like Hide() and Show(); one false call will undo multiple true calls.

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 DeskBar window list. The minimize parameter is true if the window is about to be hidden and false if it is about to be shown.

If you override Minimize() and you want to inherit BWindow's behavior, you must call BWindow::Minimize().

Since
BeOS R3

Reimplemented in BDirectWindow.

◆ MoveBy()

void BWindow::MoveBy ( float  dx,
float  dy 
)

Move the window by dx pixels horizontally and dy pixels vertically.

dx and dy must be integral units.

Parameters
dxThe number of pixels to move the window vertically.
dyThe number of pixels to move the window horizontally.
Since
BeOS R3

◆ MoveOnScreen()

void BWindow::MoveOnScreen ( uint32  flags = 0)

Update window size and position to make it visible on screen.

This convenience method helps you to automatically move and resize a window to make it visible on the screen, in case the window is partially off screen because of its size or its position. This method will do nothing if the window fits on the screen.

The default behavior is as follows:

  • If the window size is larger than the screen, the window is resized so that it fits on the screen.
  • If the window is still partially off-screen, it will then be centered horizontally and vertically so that it is fully visible.

Note that this does not affect window size and positions for windows that are currently visible on the screen. Also note that this method does not affect whether the window is covered by other windows that are on top. You can use BWindow::Activate() to bring a window to the top.

The behavior of this method can be altered by passing either or both of the following modifiers in the flags parameter:

  • B_DO_NOT_RESIZE_TO_FIT Do not resize the window. If the window is too large to be on the screen, then it will at least be moved so that the left-top of the window is visible, and only the right and/or bottom of the window will be off screen.
  • B_MOVE_IF_PARTIALLY_OFFSCREEN Use this parameter if instead of centering the window in the middle of the screen, you only want to do the minimum movement so that at least the top left part of the window is visible on screen.
Parameters
flagsCan be 0 for the default behavior, or a any combination of B_DO_NOT_RESIZE_TO_FIT and B_MOVE_IF_PARTIALLY_OFFSCREEN.
Since
Haiku R1

◆ MoveTo() [1/2]

void BWindow::MoveTo ( BPoint  point)

Move the window to point.

Parameters
pointthe location to move the window in the screen's coordinate system.
Since
BeOS R3

◆ MoveTo() [2/2]

void BWindow::MoveTo ( float  x,
float  y 
)

Move the window to the specified x and y coordinates.

x and y must be integral units.

Parameters
xThe horizontal coordinate to move the window to in the screen's coordinate system.
yThe vertical coordinate to move the window to in the screen's coordinate system.
Since
BeOS R3

◆ NeedsUpdate()

bool BWindow::NeedsUpdate ( ) const

Returns whether or not any of the attached views need to be updated.

Returns
true if an attached view needs to be updated, false otherwise.
Since
BeOS R3

◆ Perform()

virtual status_t BWindow::Perform ( perform_code  d,
void *  arg 
)
virtual

Internal method.

Since
Haiku R1

Reimplemented from BLooper.

Reimplemented in BDirectWindow, and BAlert.

◆ PulseRate()

bigtime_t BWindow::PulseRate ( ) const

Returns the pulse rate of the window.

B_PULSE messages are sent by default every 500,000 microseconds provided that no other messages are pending.

Returns
The pulse rate of the window as a bigtime_t.
Since
BeOS R3

◆ Quit()

void BWindow::Quit ( )
virtual

Deletes the window and all child views, destroys the window thread, removes the window's connection to the Application Server, and deletes the 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 when called from the BWindow's thread and it returns after all messages have been processed when called from another thread and the BWindow and its thread has been destroyed.

Warning
The window must first be locked before calling Quit().
See also
BLooper::Quit()
Since
BeOS R3

Reimplemented from BLooper.

Reimplemented in BDirectWindow, and BAlert.

Referenced by Close().

◆ QuitRequested()

bool BWindow::QuitRequested ( )
virtual

Hook method that gets called when the window receives a B_QUIT_REQUESTED message.

See also
Quit()
BLooper::QuitRequested()
Since
BeOS R3

Reimplemented from BLooper.

Reimplemented in BAlert.

◆ RemoveChild()

bool BWindow::RemoveChild ( BView child)

Removes child from the view hierarchy.

Parameters
childThe child view to remove.
Returns
Whether or not child was removed from the view hierarchy.
Since
BeOS R3

◆ RemoveFromSubset()

status_t BWindow::RemoveFromSubset ( BWindow window)

Remove window from the subset of the BWindow.

Returns
A status code.
Return values
B_OKwindow was removed from the subset of the BWindow.
B_BAD_VALUEwindow is not B_NORMAL_WINDOW_FEEL or the BWindow object's feel is not set to B_MODAL_SUBSET_WINDOW_FEEL or B_FLOATING_SUBSET_WINDOW_FEEL.
B_ERRORCould not lock the BWindow object.
Since
BeOS R3

◆ RemoveShortcut()

void BWindow::RemoveShortcut ( uint32  key,
uint32  modifiers 
)

Removes the specified shortcut from the window.

The memory used by the shortcut message is freed.

Parameters
keyThe character to remove, case-insensitive.
modifiersA bit mask of modifiers in addition to B_COMMAND_KEY, options include one or more of the following:
  • B_SHIFT_KEY
  • B_OPTION_KEY
  • B_CONTROL_KEY
  • B_MENU_KEY
Since
BeOS R3

◆ ResizeBy()

void BWindow::ResizeBy ( float  dx,
float  dy 
)

Resize the window by dx pixels horizontally and dy pixels vertically.

dx and dy must be integral units.

dx The number of pixels to resize the window horizontally.

dy The number of pixels to resize the window vertically.

Since
BeOS R3

◆ ResizeTo()

void BWindow::ResizeTo ( float  width,
float  height 
)

Resize the window to the specified width and height.

width and height must be integral units.

Parameters
widthThe width to resize the window to.
heightThe height to resize the window to.
Since
BeOS R3

◆ ResizeToPreferred()

void BWindow::ResizeToPreferred ( )

Resize the window to the preferred size of the window's layout.

Since
Haiku R1

◆ ResolveSpecifier()

BHandler * BWindow::ResolveSpecifier ( BMessage message,
int32  index,
BMessage specifier,
int32  what,
const char *  property 
)
virtual

Determine the proper handler for a scripting message.

Parameters
messageThe scripting message to determine the handler.
indexThe index of the specifier.
specifierThe message which contains the specifier.
whatThe 'what' field of the specifier message.
propertyThe name of the target property.
Returns
A pointer to the proper BHandler for the given scripting message.
Since
BeOS R3

Reimplemented from BLooper.

Reimplemented in BAlert, and BDirectWindow.

◆ Run()

thread_id BWindow::Run ( )
virtual

Spawns the message loop thread and starts the window running.

See also
BLooper::Run()
Since
BeOS R3

Reimplemented from BLooper.

◆ ScreenChanged()

void BWindow::ScreenChanged ( BRect  screenSize,
color_space  depth 
)
virtual

Hook method that is called when the screen that the window is located on changes size or location or the color space of the screen changes.

Parameters
screenSizeThe new screen size in the screen's coordinate system.
depthThe new color space of the screen.
Since
BeOS R3

Reimplemented in BDirectWindow.

◆ SendBehind()

status_t BWindow::SendBehind ( const BWindow window)

Moves the BWindow object behind window.

Parameters
windowA pointer to the window to move behind.
Returns
B_OK on success or B_ERROR on failure.
Since
BeOS R3

◆ SetDecoratorSettings()

status_t BWindow::SetDecoratorSettings ( const BMessage settings)

Set the window decorator settings according to settings.

Parameters
settingsThe decorator settings message to set.
Returns
B_OK if the decorator settings were set successfully or an error code otherwise.
Since
Haiku R1

◆ SetDefaultButton()

void BWindow::SetDefaultButton ( BButton button)

Set the default button of the window to button.

The default button has a grey outline and is activated by the user pushing the Enter key. The user can activate the default button even if another view is currently set to be the focus view of the window.

A window may only have one default button at a time, to remove the current default without setting another button you may pass in NULL.

Parameters
buttonA pointer to the button to set as the default or NULL to unset.
Since
BeOS R3

◆ SetFeel()

status_t BWindow::SetFeel ( window_feel  feel)

Changes the window feel set in the constructor to feel.

Returns
B_OK on success or an error code on failure.
Since
BeOS R3

◆ SetFlags()

status_t BWindow::SetFlags ( uint32  flags)

Changes the window flags set in the constructor to flags.

Returns
B_OK on success or an error code on failure.
Since
BeOS R3

◆ SetKeyMenuBar()

void BWindow::SetKeyMenuBar ( BMenuBar bar)

Set the specified menu 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 of the menu hierarchy that the user can navigate with the keyboard.

Parameters
barA pointer to the menu bar to set as as the key menu bar for the window.
Since
BeOS R3

◆ SetLayout()

void BWindow::SetLayout ( BLayout layout)
virtual

Sets the layout of the window.

Parameters
layoutThe layout to set.
Since
Haiku R1

Referenced by BLayoutBuilder::Cards< ParentBuilder >::Cards(), BLayoutBuilder::Grid< ParentBuilder >::Grid(), and BLayoutBuilder::Group< ParentBuilder >::Group().

◆ SetLook()

status_t BWindow::SetLook ( window_look  look)

Changes the window look set in the constructor to look.

Returns
B_OK on success or an error code on failure.
Since
BeOS R3

◆ SetPulseRate()

void BWindow::SetPulseRate ( bigtime_t  rate)

Sets how often B_PULSE messages are posted to the window.

All BViews attached to a window share the same pulse rate.

rate should not be set to less than 100,000 microseconds, differences less than 50,000 microseconds may not be noticeable.

Setting the rate to 0 disables pulsing for all views attache to the window.

Parameters
rateThe pulse rate to set.
Since
BeOS R3

◆ SetSizeLimits()

void BWindow::SetSizeLimits ( float  minWidth,
float  maxWidth,
float  minHeight,
float  maxHeight 
)

Set size limits on the window.

The user won't be able to resize the window beyond the limits set by this method. SetSizeLimits() constrains the user, not the programmer, you may still resize the window outside of the size limits set by this method by calling ResizeBy() or ResizeTo().

Parameters
minWidthThe minimum width of the window to set.
maxWidthThe maximum width of the window to set.
minHeightThe minimum height of the window to set.
maxHeightThe maximum height of the window to set.
Since
BeOS R3

◆ SetTitle()

void BWindow::SetTitle ( const char *  title)

Sets the window title to title.

Also renames the window thread to "w>title" where "title" is the passed in title string.

Since
BeOS R5

◆ SetType()

status_t BWindow::SetType ( window_type  type)

Changes the window type set in the constructor to type.

Returns
B_OK on success or an error code on failure.
Since
BeOS R3

◆ SetWindowAlignment()

status_t BWindow::SetWindowAlignment ( window_alignment  mode,
int32  h,
int32  hOffset = 0,
int32  width = 0,
int32  widthOffset = 0,
int32  v = 0,
int32  vOffset = 0,
int32  height = 0,
int32  heightOffset = 0 
)

Sets the alignment of the content of the window on the screen.

Since
BeOS R3

◆ SetWorkspaces()

void BWindow::SetWorkspaces ( uint32  workspaces)

Sets the set of workspaces where the window can be displayed.

Parameters
workspaces
  • B_CURRENT_WORKSPACE to place the window in the currently displayed workspace removing it from all others.
  • B_ALL_WORKSPACES to make the window show up in all workspaces.
Since
BeOS R3

◆ SetZoomLimits()

void BWindow::SetZoomLimits ( float  maxWidth,
float  maxHeight 
)

Sets the maximum size that the window will zoom to when Zoom() is called.

The window will zoom to the minimum of the screen size, the maximum values set by SetSizeLimits(), and the maximum values set by this method.

/see Zoom()

Since
BeOS R3

◆ Show()

void BWindow::Show ( )
virtual

Shows the window on screen, places it frontmost on the screen, adds the 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 loop is started and it is unlocked.

Calls to Hide() and Show() are cumulative.

Since
BeOS R3

Reimplemented in BDirectWindow.

◆ Size()

BSize BWindow::Size ( ) const

Returns the size of the window.

Returns
The size of the window as a BSize in the screen coordinate system.
Since
Haiku R1

◆ Sync()

void BWindow::Sync ( ) const

Synchronizes the attached window's connection to App Server causing any pending messages to be processed and then waits for the App Server to respond.

Since
BeOS R3

◆ Title()

const char * BWindow::Title ( ) const

Returns the window title as set by the constructor or SetTitle().

Returns
A pointer to the window title.
Since
BeOS R3

◆ Type()

window_type BWindow::Type ( ) const

Returns the current window type flag.

Returns
The currently set window type flag.
Since
BeOS R3

◆ UpdateIfNeeded()

void BWindow::UpdateIfNeeded ( )

Invokes Draw() immediately on each child view that needs updating.

This method is synchronous, it waits for each child view to update before returning. This method is ignored unless it is called from within the message loop of the thread that the BWindow is running in.

You may call this method as part of a hook function such as MouseMoved() or KeyDown() to force invalid views to be immediately redrawn without having to wait for the hook function to finish.

Since
BeOS R3

◆ UpdateSizeLimits()

void BWindow::UpdateSizeLimits ( )

Updates the window's size limits from the minimum and maximum sizes of its top view.

This method does nothing unless the B_AUTO_UPDATE_SIZE_LIMITS window flag is set.

The method is called automatically after a layout invalidation. Since it is invoked asynchronously, calling this method manually is necessary, if it is desired 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

◆ WindowActivated()

void BWindow::WindowActivated ( bool  active)
virtual

Hook method that gets called when the window becomes activated or deactivated.

Parameters
activetrue if the window has become activated, false if the window has become deactivated.
Since
BeOS R3

Reimplemented in BDirectWindow.

◆ WorkspaceActivated()

void BWindow::WorkspaceActivated ( int32  workspace,
bool  state 
)
virtual

Hook method that gets called when the active workspace changes.

This method is only called when a workspace in which the window resides is activated or deactivated.

Parameters
workspaceThe workspace number that was activated/deactivated.
statetrue if activated, false if deactivated.
Since
BeOS R3

Reimplemented in BDirectWindow.

◆ Workspaces()

uint32 BWindow::Workspaces ( ) const

Returns the set of workspaces where the window can be displayed.

Since
BeOS R3

◆ WorkspacesChanged()

void BWindow::WorkspacesChanged ( uint32  oldWorkspaces,
uint32  newWorkspaces 
)
virtual

Hook method that gets called whenever the workspaces the window is in changes.

Parameters
oldWorkspacesThe old set of workspaces the window was visible in.
newWorkspacesThe new set of workspaces the window is visible in.
Since
BeOS R3

Reimplemented in BDirectWindow.

◆ Zoom() [1/2]

void BWindow::Zoom ( )

Resize the window to the minimum of the screen size, the maximum values set by SetSizeLimits(), and the maximum values set by SetZoomLimits().

You may call Zoom() even if the window has the 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:

  1. the screen frame,
  2. the rectangle defined by SetZoomLimits(),
  3. 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 also
Zoom(BPoint, float, float);
Since
BeOS R3

◆ Zoom() [2/2]

void BWindow::Zoom ( BPoint  origin,
float  width,
float  height 
)
virtual

Move window to origin, then resize to width and height.

You may call Zoom() even if the window has the B_NOT_ZOOMABLE flag set.

This method may move and resize the window resulting in both the FrameMoved() and FrameResized() hook methods to be called.

You can override this method to change how your window behaves when the user clicks the zoom button or when Zoom() is called.

Parameters
originThe point that the window was moved to.
widthThe new width of the window.
heightThe new height of the window.
Since
BeOS R3

Reimplemented in BDirectWindow.