Public Member Functions | Static Public Member Functions | List of all members
BAlert Class Reference

The BAlert class defines a modal alert dialog which displays a short message and provides a set of labeled buttons that allow the user to respond. More...

Inherits BWindow.

Public Member Functions

 BAlert (const char *title, const char *text, const char *button1, const char *button2=NULL, const char *button3=NULL, button_width width=B_WIDTH_AS_USUAL, alert_type type=B_INFO_ALERT)
 Creates and initializes a BAlert dialog. More...
 
 BAlert (const char *title, const char *text, const char *button1, const char *button2, const char *button3, button_width width, button_spacing spacing, alert_type type=B_INFO_ALERT)
 Creates and initializes a BAlert dialog. More...
 
 BAlert (BMessage *data)
 Unarchives an alert from a BMessage. More...
 
virtual ~BAlert ()
 Destructor method. More...
 
BButtonButtonAt (int32 index) const
 Returns a pointer to the BButton at the specified index. More...
 
virtual void DispatchMessage (BMessage *message, BHandler *handler)
 Sends out a message. More...
 
virtual void FrameResized (float newWidth, float newHeight)
 Resizes the alert dialog. More...
 
virtual status_t GetSupportedSuites (BMessage *data)
 Reports the suites of messages and specifiers understood by the window. More...
 
int32 Go ()
 Displays the alert window. More...
 
status_t Go (BInvoker *invoker)
 Displays the alert window from a specified invoker. More...
 
virtual void MessageReceived (BMessage *message)
 Initiates an action from a received message. More...
 
virtual status_t Perform (perform_code d, void *arg)
 Perform some action. (Internal Method) More...
 
virtual void Quit ()
 Quits the window closing it. More...
 
virtual bool QuitRequested ()
 Hook method that gets called with the window is closed. More...
 
virtual BHandlerResolveSpecifier (BMessage *message, int32 index, BMessage *specifier, int32 form, const char *property)
 Determine the proper handler for a scripting message. More...
 
void SetShortcut (int32 buttonIndex, char key)
 Sets the shortcut character which is mapped to a button at the specified index. More...
 
char Shortcut (int32 buttonIndex) const
 Gets the shortcut character which is mapped to a button at the specified index. More...
 
BTextViewTextView () const
 Returns the Alert's TextView. More...
 
- Public Member Functions inherited from BWindow
 BWindow (BRect frame, const char *title, window_type type, uint32 flags, uint32 workspace=B_CURRENT_WORKSPACE)
 Creates a new BWindow object. More...
 
 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. More...
 
 BWindow (BMessage *archive)
 Archive constructor. More...
 
virtual ~BWindow ()
 Destroys the BWindow object and all attached views. More...
 
void Activate (bool=true)
 Activates or deactivates the window based on active. More...
 
void AddChild (BView *child, BView *before=NULL)
 Adds child to the view hierarchy immediately before before. More...
 
void AddChild (BLayoutItem *child)
 Add the child layout item to the view hierarchy. More...
 
status_t AddToSubset (BWindow *window)
 Adds window to be in the subset of the BWindow. More...
 
void BeginViewTransaction ()
 Stall updates to App Server allowing you to batch drawing commands to limit flickering. More...
 
BRect Bounds () const
 Returns the bounding rectangle of the window. More...
 
void CenterIn (const BRect &rect)
 Center the window in rect. More...
 
void CenterOnScreen ()
 Centers the window on the screen the window is currently on. More...
 
void CenterOnScreen (screen_id id)
 Centers the window on the screen with the passed in id. More...
 
BViewChildAt (int32 index) const
 Returns a pointer to the child view found at index. More...
 
void ConvertFromScreen (BPoint *point) const
 Convert point from the screen's coordinate system to the window's coordinate system in place. More...
 
BPoint ConvertFromScreen (BPoint point) const
 Returns point converted from the screen's coordinate system to the window's coordinate system. More...
 
