2011-08-10 01:46:13 +04:00
|
|
|
/*
|
2014-06-04 19:57:42 +04:00
|
|
|
* Copyright 2011 Haiku, Inc. All rights reserved.
|
2011-11-02 12:36:02 +04:00
|
|
|
* Distributed under the terms of the MIT License.
|
2011-08-10 01:46:13 +04:00
|
|
|
*
|
2013-02-07 06:05:00 +04:00
|
|
|
* Authors:
|
|
|
|
* John Scipione, jscipione@gmail.com
|
|
|
|
*
|
2011-08-10 01:46:13 +04:00
|
|
|
* Corresponds to:
|
2013-02-08 06:19:06 +04:00
|
|
|
* headers/os/interface/Alert.h rev 42274
|
|
|
|
* src/kits/interface/Alert.cpp rev 42274
|
2011-08-10 01:46:13 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\file Alert.h
|
2013-02-07 06:05:00 +04:00
|
|
|
\ingroup interface
|
|
|
|
\ingroup libbe
|
2011-08-10 01:46:13 +04:00
|
|
|
\brief BAlert class definition and support enums.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\enum alert_type
|
2013-02-07 06:05:00 +04:00
|
|
|
\ingroup interface
|
2019-09-09 23:12:13 +03:00
|
|
|
\brief Type of alert.
|
2013-02-07 06:05:00 +04:00
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
Determines which icon (if any) is displayed in the alert dialog.
|
|
|
|
Choose one option. If the constructor doesn't include an
|
|
|
|
alert_type argument than \c B_EMPTY_ALERT is used.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-08-10 01:46:13 +04:00
|
|
|
*/
|
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
/*!
|
|
|
|
\var alert_type B_EMPTY_ALERT
|
2013-02-07 06:05:00 +04:00
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
No icon
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-08-10 01:46:13 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\var alert_type B_INFO_ALERT
|
2013-02-07 06:05:00 +04:00
|
|
|
|
2017-02-01 19:22:01 +03:00
|
|
|
\image html https://www.haiku-os.org/images/alert_info_32.png
|
2013-02-07 06:05:00 +04:00
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
Info icon
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-08-10 01:46:13 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\var alert_type B_IDEA_ALERT
|
2013-02-07 06:05:00 +04:00
|
|
|
|
2017-02-01 19:22:01 +03:00
|
|
|
\image html https://www.haiku-os.org/images/alert_idea_32.png
|
2013-02-07 06:05:00 +04:00
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
Idea icon
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-08-10 01:46:13 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\var alert_type B_WARNING_ALERT
|
2013-02-07 06:05:00 +04:00
|
|
|
|
2017-02-01 19:22:01 +03:00
|
|
|
\image html https://www.haiku-os.org/images/alert_warning_32.png
|
2013-02-07 06:05:00 +04:00
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
Warning icon
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-08-10 01:46:13 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\var alert_type B_STOP_ALERT
|
2013-02-07 06:05:00 +04:00
|
|
|
|
2017-02-01 19:22:01 +03:00
|
|
|
\image html https://www.haiku-os.org/images/alert_stop_32.png
|
2013-02-07 06:05:00 +04:00
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
Stop icon
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-08-10 01:46:13 +04:00
|
|
|
*/
|
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
/*!
|
|
|
|
\enum button_spacing
|
2013-02-07 06:05:00 +04:00
|
|
|
\ingroup interface
|
2019-09-09 23:12:13 +03:00
|
|
|
\brief Method of spacing of buttons in alerts.
|
2013-02-07 06:05:00 +04:00
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
Determines how the buttons on the alert dialog are spaced relative
|
|
|
|
to each other. Choose one option. If the constructor doesn't include a
|
|
|
|
button_spacing argument than \c B_EVEN_SPACING is used.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-08-10 01:46:13 +04:00
|
|
|
*/
|
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
/*!
|
|
|
|
\var button_spacing B_EVEN_SPACING
|
2013-02-07 06:05:00 +04:00
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
If the alert dialog has more than one button than the buttons are
|
|
|
|
spaced evenly across the bottom of the alert dialog.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-08-10 01:46:13 +04:00
|
|
|
*/
|
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
/*!
|
|
|
|
\var button_spacing B_OFFSET_SPACING
|
2013-02-07 06:05:00 +04:00
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
If the alert dialog has more than one button than the leftmost button
|
|
|
|
is offset to the left-hand side of the dialog while the rest of the
|
|
|
|
buttons are grouped on the right. This is useful to separate off a
|
|
|
|
leftmost "Cancel" or "Delete" button.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-08-10 01:46:13 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\class BAlert
|
|
|
|
\ingroup interface
|
2011-11-02 12:36:02 +04:00
|
|
|
\ingroup libbe
|
2011-08-10 01:46:13 +04:00
|
|
|
\brief The BAlert class defines a modal alert dialog which displays a short
|
2014-06-14 01:25:02 +04:00
|
|
|
message and provides a set of labeled buttons that allow the user to
|
|
|
|
respond.
|
2011-08-10 01:46:13 +04:00
|
|
|
|
|
|
|
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 \key{Enter} key.
|
|
|
|
|
|
|
|
Below is an example of an unsaved changes alert dialog:
|
|
|
|
|
|
|
|
\image html 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:
|
|
|
|
|
2013-02-07 06:05:00 +04:00
|
|
|
\code
|
2011-08-10 01:46:13 +04:00
|
|
|
BAlert* alert = new BAlert("Close and save dialog", "Save changes to...",
|
2013-02-07 06:05:00 +04:00
|
|
|
"Cancel", "Don't save", "Save", B_WIDTH_AS_USUAL, B_OFFSET_SPACING,
|
|
|
|
B_WARNING_ALERT);
|
2011-08-10 01:46:13 +04:00
|
|
|
alert->SetShortcut(0, B_ESCAPE);
|
|
|
|
int32 button_index = alert->Go();
|
2013-02-07 06:05:00 +04:00
|
|
|
\endcode
|
2011-08-10 01:46:13 +04:00
|
|
|
|
|
|
|
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 \c B_OFFSET_SPACING
|
|
|
|
flag. The \c B_WARNING_ALERT flag displays the exclamation mark icon in
|
|
|
|
the dialog.
|
|
|
|
|
|
|
|
Any alert with a Cancel button should map the \key{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.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-08-10 01:46:13 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
2019-09-09 23:12:13 +03:00
|
|
|
/*!
|
|
|
|
\fn BAlert::BAlert()
|
|
|
|
\brief Create an unconfigured BAlert dialog.
|
|
|
|
|
|
|
|
This method creates an unconfigured BAlert. You can configure it with
|
|
|
|
methods like SetText(), SetType() and SetButtonSpacing.
|
|
|
|
|
|
|
|
It is advised to use one of the other constructors that help set up all
|
|
|
|
the configuration in one go, instead of doing it piece by piece with this
|
|
|
|
method.
|
|
|
|
|
|
|
|
\since BeOS R3
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
/*!
|
2014-06-14 01:25:02 +04:00
|
|
|
\fn BAlert::BAlert(const char* title, const char* text,
|
|
|
|
const char* button1, const char* button2, const char* button3,
|
2011-08-10 01:46:13 +04:00
|
|
|
button_width width, alert_type type)
|
|
|
|
\brief Creates and initializes a BAlert dialog.
|
|
|
|
|
|
|
|
\param title The 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.
|
|
|
|
\param text The text that is displayed at the top of the window.
|
|
|
|
\param button1 Button 1 label
|
|
|
|
\param button2 Button 2 label
|
|
|
|
\param button3 Button 3 label
|
|
|
|
\param width A constant that describes how the button should be sized.
|
|
|
|
Options are
|
|
|
|
\li \c B_WIDTH_AS_USUAL
|
|
|
|
\li \c B_WIDTH_FROM_WIDEST
|
|
|
|
\li \c B_WIDTH_FROM_LABEL
|
|
|
|
|
|
|
|
See button_width for details.
|
|
|
|
\param type Constant that determines which alert icon is displayed.
|
|
|
|
Options are
|
|
|
|
\li \c B_EMPTY_ALERT
|
|
|
|
\li \c B_INFO_ALERT
|
|
|
|
\li \c B_IDEA_ALERT
|
|
|
|
\li \c B_WARNING_ALERT
|
|
|
|
\li \c B_STOP_ALERT
|
|
|
|
|
|
|
|
See alert_type for details.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-08-10 01:46:13 +04:00
|
|
|
*/
|
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
/*!
|
2014-06-14 01:25:02 +04:00
|
|
|
\fn BAlert::BAlert(const char* title, const char* text, const char* button1,
|
|
|
|
const char* button2, const char* button3, button_width width,
|
2011-08-10 01:46:13 +04:00
|
|
|
button_spacing spacing, alert_type type)
|
|
|
|
\brief Creates and initializes a BAlert dialog.
|
|
|
|
|
|
|
|
You can also set the \a spacing with this constructor.
|
|
|
|
|
|
|
|
\param title The 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.
|
|
|
|
\param text The text that is displayed at the top of the window.
|
|
|
|
\param button1 Button 1 label
|
|
|
|
\param button2 Button 2 label
|
|
|
|
\param button3 Button 3 label
|
|
|
|
\param width A constant that describes how the button should be sized.
|
|
|
|
Options are
|
|
|
|
\li \c B_WIDTH_AS_USUAL
|
|
|
|
\li \c B_WIDTH_FROM_WIDEST
|
|
|
|
\li \c B_WIDTH_FROM_LABEL
|
|
|
|
|
|
|
|
See button_width for details.
|
|
|
|
\param spacing Determines how the buttons are spaced. Options are
|
|
|
|
\li \c B_EVEN_SPACING
|
2015-08-25 17:25:10 +03:00
|
|
|
\li \c B_OFFSET_SPACING
|
2011-08-10 01:46:13 +04:00
|
|
|
|
|
|
|
See button_spacing for details.
|
|
|
|
\param type Constant that determines which alert icon is displayed.
|
|
|
|
Options are
|
|
|
|
\li \c B_EMPTY_ALERT
|
|
|
|
\li \c B_INFO_ALERT
|
|
|
|
\li \c B_IDEA_ALERT
|
|
|
|
\li \c B_WARNING_ALERT
|
|
|
|
\li \c B_STOP_ALERT
|
|
|
|
|
|
|
|
See alert_type for details.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R4
|
2011-08-10 01:46:13 +04:00
|
|
|
*/
|
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
/*!
|
|
|
|
\fn BAlert::BAlert(BMessage* data)
|
|
|
|
\brief Unarchives an alert from a BMessage.
|
|
|
|
|
|
|
|
\param data The archive.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-08-10 01:46:13 +04:00
|
|
|
*/
|
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
/*!
|
|
|
|
\fn BAlert::~BAlert()
|
|
|
|
\brief Destructor method.
|
|
|
|
|
|
|
|
Standard Destructor method to delete a BAlert.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\name Archiving
|
2011-08-10 01:46:13 +04:00
|
|
|
*/
|
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
//! @{
|
|
|
|
|
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
/*!
|
|
|
|
\fn BArchivable* BAlert::Instantiate(BMessage* data)
|
|
|
|
\brief Instantiates a BAlert from a BMessage.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
\param data The message to instantiate the BAlert.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
\returns a BArchivable object of the BAlert.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-08-10 01:46:13 +04:00
|
|
|
*/
|
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
/*!
|
|
|
|
\fn status_t BAlert::Archive(BMessage* data, bool deep) const
|
|
|
|
\brief Archives the BAlert into \a archive.
|
|
|
|
|
|
|
|
\param data The target archive which the BAlert \a data will go into.
|
|
|
|
\param deep Whether or not to recursively archive the BAlert's children.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\return A status code.
|
2011-08-10 01:46:13 +04:00
|
|
|
\retval B_OK The archive operation was successful.
|
|
|
|
\retval B_BAD_VALUE The archive operation failed.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-08-10 01:46:13 +04:00
|
|
|
*/
|
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
//! @}
|
|
|
|
|
|
|
|
|
2019-09-09 23:12:13 +03:00
|
|
|
/*!
|
|
|
|
\fn alert_type BAlert::Type() const
|
|
|
|
\brief Get the alert_type of this alert.
|
|
|
|
|
|
|
|
\return Returns one of the values from the alert_type enum.
|
|
|
|
|
|
|
|
\since BeOS R3
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void BAlert::SetType(alert_type type)
|
|
|
|
\brief Set the type of the alert.
|
|
|
|
|
|
|
|
\param type Pass one of the alert_type enum values to set the type.
|
|
|
|
|
|
|
|
\since BeOS R3
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void BAlert::SetIcon(BBitmap *bitmap)
|
|
|
|
\brief Set a custom icon for the alert.
|
|
|
|
|
2022-08-27 04:25:23 +03:00
|
|
|
\param bitmap A valid BBitmap. The BAlert assumes ownership of the bitmap.
|
2019-09-09 23:12:13 +03:00
|
|
|
|
2022-08-27 04:25:23 +03:00
|
|
|
\since Haiku R1
|
2019-09-09 23:12:13 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void BAlert::SetText(const char *text)
|
|
|
|
\brief Set the text for the alert.
|
|
|
|
|
|
|
|
\param text The text you want the alert to display.
|
|
|
|
|
|
|
|
\since BeOS R3
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void BAlert::SetButtonSpacing(button_spacing spacing)
|
|
|
|
\brief Set the button spacing for the alert.
|
|
|
|
|
|
|
|
\param spacing Pass one of the button_spacing values to configure the
|
|
|
|
spacing.
|
|
|
|
|
|
|
|
\since BeOS R3
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn void BAlert::SetButtonWidth(button_width width)
|
|
|
|
\brief Set the button width for the buttons of the alert.
|
|
|
|
|
|
|
|
\param width Pass one of the button_width values to configure the width.
|
|
|
|
|
|
|
|
\since BeOS R3
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
/*!
|
|
|
|
\fn void BAlert::SetShortcut(int32 index, char key)
|
|
|
|
\brief Sets the shortcut character which is mapped to a button at the
|
2014-06-14 01:25:02 +04:00
|
|
|
specified \a index.
|
2011-08-10 01:46:13 +04:00
|
|
|
|
|
|
|
A button can only have one shortcut except for the rightmost button which,
|
|
|
|
in addition to the shortcut you set, is always mapped to \c B_ENTER.
|
|
|
|
|
|
|
|
If you create a "Cancel" button then you should set its shortcut to
|
|
|
|
\c B_ESCAPE.
|
|
|
|
|
|
|
|
\param index The \a index of the button to set the shortcut to.
|
|
|
|
\param key The shortcut character to set.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-08-10 01:46:13 +04:00
|
|
|
*/
|
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
/*!
|
|
|
|
\fn char BAlert::Shortcut(int32 index) const
|
2014-06-14 01:25:02 +04:00
|
|
|
\brief Gets the shortcut character which is mapped to a button at the
|
|
|
|
specified \a index.
|
2011-08-10 01:46:13 +04:00
|
|
|
|
|
|
|
\param index The \a index of the button to get the shortcut of.
|
|
|
|
|
|
|
|
\return The shortcut character mapped to the button at the specified
|
|
|
|
\a index.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-08-10 01:46:13 +04:00
|
|
|
*/
|
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
/*!
|
|
|
|
\fn int32 BAlert::Go()
|
|
|
|
\brief 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 \c B_QUIT_REQUESTED message while the alert
|
|
|
|
window is still on screen then Go() returns -1.
|
|
|
|
|
|
|
|
\returns The index of the button clicked.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-08-10 01:46:13 +04:00
|
|
|
*/
|
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
/*!
|
|
|
|
\fn status_t BAlert::Go(BInvoker* invoker)
|
|
|
|
\brief Displays the alert window from a specified \a invoker.
|
|
|
|
|
|
|
|
This version of Go() with an \a invoker is asynchronous. It returns
|
|
|
|
immediately with \c B_OK and the button \a index is set to the field
|
|
|
|
of the BMessage that is sent to the target of the \a invoker.
|
|
|
|
|
|
|
|
Go() deletes the BAlert object after the message is sent.
|
|
|
|
|
|
|
|
If you call Go() with a \c NULL invoker argument than the BMessage
|
|
|
|
is not sent.
|
|
|
|
|
|
|
|
If the BAlert is sent a \c B_QUIT_REQUESTED method while the alert
|
|
|
|
window is still on screen then the message is not sent.
|
|
|
|
|
|
|
|
\returns A status code.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-08-10 01:46:13 +04:00
|
|
|
*/
|
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
/*!
|
2014-06-14 01:25:02 +04:00
|
|
|
\fn void BAlert::MessageReceived(BMessage* message)
|
2011-08-10 01:46:13 +04:00
|
|
|
\brief Initiates an action from a received message.
|
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
\copydetails BWindow::MessageReceived()
|
2011-08-10 01:46:13 +04:00
|
|
|
*/
|
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
/*!
|
|
|
|
\fn void BAlert::FrameResized(float newWidth, float newHeight)
|
|
|
|
\brief Resizes the alert dialog.
|
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
\copydetails BWindow::FrameResized()
|
2011-08-10 01:46:13 +04:00
|
|
|
*/
|
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
|
2019-09-09 23:12:13 +03:00
|
|
|
/*!
|
|
|
|
\fn void BAlert::AddButton(const char *label, char key=0)
|
|
|
|
\brief Adds a button to the alert.
|
|
|
|
|
|
|
|
\param label The label of the button.
|
|
|
|
\param key The key a user can press to quickly select this button.
|
|
|
|
|
|
|
|
\since BeOS R3
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn int32 BAlert::CountButtons() const
|
|
|
|
\brief Counts the number of buttons in the alert.
|
|
|
|
|
|
|
|
\return The number of buttons in this alert window.
|
|
|
|
|
|
|
|
\see AddButton() and ButtonAt()
|
|
|
|
|
|
|
|
\since BeOS R3
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
/*!
|
|
|
|
\fn BButton* BAlert::ButtonAt(int32 index) const
|
|
|
|
\brief Returns a pointer to the BButton at the specified \a index.
|
|
|
|
|
|
|
|
The \a index of the buttons begins at \c 0 and counts from left to right.
|
|
|
|
If a BButton does not exist for the specified \a index then \c NULL is
|
|
|
|
returned.
|
|
|
|
|
|
|
|
\param index The \a index of the desired button.
|
|
|
|
|
|
|
|
\return A pointer to the BButton at the specified \a index.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-08-10 01:46:13 +04:00
|
|
|
*/
|
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
/*!
|
|
|
|
\fn BTextView* BAlert::TextView() const
|
2015-08-25 17:25:10 +03:00
|
|
|
\brief Returns the Alert's TextView.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-08-10 01:46:13 +04:00
|
|
|
*/
|
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
/*!
|
2014-06-14 01:25:02 +04:00
|
|
|
\fn BHandler* BAlert::ResolveSpecifier(BMessage* message, int32 index,
|
|
|
|
BMessage* specifier, int32 what, const char* property)
|
|
|
|
\copydoc BHandler::ResolveSpecifier()
|
2011-08-10 01:46:13 +04:00
|
|
|
*/
|
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
/*!
|
|
|
|
\fn status_t BAlert::GetSupportedSuites(BMessage* data)
|
2014-06-14 01:25:02 +04:00
|
|
|
\copydoc BWindow::GetSupportedSuites()
|
2011-08-10 01:46:13 +04:00
|
|
|
*/
|
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
/*!
|
|
|
|
\fn void BAlert::DispatchMessage(BMessage* msg, BHandler* handler)
|
|
|
|
\brief Sends out a message.
|
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
\copydetails BWindow::DispatchMessage()
|
2011-08-10 01:46:13 +04:00
|
|
|
*/
|
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
/*!
|
|
|
|
\fn void BAlert::Quit()
|
|
|
|
\brief Quits the window closing it.
|
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
\copydetails BWindow::Quit()
|
2011-08-10 01:46:13 +04:00
|
|
|
*/
|
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
/*!
|
|
|
|
\fn bool BAlert::QuitRequested()
|
|
|
|
\brief Hook method that gets called with the window is closed.
|
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
\copydetails BWindow::QuitRequested()
|
2011-08-10 01:46:13 +04:00
|
|
|
*/
|
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
/*!
|
|
|
|
\fn BPoint BAlert::AlertPosition(float width, float height)
|
|
|
|
\brief Resizes the Alert window to the width and height specified and
|
2014-06-14 01:25:02 +04:00
|
|
|
return the Point of the top-left corner of the alert window.
|
2011-08-10 01:46:13 +04:00
|
|
|
|
|
|
|
\param width The desired \a width of the alert window.
|
|
|
|
\param height The desired \a height of the alert window.
|
|
|
|
|
|
|
|
\returns The BPoint of the top-left corner of the Alert window.
|
2014-06-14 01:25:02 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-08-10 01:46:13 +04:00
|
|
|
*/
|
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
|
2011-08-10 01:46:13 +04:00
|
|
|
/*!
|
|
|
|
\fn status_t BAlert::Perform(perform_code code, void* _data)
|
2014-06-14 01:25:02 +04:00
|
|
|
\brief Perform some action. (Internal Method)
|
2011-08-10 01:46:13 +04:00
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
\param code The perform code.
|
|
|
|
\param _data A pointer to store some data.
|
2011-08-10 01:46:13 +04:00
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
\returns A status code.
|
2011-08-10 01:46:13 +04:00
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
\sa BLooper::Perform()
|
2011-08-10 01:46:13 +04:00
|
|
|
|
2014-06-14 01:25:02 +04:00
|
|
|
\since Haiku R1
|
2011-08-10 01:46:13 +04:00
|
|
|
*/
|