#include <Window.h>
Inheritance diagram for BWindow:

BWindow objects draw windows by talking to the App Server. If you want to take over the entire screen or draw directly into the graphics card's frame buffer (by-passing the App Server), you should use a BDirectWindow or BWindowScreen object (both classes are defined in the Game Kit).
Public Member Functions | |
| BWindow (BRect frame, const char *title, window_type type, uint32 flags, uint32 workspace=B_CURRENT_WORKSPACE) | |
| BWindow (BRect frame, const char *title, window_look look, window_feel feel, uint32 flags, uint32 workspace=B_CURRENT_WORKSPACE) | |
| virtual | ~BWindow () |
| BWindow (BMessage *data) | |
| virtual status_t | Archive (BMessage *data, bool deep=true) const |
| virtual void | Quit () |
| void | Close () |
| BWindow * | Parent () |
| status_t | AddChild (BWindow *window) |
| bool | RemoveChild (BWindow *window) |
| bool | RemoveSelf () |
| void | AddChild (BView *child, BView *before=NULL) |
| bool | RemoveChild (BView *child) |
| int32 | CountChildren () const |
| BView * | ChildAt (int32 index) const |
| virtual void | DispatchMessage (BMessage *message, BHandler *handler) |
| virtual void | MessageReceived (BMessage *message) |
| virtual void | FrameMoved (BPoint new_position) |
| virtual void | WorkspacesChanged (uint32 old_ws, uint32 new_ws) |
| virtual void | WorkspaceActivated (int32 ws, bool state) |
| virtual void | FrameResized (float new_width, float new_height) |
| virtual void | Minimize (bool minimize) |
| virtual void | Zoom (BPoint rec_position, float rec_width, float rec_height) |
| void | Zoom () |
| void | SetZoomLimits (float max_h, float max_v) |
| virtual void | ScreenChanged (BRect screen_size, color_space depth) |
| void | SetPulseRate (bigtime_t rate) |
| bigtime_t | PulseRate () const |
| void | AddShortcut (uint32 key, uint32 modifiers, BMessage *msg) |
| void | AddShortcut (uint32 key, uint32 modifiers, BMessage *msg, BHandler *target) |
| void | RemoveShortcut (uint32 key, uint32 modifiers) |
| void | SetDefaultButton (BButton *button) |
| BButton * | DefaultButton () const |
| virtual void | MenusBeginning () |
| virtual void | MenusEnded () |
| bool | NeedsUpdate () const |
| void | UpdateIfNeeded () |
| BView * | FindView (const char *view_name) const |
| BView * | FindView (BPoint) const |
| BView * | CurrentFocus () const |
| void | ClearExplicitFocus () |
| void | Activate (bool=true) |
| virtual void | WindowActivated (bool state) |
| void | ConvertToScreen (BPoint *pt) const |
| BPoint | ConvertToScreen (BPoint pt) const |
| void | ConvertFromScreen (BPoint *pt) const |
| BPoint | ConvertFromScreen (BPoint pt) const |
| void | ConvertToScreen (BRect *rect) const |
| BRect | ConvertToScreen (BRect rect) const |
| void | ConvertFromScreen (BRect *rect) const |
| BRect | ConvertFromScreen (BRect rect) const |
| void | MoveBy (float dx, float dy) |
| void | MoveTo (BPoint) |
| void | MoveTo (float x, float y) |
| void | ResizeBy (float dx, float dy) |
| void | ResizeTo (float width, float height) |
| virtual void | Show () |
| virtual void | Hide () |
| bool | IsHidden () const |
| bool | IsMinimized () const |
| void | SetWindowColor (rgb_color color) |
| rgb_color | WindowColor () const |
| void | Flush () const |
| void | Sync () const |
| void | SetCurrentBeep (const char *name) |
| const char * | CurrentBeep () const |
| status_t | SendBehind (const BWindow *window) |
| void | DisableUpdates () |
| void | EnableUpdates () |
| void | BeginViewTransaction () |
| void | EndViewTransaction () |
| status_t | ClipWindowToPicture (BPicture *picture, BPoint offset, uint32 flags) |
| BRect | Bounds () const |
| BRect | Frame () const |
| const char * | Title () const |
| void | SetTitle (const char *title) |
| bool | IsFront () const |
| bool | IsActive () const |
| void | SetKeyMenuBar (BMenuBar *bar) |
| BMenuBar * | KeyMenuBar () const |
| void | SetSizeLimits (float min_h, float max_h, float min_v, float max_v) |
| void | GetSizeLimits (float *min_h, float *max_h, float *min_v, float *max_v) |
| uint32 | Workspaces () const |
| void | SetWorkspaces (uint32) |
| BView * | LastMouseMovedView () const |
| virtual BHandler * | ResolveSpecifier (BMessage *msg, int32 index, BMessage *specifier, int32 form, const char *property) |
| virtual status_t | GetSupportedSuites (BMessage *data) |
| status_t | AddToSubset (BWindow *window) |
| status_t | RemoveFromSubset (BWindow *window) |
| virtual status_t | Perform (perform_code d, void *arg) |
| status_t | SetType (window_type type) |
| window_type | Type () const |
| status_t | SetLook (window_look look) |
| window_look | Look () const |
| status_t | SetFeel (window_feel feel) |
| window_feel | Feel () const |
| status_t | SetFlags (uint32) |
| uint32 | Flags () const |
| bool | IsModal () const |
| bool | IsFloating () const |
| status_t | GetFrameState (BMessage *dest) const |
| status_t | UpdateFrameState (const BMessage &changes) |
| 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) |
| 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 |
| virtual bool | QuitRequested () |
| virtual thread_id | Run () |
| virtual status_t | UISettingsChanged (const BMessage *changes, uint32 flags) |
| virtual BView * | NextNavigableView (BView *currentFocus, uint32 flags) |
| void | DequeueAll () |
| bool | find_token_and_handler (BMessage *msg, int32 *token, BHandler **handler) |
Static Public Member Functions | |
| static BArchivable * | Instantiate (BMessage *data) |
Friends | |
| class | BApplication |
| class | BBitmap |
| class | BControl |
| class | BScrollBar |
| class | BView |
| class | BMenuItem |
| class | BWindowScreen |
| class | BDirectWindow |
| class | BFilePanel |
| class | _CEventPort_ |
| void | _set_menu_sem_ (BWindow *w, sem_id sem) |
| status_t | _safe_get_server_token_ (const BLooper *, int32 *) |
|
||||||||||||||||||||||||
|
Creates a new window.
|
|
||||||||||||||||||||||||||||
|
Creates a new window. For more parameters look above. |
|
|
You never delete your BWindows; call Quit() instead. |
|
|
|
|
|
Makes the BWindow the active window (if bringFront is
|
|
||||||||||||
|
Places child (and its child views) in the window, adds it to the window's view list, and adds it to the window's list of handlers:
Each BView in child's hierarchy is sent an AttachedToWindow() call. When they've all had a chance to respond, they're each sent an AllAttached() call. If child has already been added to a view hierarchy, or if before isn't in the window's view list, AddChild() fails.
|
|
|
|
|
||||||||||||||||||||
|
See AddShortcut() above. Notes on the arguments:
|
|
||||||||||||||||
|
Creates a keyboard shortcut: When the user types Command+modifiers+key, message is sent to handler. If a shortcut already exists for modifiers+key, it's removed before the new shortcut is added. Notes on the arguments:
As with all Command events, a |
|
|
Adds windows to this window's subset. This affects modal and floating windows with a subset feel only (i.e.
|
|
||||||||||||
|
Archives the BWindow by recording its frame rectangle, title, type, and flags in the BMessage data. If the deep flag is
Reimplemented from BLooper. Reimplemented in BDirectWindow, and BAlert. |
|
|
|
|
|
This function return the rectangle that encloses the window's content area. The bounds rectangle (Bounds()) is expressed in the window's coordinate system.
|
|
|
Returns the index'th view in the window's view list, or
|
|
|
|
|
||||||||||||||||
|
|
|
|
|
|
|
Converts the argument from screen coordinates to window coordinates. The rect needn't fall within this BWindow's bounds.
The BWindow must be locked. |
|
|
Converts the argument from screen coordinates to window coordinates. The rect needn't fall within this BWindow's bounds.
The BWindow must be locked. |
|
|
Converts the argument from screen coordinates to window coordinates. The point needn't fall within this BWindow's bounds.
The BWindow must be locked. |
|
|
Converts the argument from screen coordinates to window coordinates. The point needn't fall within this BWindow's bounds.
The BWindow must be locked. |
|
|
Converts the argument from window coordinates to screen coordinates. The rect needn't fall within this BWindow's bounds.
The BWindow must be locked. |
|
|
Converts the argument from window coordinates to screen coordinates. The rect needn't fall within this BWindow's bounds.
The BWindow must be locked. |
|
|
Converts the argument from window coordinates to screen coordinates. The point needn't fall within this BWindow's bounds.
The BWindow must be locked. |
|
|
Converts the argument from window coordinates to screen coordinates. The point needn't fall within this BWindow's bounds.
The BWindow must be locked. |
|
|
|
|
|
|
|
|
Returns the current focus view for the BWindow, or
|
|
|
Return the window's default button. This is the button that's mapped to the Enter key. The user can activate the default button at any time - even if another BView is the focus view (the focus view will not receive a When you promote or demote a default button, it's automatically redisplayed and receives a BButton::MakeDefault() call. |
|
|
|
|
|
This function disable automatic updating within the window Any drawing that's done while updates are disabled is suppressed until updates are re-enabled. If you're doing a lot of drawing within the window, and you want the results of the drawing to appear all at once, you should disable updates, draw, and then re-enable updates.
|
|
||||||||||||
|
Implementation detail; see BLooper::DispatchMessage().
Reimplemented from BLooper. Reimplemented in BDirectWindow, BAlert, and BDirectGLWindow. |
|
|
This function enable automatic updating within the window Any drawing that's done while updates are disabled is suppressed until updates are re-enabled. If you're doing a lot of drawing within the window, and you want the results of the drawing to appear all at once, you should disable updates, draw, and then re-enable updates.
|
|
|
|
|
|
|
|
||||||||||||||||
|
|
|
|
Find a view located at the window.
|
|
|
Find a view located at the window.
|
|
|
|
|
|
This function cause this window's App Server-bound messages to be sent immediately. Flush() sends the messages and returns immediately;
|
|
|
This function return the rectangle that encloses the window's content area. The frame rectangle (Frame()) is expressed in the screen's coordinate system.
|
|
|
This hook function are invoked just after the window's frame is moved, whether by the user or programatically. The arguments give the window's new origin (in screen coordinates). The default implementations do nothing. param origin New Window position
Reimplemented in BDirectWindow, and BDirectGLWindow. |
|
||||||||||||
|
This hook function are invoked just after the window's frame is resized, whether by the user or programatically. The arguments give the window's new dimensions. The default implementations do nothing.
Reimplemented in BDirectWindow, BAlert, and BDirectGLWindow. |
|
|
|
|
||||||||||||||||||||
|
These functions set limits on the size of the window. The user won't be able to resize the window beyond the limits set by SetSizeLimits() - to make it have a width less than minWidth or greater than , nor a height less than minHeight or greater than maxHeight. By default, the minimums are sufficiently small and the maximums sufficiently large to accommodate any window within reason. GetSizeLimits() writes the current limits to the variables provided.
|
|
|
Reimplemented from BLooper. Reimplemented in BDirectWindow, BAlert, and BDirectGLWindow. |
|
||||||||||||||||||||||||||||||||||||||||
|
Returns the current window alignment.
|
|
|
Removes the window from the screen, removes it from Deskbar's window list, and passes active status to some other window (if this is the active window). If Hide() is called more than once, you'll need to call Show() an equal number of times for the window to become visible again. Reimplemented in BDirectWindow, BWindowScreen, and BDirectGLWindow. |
|
|
Reimplemented from BLooper. Reimplemented in BDirectWindow, and BAlert. |
|
|
|
|
|
This function return
|
|
|
This function return |
|
|
|
|
|
|
|
|
This function return |
|
|
|
|
|
|
|
|
|
|
|
The MenusBeginning() hook function is called just before menus belonging to the window are about to be shown to the user. The default implementation do nothing. You can implement this function to make sure the menus' states accurately reflect the state of the window.
Reimplemented in DocWindow, BDirectWindow, and BDirectGLWindow. |
|
|
MenusEnded() is called when the menus have been removed from the screen. The default implementation do nothing. You can implement this function to make sure the menus' states accurately reflect the state of the window.
Reimplemented in BDirectWindow, and BDirectGLWindow. |
|
|
Implementation detail. See BHandler::MessageReceived(). Reimplemented from BLooper. Reimplemented in DocWindow, BDirectWindow, BAlert, BDirectGLWindow, PrintPanelWindow, and BSimpleWindow. |
|
|
Hides and shows the window (and passes active status), as minimize is
Minimize() also acts as a hook that's invoked when the user double-clicks the window's title tab or selects the window from DeskBar's window list. If minimize is Reimplemented in BDirectWindow, and BDirectGLWindow. |
|
||||||||||||
|
This function move the window without resizing it. MoveBy() adds dh coordinate units to the left and right components of the window's frame rectangle and dv units to the frame's top and bottom. If dh and dv are negative, the window moves upward and to the left. If they're positive, it moves downward and to the right.
Neither function alters the BWindow's coordinate system or bounds rectangle. When this function move a window, a window-moved event is reported to the window. This results in the BWindow's FrameMoved() function being called.
|
|
||||||||||||
|
This function move the window without resizing it. MoveTo() moves the left top corner of the window's content area to x, y in the screen coordinate system; it adjusts all coordinates in the frame rectangle accordingly.
Neither function alters the BWindow's coordinate system or bounds rectangle. When this function move a window, a window-moved event is reported to the window. This results in the BWindow's FrameMoved() function being called.
|
|
|
This function move the window without resizing it. MoveTo() moves the left top corner of the window's content area to point in the screen coordinate system; it adjusts all coordinates in the frame rectangle accordingly.
Neither function alters the BWindow's coordinate system or bounds rectangle. When this function move a window, a window-moved event is reported to the window. This results in the BWindow's FrameMoved() function being called.
|
|
|
|
|
||||||||||||
|
|
|
|
|
|
||||||||||||
|
Reimplemented from BLooper. Reimplemented in BDirectWindow, BWindowScreen, BAlert, and BDirectGLWindow. |
|
|
These functions return how often Pulse() is called for the BWindow's views (how often B_PULSE messages are posted to the window). All BViews attached to the same window share the same pulse rate.
|
|
|
Removes the window from the screen, deletes all the BViews in its view hierarchy, destroys the window thread, removes the window's connection to the Application Server, and deletes the BWindow object.
Use this function, rather than the BWindow's Quit() works much like the BLooper function it overrides. When called from the BWindow's thread, it doesn't return. When called from another thread, it returns after all previously posted messages have been processed and the BWindow and its thread have been destroyed.
Reimplemented from BLooper. Reimplemented in BDirectWindow, BWindowScreen, BAlert, and BDirectGLWindow. |
|
|
Reimplemented from BLooper. Reimplemented in DocWindow, BAlert, PrintPanelWindow, and BSimpleWindow. |
|
|
Removes aView (and its children) from the window's display, view list, and handler list, and sets aView's next handler to
|
|
|
|
|
|
Removes windows from this window's subset. This affects modal and floating windows with a subset feel only (i.e.
|
|
|
|
|
||||||||||||
|
|
|
||||||||||||
|
Theis function resize the window, while keeping its left top corner constant. ResizeBy() adds dh pixels to the width of the window's frame and dv pixels to its height.
|
|
||||||||||||
|
Sets the frame absolutely to [h, v] pixels. Fractional components are rounded to the nearest whole number.
|
|
||||||||||||||||||||||||
|
Reimplemented from BLooper. Reimplemented in BDirectWindow, BAlert, and BDirectGLWindow. |
|
|
Reimplemented from BLooper. |
|
||||||||||||
|
Hook function that's called when the screen (on which this window is located) changes size or location in the screen coordinate system, or changes color space (depth).frame is the screen's new frame rectangle, and mode is its new color space.
Reimplemented in BDirectWindow, BWindowScreen, and BDirectGLWindow. |
|
|
Relayers the windows on the screen so this window is behind window.
|
|
|
|
|
|
Set the window's default button. This is the button that's mapped to the Enter key. The user can activate the default button at any time - even if another BView is the focus view (the focus view will not receive a When you promote or demote a default button, it's automatically redisplayed and receives a BButton::MakeDefault() call. |
|
|
Changes the window's feel to the specified value.
|
|
|
|
|
|
|
|
|
|
|
|
This function set how often Pulse() is called for the BWindow's views (how often
By turning on the SetPulseRate() permits you to set a different interval. The interval set should not be less than 100,000 microseconds; differences less than 50,000 microseconds may not be noticeable. A finer granularity can't be guaranteed. Setting the pulse rate to 0 disables pulsing for all views in the window. See also: BView::Pulse(), the BView constructor |
|
||||||||||||||||||||
|
These functions set limits on the size of the window. The user won't be able to resize the window beyond the limits set by SetSizeLimits() - to make it have a width less than minWidth or greater than , nor a height less than minHeight or greater than maxHeight. By default, the minimums are sufficiently small and the maximums sufficiently large to accommodate any window within reason. SetSizeLimits() constrains the user, not the programmer. It's legal for an application to set a window size that falls outside the permitted range. The limits are imposed only when the user attempts to resize the window; at that time, the window will jump to a size that's within range.
|
|
|
Replaces the current title with new_title. It also renames the window thread in the following format: "w>newTitle" where as many characters of the new_title are included in the thread name as will fit.
|
|
|
Changes the type of the window to the specified value.
|
|
||||||||||||||||||||||||||||||||||||||||
|
Sets the current alignment of the window content on the screen. mode is either
If mode is
If mode is
|
|
|
|
|
|
This function set the set of workspaces where the window can be displayed. The space argument passed to SetWorkspaces() and the value returned by Workspaces() is a bitfield with one bit set for each workspace in which the window can appear. Usually a window appears in just one workspace. SetWorkspaces() can associate a window with workspaces that don't exist yet. The window will appear in those workspaces if and when the user creates them.
B_CURRENT_WORKSPACE as the spaces argument to place the window in the workspace that's currently displayed (the active workspace) and remove it from all others, or B_ALL_WORKSPACES to make sure the window shows up in all workspaces, including any new ones that the user might create. Workspaces() may return B_ALL_WORKSPACES, but will identify the current workspace rather than return B_CURRENT_WORKSPACE.Changing a BWindow's set of workspaces causes it to be notified with a WorkspacesChanged() function call.
|
|
||||||||||||
|
Sets the maximum size that the window will zoom to (when the Zoom() function is called). The maximums set by SetSizeLimits() also apply to zooming; the window will zoom to the screen size or to the smaller of the maximums set by these two functions. Since the sides of a window must line up on screen pixels, the values passed to both SetSizeLimits() and SetZoomLimits() should be whole numbers.
|
|
|
Places the window frontmost on the screen (but behind any applicable floating or modal windows), places it on Deskbar's window list, and makes it the active window. If this is the BWindow's first Show(), the object's message loop is started, and the object is unlocked. Reimplemented in BDirectWindow, BWindowScreen, and BDirectGLWindow. |
|
|
This function cause this window's App Server-bound messages to be sent immediately. Sync() send the messages and waits for the App Server to respond. In other words, when Sync() returns you're guaranteed that all of the flushed messages have been processed. |
|
|
Returns a pointer to the current title. The returned string is null-terminated. It belongs to the BWindow object, which may alter the string or free the memory where it resides without notice. Applications should ask for the title each time it's needed and make a copy for their own purposes. |
|
|
|
|
||||||||||||
|
|
|
|
|
|
|
Immediately and synchronously invokes Draw() on each child view that needs updating. This function is ignored if its called from any thread other than the BWindow's message loop. You call it as part of the implementation of a user interface hook function (MouseMoved(), KeyDown(), et. al.) to force invalid views to be immediately redrawn without having to wait for the hook function to finish. Forcing an Update while Responding to an Event for details and an example. |
|
|
Is a hook function that's automatically invoked on the BWindow (and each of its BView children) when the window is activated or deactivated. If active is
Reimplemented in BDirectWindow, BWindowScreen, and BDirectGLWindow. |
|
|
|
|
||||||||||||
|
Implemented by derived classes to respond to a notification that the workspace displayed on the screen has changed. All windows in the newly activated workspace as well as those in the one that was just deactivated get this notification.
The workspace argument is an index to the workspace in question and the active flag conveys its current status. If active is The default (BWindow) version of this function is empty.
Reimplemented in BDirectWindow, BWindowScreen, and BDirectGLWindow. |
|
|
This function return the set of workspaces where the window can be displayed.
|
|
||||||||||||
|
Implemented by derived classes to respond to a notification the the window has just changed the set of workspaces in which it can be displayed from old_ws to new_ws. This typically happens when the user moves a window from one workspace to another, but it may also happen when a programmatic change is made to the set of permitted workspaces. Each workspace is represented by a corresponding bit in the old_ws and new_ws masks.
Reimplemented in BDirectWindow, and BDirectGLWindow. |
|
|
The non-virtual Zoom() (which is called when the user clicks the zoom button, but can also be called programatically) figures out a new size and location for the window (as described below), and then passes these dimensions to the virtual Zoom() hook function. It's hook Zoom()'s responsibility to actually resize and move the window; the default version applies the arguments explicitly by calling MoveTo() and ResizeTo(). You can re-implement hook Zoom() to create a new zooming algorithm that incorporates or ignores the arguments as you see fit. The dimensions that non-virtual Zoom() passes to hook Zoom() are deduced from the smallest of three rectangles: 1) the screen rectangle, 2) the rectangle defined by SetZoomLimits(), 3) the rectangle defined by SetSizeLimits(). However, if the window's rectangle already matches these "zoom" dimensions (give or take a few pixels), Zoom() passes the window's previous ("non-zoomed") size and location. You can effectively call Zoom() even if the window is B_NOT_ZOOMABLE. Zoom() may both move and resize the window, resulting in FrameMoved() and FrameResized() notifications. |
|
||||||||||||||||
|
Hook function.
Reimplemented in BDirectWindow, and BDirectGLWindow. |
|
|
|
|
||||||||||||
|
Reimplemented from BLooper. |
|
||||||||||||
|
|
|
|
Reimplemented from BLooper. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Reimplemented from BLooper. |
|
|
|