void ConvertFromScreen (BRect *rect) const
 Convert rect from the screen's coordinate system to the window's coordinate system in place. More...
 
BRect ConvertFromScreen (BRect rect) const
 Returns rect converted from the screen's coordinate system to the window's coordinate system. More...
 
void ConvertToScreen (BPoint *point) const
 Convert point to the screen's coordinate system in place. More...
 
BPoint ConvertToScreen (BPoint point) const
 Returns point converted to the screen's coordinate system. More...
 
void ConvertToScreen (BRect *rect) const
 Convert rect to the screen's coordinate system in place. More...
 
BRect ConvertToScreen (BRect rect) const
 Returns rect converted to the screen's coordinate system. More...
 
int32 CountChildren () const
 Returns the number of child views that the window has. More...
 
BViewCurrentFocus () const
 Returns a pointer to the current focus view of the window. More...
 
BRect DecoratorFrame () const
 Returns the frame rectangle of the window decorator. More...
 
BButtonDefaultButton () const
 Returns a pointer to the default button set on the window. More...
 
void DisableUpdates ()
 Suppresses drawing within the window. More...
 
void EnableUpdates ()
 Re-enable drawing within the window. More...
 
void EndViewTransaction ()
 Ends a view transaction allowing update to go to App Server again. More...
 
window_feel Feel () const
 Returns the current window feel flag. More...
 
BViewFindView (const char *viewName) const
 Returns the attached view with the specified viewName. More...
 
BViewFindView (BPoint) const
 Returns a pointer to the attached view located at the specified point. More...
 
uint32 Flags () const
 Returns the current window flags. More...
 
void Flush () const
 Flushes the window's connection to App Server causing any pending messages to be processed then returns immediately. More...
 
BRect Frame () const
 Returns the frame rectangle of the window. More...
 
virtual void FrameMoved (BPoint newPosition)
 Hook method that gets called when the window is moved. More...
 
status_t GetDecoratorSettings (BMessage *settings) const
 Fill out the window's decorator settings into settings. More...
 
BLayoutGetLayout () const
 Get the layout of the window. More...
 
void GetSizeLimits (float *minWidth, float *maxWidth, float *minHeight, float *maxHeight)
 Fills out the size limits set on the window. More...
 
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. More...
 
virtual void Hide ()
 Removes the window from the screen, removes it from Deskbar's window list, and passes active status to another window. More...
 
void InvalidateLayout (bool descendants=false)
 Invalidate layout. More...
 
bool InViewTransaction () const
 Returns whether or not the window is currently in a view transaction. More...
 
bool IsActive () const
 Returns whether or not the window is active. More...
 
bool IsFloating () const
 Returns whether or not the window is floating. More...
 
bool IsFront () const
 Returns whether or not the window is the frontmost on screen. More...
 
bool IsHidden () const
 Returns whether or not the window is hidden. More...
 
bool IsMinimized () const
 Returns whether or not the window is minimized. More...
 
bool IsModal () const
 Returns whether or not the window is modal. More...
 
bool IsOffscreenWindow () const
 Tests if window is used for drawing into a BBitmap. This is mostly used by the Interface Kit itself. More...
 
BMenuBarKeyMenuBar () const
 Returns a pointer to the key menu bar set to the window. More...
 
BViewLastMouseMovedView () const
 Returns a pointer to the attached view that most recently received a B_MOUSE_MOVED message. More...
 
void Layout (bool force)
 Update the size limits and do the layout of the topmost view attached to the window. More...
 
window_look Look () const
 Returns the current window look flag. More...
 
virtual void MenusBeginning ()
 Hook method that gets called just before a menu owned by the window is shown. More...
 
virtual void MenusEnded ()
 Hook method that gets called just before a menu owned by the window is hidden. More...
 
virtual void Minimize (bool minimize)
 Minimizes or un-minimizes the window based on minimize. More...
 
void MoveBy (float dx, float dy)
 Move the window by dx pixels horizontally and dy pixels vertically. More...
 
void MoveTo (BPoint)
 Move the window to point. More...
 
void MoveTo (float x, float y)
 Move the window to the specified x and y coordinates. More...
 
bool NeedsUpdate () const
 Returns whether or not any of the attached views need to be updated. More...
 
bigtime_t PulseRate () const
 Returns the pulse rate of the window. More...
 
bool RemoveChild (BView *child)
 Removes child from the view hierarchy. More...
 
status_t RemoveFromSubset (BWindow *window)
 Remove window from the subset of the BWindow. More...
 
void ResizeBy (float dx, float dy)
 Resize the window by dx pixels horizontally and dy pixels vertically. More...
 
void ResizeTo (float width, float height)
 Resize the window to the specified width and height. More...
 
virtual thread_id Run ()
 Spawns the message loop thread and starts the window running. More...
 
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. More...
 
status_t SendBehind (const BWindow *window)
 Moves the BWindow object behind window. More...
 
status_t SetDecoratorSettings (const BMessage &settings)
 Set the window decorator settings according to settings. More...
 
void SetDefaultButton (BButton *button)
 Set the default button of the window to button. More...
 
status_t SetFeel (window_feel feel)
 Changes the window feel set in the constructor to feel. More...
 
status_t SetFlags (uint32)
 Changes the window flags set in the constructor to flags. More...
 
void SetKeyMenuBar (BMenuBar *bar)
 Set the specified menu bar as the key menu bar for the window. More...
 
virtual void SetLayout (BLayout *layout)
 Sets the layout of the window. More...
 
status_t SetLook (window_look look)
 Changes the window look set in the constructor to look. More...
 
void SetPulseRate (bigtime_t rate)
 Sets how often B_PULSE messages are posted to the window. More...
 
void SetSizeLimits (float minWidth, float maxWidth, float minHeight, float maxHeight)
 Set size limits on the window. More...
 
void SetTitle (const char *title)
 Sets the window title to title. More...
 
status_t SetType (window_type type)
 Changes the window type set in the constructor to type. More...
 
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. More...
 
void SetWorkspaces (uint32)
 Sets the set of workspaces where the window can be displayed. More...
 
void SetZoomLimits (float maxWidth, float maxHeight)
 Sets the maximum size that the window will zoom to when Zoom() is called. More...
 
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. More...
 
BSize Size () const
 Returns the size of the window. More...
 
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. More...
 
const char * Title () const
 Returns the window title as set by the constructor or SetTitle(). More...
 
window_type Type () const
 Returns the current window type flag. More...
 
void UpdateIfNeeded ()
 Invokes Draw() immediately on each child view that needs updating. More...
 
void UpdateSizeLimits ()
 Updates the window's size limits from the minimum and maximum sizes of its top view. More...
 
virtual void WindowActivated (bool focus)
 Hook method that gets called when the window becomes activated or deactivated. More...
 
virtual void WorkspaceActivated (int32 workspace, bool state)
 Hook method that gets called when the active workspace changes. More...
 
uint32 Workspaces () const
 Returns the set of workspaces where the window can be displayed. More...
 
virtual void WorkspacesChanged (uint32 oldWorkspaces, uint32 newWorkspaces)
 Hook method that gets called when the number of workspaces changes. More...
 
virtual void Zoom (BPoint origin, float width, float height)
 Move window to origin, then resize to width and height. More...
 
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(). More...
 
void AddShortcut (uint32 key, uint32 modifiers, BMessage *message)
 Creates a keyboard shortcut that sends a message to the window. More...
 
void AddShortcut (uint32 key, uint32 modifiers, BMessage *message, BHandler *target)
 Creates a keyboard shortcut that sends a message to the specified target. More...
 
bool HasShortcut (uint32 key, uint32 modifiers)
 Returns whether or not the specified shortcut is set on the window. More...
 
void RemoveShortcut (uint32 key, uint32 modifiers)
 Removes the specified shortcut from the window. More...
 
- 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. More...
 
virtual ~BLooper ()
 Destruct the looper. More...
 
status_t PostMessage (uint32 command)
 Post a message with the command as what identifier to this looper. More...
 
status_t PostMessage (BMessage *message)
 Post a message to this looper. More...
 
status_t PostMessage (uint32 command, BHandler *handler, BHandler *replyTo=NULL)
 Send a message with the command as what identifier to the handler associated with this looper, and (optionally) request a reply. More...
 
status_t PostMessage (BMessage *message, BHandler *handler, BHandler *replyTo=NULL)
 Send a message to the handler associated with this looper, and (optionally) request a reply. More...
 
BMessageCurrentMessage () const
 Retrieve the current message. More...
 
BMessageDetachCurrentMessage ()
 Get ownership of the message currently being processed. More...
 
BMessageQueueMessageQueue () const
 Get a pointer to the internal message queue of this looper. More...
 
bool IsMessageWaiting () const
 Check if there is a message waiting. More...
 
void AddHandler (BHandler *handler)
 Associate a handler to this looper. More...
 
bool RemoveHandler (BHandler *handler)
 Disassociate a handler from this looper. More...
 
int32 CountHandlers () const
 Get the number of handlers associated with this looper. More...
 
BHandlerHandlerAt (int32 index) const
 Get the handler at an index of the list of associated handlers. More...
 
int32 IndexOf (BHandler *handler) const
 Get the index of the handler that is in the associated handler list. More...
 
BHandlerPreferredHandler () const
 Get the preferred handler. More...
 
void SetPreferredHandler (BHandler *handler)
 Set a preferred handler. More...
 
thread_id LockingThread () const
 Return the thread id of the thread that currently holds the lock. More...
 
int32 CountLocks () const
 Return the number of recursive locks that are currently being held on this looper. More...
 
int32 CountLockRequests () const
 Return the number of pending locks. More...
 
sem_id Sem () const
 Return the id of the semaphore that is used to lock this looper. More...
 
virtual void AddCommonFilter (BMessageFilter *filter)
 Add a common filter to the list of filters that are applied to all incoming messages. More...
 
virtual bool RemoveCommonFilter (BMessageFilter *filter)
 Remove a filter from the common message filter list. More...
 
virtual void SetCommonFilterList (BList *filters)
 Set a new list of filters that need to be applied to all incoming messages. More...
 
BListCommonFilterList () const
 Return a list of filters applied to all incoming messages. More...
 
 BLooper (BMessage *data)
 Construct a looper from an archived message. More...
 
void Loop ()
 Run the event loop in the current thread. More...
 
bool Lock ()
 Lock the looper. More...
 
void Unlock ()
 Unlock a locked looper. More...
 
bool IsLocked () const
 Check if a looper is locked. More...
 
status_t LockWithTimeout (bigtime_t timeout)
 Lock a looper with a timeout. More...
 
thread_id Thread () const
 Return the thread id of the internal message looper thread. More...
 
team_id Team () const
 Return the team id in which this looper exists. More...
 
- Public Member Functions inherited from BHandler
 BHandler (const char *name=NULL)
 Construct a new handler with a name. More...
 
virtual ~BHandler ()
 Free the filters of this handler, as well as the list of observers. More...
 
 BHandler (BMessage *data)
 Construct a handler from an archived message. More...
 
BLooperLooper () const
 Return a pointer to the looper that this handler is associated with. More...
 
void SetName (const char *name)
 Set or change the name of this handler. More...
 
const char * Name () const
 Return the name of this handler. More...
 
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. More...
 
BHandlerNextHandler () const
 Return the next hander in the chain to which the message is passed on. More...
 
virtual void AddFilter (BMessageFilter *filter)
 Add filter as a prerequisite to this handler. More...
 
virtual bool RemoveFilter (BMessageFilter *filter)
 Remove filter from the filter list. More...
 
virtual void SetFilterList (BList *filters)
 Set the internal list of filters to filters. More...
 
BListFilterList ()
 Return a pointer to the list of filters. More...
 
bool LockLooper ()
 Lock the looper associated with this handler. More...
 
status_t LockLooperWithTimeout (bigtime_t timeout)
 Lock the looper associated with this handler, with a time out value. More...
 
void UnlockLooper ()
 Unlock the looper. More...
 
status_t StartWatching (BMessenger target, uint32 what)
 Subscribe this handler to watch a specific state change of a target. More...
 
status_t StartWatchingAll (BMessenger target)
 Subscribe this handler to watch a target for all events. More...
 
status_t StopWatching (BMessenger target, uint32 what)
 Unsubscribe this handler from watching a specific state. More...
 
status_t StopWatchingAll (BMessenger target)
 Unsubscribe this handler from watching all states. More...
 
status_t StartWatching (BHandler *observer, uint32 what)
 Subscribe an observer for a specific state change of this handler. More...
 
status_t StartWatchingAll (BHandler *observer)
 Subscribe an observer for a all state changes. More...
 
status_t StopWatching (BHandler *observer, uint32 what)
 Unsubscribe an observer from watching a specific state. More...
 
status_t StopWatchingAll (BHandler *observer)
 Unsubscribe an observer from watching all states. More...
 
virtual void SendNotices (uint32 what, const BMessage *notice=NULL)
 Emit a state change to the observers. More...
 
bool IsWatched () const
 Check if there are any observers watching this handler. More...
 
- Public Member Functions inherited from BArchivable
 BArchivable (BMessage *from)
 Constructor. Does important behind-the-scenes work in the unarchiving process. More...
 
 BArchivable ()
 Constructor. Does nothing. More...
 
virtual ~BArchivable ()
 Destructor. Does nothing. More...
 
virtual status_t AllArchived (BMessage *archive) const
 Method relating to the use of BArchiver. More...
 
virtual status_t AllUnarchived (const BMessage *archive)
 Method relating to the use of BUnarchiver. More...
 

Static Public Member Functions

static BPoint AlertPosition (float width, float height)
 Resizes the Alert window to the width and height specified and return the Point of the top-left corner of the alert window. More...
 
- Static Public Member Functions inherited from BWindow
static BArchivableInstantiate (BMessage *archive)
 Creates a new BWindow object from the data message. More...
 
- Static Public Member Functions inherited from BLooper
static BArchivableInstantiate (BMessage *data)
 Static method to instantiate a looper from an archived message. More...
 
static BLooperLooperForThread (thread_id thread)
 Static method to retrieve a BLooper for a specified thread. More...
 
- Static Public Member Functions inherited from BHandler
static BArchivableInstantiate (BMessage *data)
 Static method to instantiate a handler from an archived message. More...
 
- Static Public Member Functions inherited from BArchivable
static BArchivableInstantiate (BMessage *archive)
 Static member to restore objects from messages. More...
 

Archiving

virtual status_t Archive (BMessage *data, bool deep=true) const
 Archives the BAlert into archive. More...
 
static BArchivableInstantiate (BMessage *data)
 Instantiates a BAlert from a BMessage. More...
 

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. More...
 

Detailed Description

The BAlert class defines a modal alert dialog which displays a short message and provides a set of labeled buttons that allow the user to respond.

The alert can be configured with a set of one to three buttons. These buttons are assigned indexes 0, 1, and 2 from right-to-left respectively and are automatically positioned by the system. The user can either click on one of the buttons or use a shortcut key to select a button.

The layout of the buttons can be configured by setting the button_width and button_spacing properties in the BAlert constructor. The icon displayed in the alert can also be configured by setting the alert_type property. The right-most button (index 0) is the default button which can be activated by pushing the Enter key.

Below is an example of an unsaved changes alert dialog:

BAlert_example.png

When the user responds by selecting one of the buttons the alert window is removed from the screen. The index of the selected button is returned to the calling application and the BAlert object is deleted.

The code used to create and display an alert dialog like the one shown above is shown below:

BAlert* alert = new BAlert("Close and save dialog", "Save changes to...",
"Cancel", "Don't save", "Save", B_WIDTH_AS_USUAL, B_OFFSET_SPACING,
alert->SetShortcut(0, B_ESCAPE);
int32 button_index = alert->Go();

The messaged displayed in the dialog window along with the button labels are set by the strings in the contructor. The Cancel button is offset to the left relative to the other buttons by setting the B_OFFSET_SPACING flag. The B_WARNING_ALERT flag displays the exclamation mark icon in the dialog.

Any alert with a Cancel button should map the Escape key as shown in the example above. You can setup additional shortcut keys for the buttons with the SetShortcut() method.

The Go() method does the work of loading up and removing the alert window and returns the index of the button that the user selected.

Since
BeOS R3

Constructor & Destructor Documentation

◆ BAlert() [1/3]

BAlert::BAlert ( const char *  title,
const char *  text,
const char *  button1,
const char *  button2 = NULL,
const char *  button3 = NULL,
button_width  width = B_WIDTH_AS_USUAL,
alert_type  type = B_INFO_ALERT 
)

Creates and initializes a BAlert dialog.

Parameters
titleThe title of the window. Since the alert window doesn't have a title tab, the title is not actually displayed anywhere but is useful for debugging purposes.
textThe text that is displayed at the top of the window.
button1Button 1 label
button2Button 2 label
button3Button 3 label
widthA constant that describes how the button should be sized. Options are
  • B_WIDTH_AS_USUAL
  • B_WIDTH_FROM_WIDEST
  • B_WIDTH_FROM_LABEL
See button_width for details.
typeConstant that determines which alert icon is displayed. Options are
  • B_EMPTY_ALERT
  • B_INFO_ALERT
  • B_IDEA_ALERT
  • B_WARNING_ALERT
  • B_STOP_ALERT
See alert_type for details.
Since
BeOS R3

◆ BAlert() [2/3]

BAlert::BAlert ( const char *  title,
const char *  text,
const char *  button1,
const char *  button2,
const char *  button3,
button_width  width,
button_spacing  spacing,
alert_type  type = B_INFO_ALERT 
)

Creates and initializes a BAlert dialog.

You can also set the spacing with this constructor.

Parameters
titleThe title of the window. Since the alert window doesn't have a title tab, the title is not actually displayed anywhere but is useful for debugging purposes.
textThe text that is displayed at the top of the window.
button1Button 1 label
button2Button 2 label
button3Button 3 label
widthA constant that describes how the button should be sized. Options are
  • B_WIDTH_AS_USUAL
  • B_WIDTH_FROM_WIDEST
  • B_WIDTH_FROM_LABEL
See button_width for details.
spacingDetermines how the buttons are spaced. Options are
  • B_EVEN_SPACING
  • B_OFFSET_SPACING
See button_spacing for details.
typeConstant that determines which alert icon is displayed. Options are
  • B_EMPTY_ALERT
  • B_INFO_ALERT
  • B_IDEA_ALERT
  • B_WARNING_ALERT
  • B_STOP_ALERT
See alert_type for details.
Since
BeOS R4

◆ BAlert() [3/3]

BAlert::BAlert ( BMessage data)

Unarchives an alert from a BMessage.

Parameters
dataThe archive.
Since
BeOS R3

◆ ~BAlert()

BAlert::~BAlert ( )
virtual

Destructor method.

Standard Destructor method to delete a BAlert.

Since
BeOS R3

Member Function Documentation

◆ AlertPosition()

BPoint BAlert::AlertPosition ( float  width,
float  height 
)
static

Resizes the Alert window to the width and height specified and return the Point of the top-left corner of the alert window.

Parameters
widthThe desired width of the alert window.
heightThe desired height of the alert window.
Returns
The BPoint of the top-left corner of the Alert window.
Since
BeOS R3

◆ Archive()

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

Archives the BAlert into archive.

Parameters
dataThe target archive which the BAlert data will go into.
deepWhether or not to recursively archive the BAlert's children.
Returns
A status code.
Return values
B_OKThe archive operation was successful.
B_BAD_VALUEThe archive operation failed.
Since
BeOS R3

Reimplemented from BWindow.

◆ ButtonAt()

BButton * BAlert::ButtonAt ( int32  index) const

Returns a pointer to the BButton at the specified index.

The index of the buttons begins at 0 and counts from left to right. If a BButton does not exist for the specified index then NULL is returned.

Parameters
indexThe index of the desired button.
Returns
A pointer to the BButton at the specified index.
Since
BeOS R3

◆ DispatchMessage()

void BAlert::DispatchMessage ( BMessage msg,
BHandler handler 
)
virtual

Sends out a message.

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 BWindow.

◆ FrameResized()

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

Resizes the alert dialog.

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

Reimplemented from BWindow.

◆ GetSupportedSuites()

status_t BAlert::GetSupportedSuites ( BMessage data)
virtual

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

Since
BeOS R3

Reimplemented from BWindow.

◆ Go() [1/2]

int32 BAlert::Go ( )

Displays the alert window.

This version of Go() that does not include an invoker is synchronous. Go() returns once the user has clicked a button and the panel has been removed from the screen. The BAlert object is deleted before the method returns.

If the BAlert is sent a B_QUIT_REQUESTED message while the alert window is still on screen then Go() returns -1.

Returns
The index of the button clicked.
Since
BeOS R3

◆ Go() [2/2]

status_t BAlert::Go ( BInvoker invoker)

Displays the alert window from a specified invoker.

This version of Go() with an invoker is asynchronous. It returns immediately with B_OK and the button index is set to the field of the BMessage that is sent to the target of the invoker.

Go() deletes the BAlert object after the message is sent.

If you call Go() with a NULL invoker argument than the BMessage is not sent.

If the BAlert is sent a B_QUIT_REQUESTED method while the alert window is still on screen then the message is not sent.

Returns
A status code.
Since
BeOS R3

◆ Instantiate()

BArchivable * BAlert::Instantiate ( BMessage data)
static

Instantiates a BAlert from a BMessage.

Parameters
dataThe message to instantiate the BAlert.
Returns
a BArchivable object of the BAlert.
Since
BeOS R3

◆ MessageReceived()

void BAlert::MessageReceived ( BMessage message)
virtual

Initiates an action from a received message.

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

Reimplemented from BWindow.

◆ Perform()

status_t BAlert::Perform ( perform_code  code,
void *  _data 
)
virtual

Perform some action. (Internal Method)

Parameters
codeThe perform code.
_dataA pointer to store some data.
Returns
A status code.
See also
BLooper::Perform()
Since
Haiku R1

Reimplemented from BWindow.

◆ Quit()

void BAlert::Quit ( )
virtual

Quits the window closing it.

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 BWindow.

◆ QuitRequested()

bool BAlert::QuitRequested ( )
virtual

Hook method that gets called with the window is closed.

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

Reimplemented from BWindow.

◆ ResolveSpecifier()

BHandler * BAlert::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 BWindow.

◆ SetShortcut()

void BAlert::SetShortcut ( int32  index,
char  key 
)

Sets the shortcut character which is mapped to a button at the specified index.

A button can only have one shortcut except for the rightmost button which, in addition to the shortcut you set, is always mapped to B_ENTER.

If you create a "Cancel" button then you should set its shortcut to B_ESCAPE.

Parameters
indexThe index of the button to set the shortcut to.
keyThe shortcut character to set.
Since
BeOS R3

◆ Shortcut()

char BAlert::Shortcut ( int32  index) const

Gets the shortcut character which is mapped to a button at the specified index.

Parameters
indexThe index of the button to get the shortcut of.
Returns
The shortcut character mapped to the button at the specified index.
Since
BeOS R3

◆ TextView()

BTextView * BAlert::TextView ( ) const

Returns the Alert's TextView.

Since
BeOS R3