HaikuBook: Initial documentation for BNotification
The implementation file contained some documentation. This has been moved to the Haiku Book (and is rewritten in most cases). The documentation gives some insight on how the notification_server works. Change-Id: I82bafcf57101d4882bdf07e7f731df9cd8adc861 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2299 Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
This commit is contained in:
parent
0da74916e2
commit
02e45e32ae
@ -955,6 +955,7 @@ EXAMPLE_RECURSIVE = NO
|
||||
# \image command).
|
||||
|
||||
IMAGE_PATH = . \
|
||||
app/images \
|
||||
interface/images \
|
||||
keyboard \
|
||||
midi2/images \
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2019 Haiku, Inc. All rights reserved.
|
||||
* Copyright 2019-2020 Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
/*!
|
||||
\enum notification_type
|
||||
\brief Undocumented
|
||||
\brief Visual style of the notification.
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
@ -32,7 +32,11 @@
|
||||
|
||||
/*!
|
||||
\var notification_type::B_INFORMATION_NOTIFICATION
|
||||
\brief Undocumented
|
||||
\brief Information type
|
||||
|
||||
This will have the notification appear with a grey side bar.
|
||||
|
||||
\image html notification_information_type.png
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
@ -40,7 +44,11 @@
|
||||
|
||||
/*!
|
||||
\var notification_type::B_IMPORTANT_NOTIFICATION
|
||||
\brief Undocumented
|
||||
\brief Important type
|
||||
|
||||
This will have the notification appear with a blue side bar.
|
||||
|
||||
\image html notification_important_type.png
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
@ -48,7 +56,11 @@
|
||||
|
||||
/*!
|
||||
\var notification_type::B_ERROR_NOTIFICATION
|
||||
\brief Undocumented
|
||||
\brief Error type
|
||||
|
||||
This will have the notification appear with a red side bar.
|
||||
|
||||
\image html notification_error_type.png
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
@ -56,7 +68,11 @@
|
||||
|
||||
/*!
|
||||
\var notification_type::B_PROGRESS_NOTIFICATION
|
||||
\brief Undocumented
|
||||
\brief Progress type
|
||||
|
||||
This will have the notification appear with a progress bar.
|
||||
|
||||
\image html notification_progress_type.png
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
@ -67,7 +83,80 @@
|
||||
|
||||
/*!
|
||||
\class BNotification
|
||||
\brief Undocumented
|
||||
\brief Construct system-default notifications to be displayed to the user.
|
||||
|
||||
Haiku provides a notification system that allows you to display messages to
|
||||
the user. There is quite some flexibility in how the message is presented.
|
||||
You may use this class to build and send the notification. The properties
|
||||
you can set are:
|
||||
- The \link BNotification::BNotification() type of notification\endlink,
|
||||
which can be an information message, a warning, an error, or a progress
|
||||
message.
|
||||
- The \link BNotification::SetGroup() group\endlink, which allows you to
|
||||
organize notification display into different categories.
|
||||
- A \link BNotification::SetTitle() title\endlink, which is a distinct
|
||||
text element at the top of a notification view.
|
||||
- The \link BNotification::SetContent() content\endlink, which is the text
|
||||
message that is shown to the user.
|
||||
- A \link BNotification::SetMessageID() message identifier\endlink that
|
||||
allows you to modify the contents of a message that is being displayed,
|
||||
which is particularly useful for progress notifications.
|
||||
- For progress notifications, the
|
||||
\link BNotification::SetProgress() percentage of completion\endlink can be
|
||||
set.
|
||||
- By default the notification uses the application's icon, but you may
|
||||
set an \link BNotification::SetIcon() alternative icon\endlink.
|
||||
- Finally there are a few ways you can configure the actions that happen
|
||||
when a user clicks the notification. More on that below.
|
||||
|
||||
For example, with the following code, you may display a notification:
|
||||
|
||||
\code{.cpp}
|
||||
BNotification notification(B_PROGRESS_NOTIFICATION);
|
||||
notification.SetGroup("Group");
|
||||
notification.SetTitle("Title");
|
||||
notification.SetContent("This is the content");
|
||||
notification.SetMessageID("mainwindow_progress")
|
||||
notification.SetProgress(0.5);
|
||||
notification.Send();
|
||||
\endcode
|
||||
|
||||
\p
|
||||
|
||||
\image html notification_intro.png
|
||||
|
||||
Note that in the previous code example, we set a
|
||||
\link BNotification::SetMessageID message identifier\endlink, which will
|
||||
allow to update the notification when we have progressed. The use would be:
|
||||
|
||||
\code{.cpp}
|
||||
// After sending the notification, you retain ownership so that you can update it
|
||||
notification.SetProgress(0.7);
|
||||
|
||||
// In order to display the update, you send it again
|
||||
notification.Send();
|
||||
\endcode
|
||||
|
||||
Furthermore, it is possible to support some form of follow-up action, when
|
||||
the user clicks the notification. First of all, you need to choose whether
|
||||
you want to \link BNotification::SetOnClickApp() open a specific
|
||||
application\endlink, or whether you want to
|
||||
\link BNotification::SetOnClickFile() open a specific file\endlink and have
|
||||
the system determine which application fits that. Additionally, you may
|
||||
specify \link BNotification::AddOnClickArg() command line arguments\endlink
|
||||
or pass additional \link BNotification::AddOnClickRef() file
|
||||
references\endlink for the receiving application to process.
|
||||
|
||||
Finally, a note about the \c notification_server and how it groups and
|
||||
handles messages coming from your application. The system is aware of the
|
||||
source of the notifications, and identifies your application by it's
|
||||
signature. That means that the identification of your application is
|
||||
consistent, even if it is restarted, or if you have multiple instances
|
||||
running. This impacts the \link BNotification::SetGroup() grouping\endlink
|
||||
functionality and the \link BNotification::SetMessageID() message
|
||||
updating\endlink functionality. If you have an application that can have
|
||||
multiple instances, you will need to make sure that you properly manage
|
||||
your group names and identifiers if you want to keep things separate.
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
@ -75,7 +164,10 @@
|
||||
|
||||
/*!
|
||||
\fn BNotification::BNotification(notification_type type)
|
||||
\brief Undocumented
|
||||
\brief Construct an empty message, with the specified \a type.
|
||||
|
||||
The type influences the style of the notification view. See the
|
||||
\ref notification_type enumerator for details.
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
@ -83,7 +175,7 @@
|
||||
|
||||
/*!
|
||||
\fn BNotification::BNotification(BMessage* archive)
|
||||
\brief Undocumented
|
||||
\brief Construct a notification from an archive.
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
@ -91,7 +183,7 @@
|
||||
|
||||
/*!
|
||||
\fn virtual BNotification::~BNotification()
|
||||
\brief Undocumented
|
||||
\brief Frees all resources associated with the object.
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
@ -99,7 +191,7 @@
|
||||
|
||||
/*!
|
||||
\fn status_t BNotification::InitCheck() const
|
||||
\brief Undocumented
|
||||
\brief Returns the status of the constructor.
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
@ -107,7 +199,15 @@
|
||||
|
||||
/*!
|
||||
\fn static BArchivable* BNotification::Instantiate(BMessage* archive)
|
||||
\brief Undocumented
|
||||
\brief Returns a new BNotification object from \a archive.
|
||||
|
||||
This class implements the archiving API, and as such, you can
|
||||
build a new BNotification object from a previously created
|
||||
BMessage archive. However, if the message doesn't contain an archived data
|
||||
for a BNotification object, this method returns \c NULL.
|
||||
|
||||
\returns BNotification object from \a archive or \c NULL if it doesn't
|
||||
contain a valid BNotification object.
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
@ -116,7 +216,11 @@
|
||||
/*!
|
||||
\fn virtual status_t BNotification::Archive(BMessage* archive,
|
||||
bool deep = true) const
|
||||
\brief Undocumented
|
||||
\brief Archives the BNotification in the \c archive.
|
||||
|
||||
\see BArchivable::Archive(), Instantiate() static function.
|
||||
\returns \c B_OK: if everything went fine, or other errors that describe why
|
||||
archiving has failed.
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
@ -124,7 +228,14 @@
|
||||
|
||||
/*!
|
||||
\fn const char* BNotification::SourceSignature() const
|
||||
\brief Undocumented
|
||||
\brief Returns signature of the application where the notification
|
||||
originated.
|
||||
|
||||
When you build your own notifications, this will contain the signature of
|
||||
the current application. If you receive notifications from other
|
||||
applications, it will include theirs.
|
||||
|
||||
\returns Signature of the source application.
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
@ -132,7 +243,14 @@
|
||||
|
||||
/*!
|
||||
\fn const char* BNotification::SourceName() const
|
||||
\brief Undocumented
|
||||
\brief Returns the name of the application where the notification
|
||||
originated.
|
||||
|
||||
When you build your own notifications, this will contain the name of
|
||||
the current application. If you receive notifications from other
|
||||
applications, it will include theirs.
|
||||
|
||||
\returns Name of the source application.
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
@ -140,7 +258,10 @@
|
||||
|
||||
/*!
|
||||
\fn notification_type BNotification::Type() const
|
||||
\brief Undocumented
|
||||
\brief Returns the type of the notification.
|
||||
|
||||
\returns A value of the \c notification_type enum that represents
|
||||
notification type.
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
@ -148,7 +269,11 @@
|
||||
|
||||
/*!
|
||||
\fn const char* BNotification::Group() const
|
||||
\brief Undocumented
|
||||
\brief Returns the group of the notification.
|
||||
|
||||
\see BNotification::SetGroup() for more information about groups.
|
||||
|
||||
\returns The string of the notification's group.
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
@ -156,7 +281,16 @@
|
||||
|
||||
/*!
|
||||
\fn void BNotification::SetGroup(const BString& group)
|
||||
\brief Undocumented
|
||||
\brief Set a group for the notifcation.
|
||||
|
||||
The default behaviour of the \c notification_server is group the visible
|
||||
notifications per running application, and then in order in which they have
|
||||
been received. There may be situations where you want to override that
|
||||
behavior and group related notifications. When you set a group name, the
|
||||
\c notification_server will create a box with the \c group name as label,
|
||||
and insert all related notifications in that box.
|
||||
|
||||
\image html notification_group.png
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
@ -164,7 +298,9 @@
|
||||
|
||||
/*!
|
||||
\fn const char* BNotification::Title() const
|
||||
\brief Undocumented
|
||||
\brief Returns the title of the notification.
|
||||
|
||||
\returns The title of the notification as a string.
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
@ -172,7 +308,7 @@
|
||||
|
||||
/*!
|
||||
\fn void BNotification::SetTitle(const BString& title)
|
||||
\brief Undocumented
|
||||
\brief Set a title for the notification.
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
@ -180,7 +316,9 @@
|
||||
|
||||
/*!
|
||||
\fn const char* BNotification::Content() const
|
||||
\brief Undocumented
|
||||
\brief Returns the message of the notification.
|
||||
|
||||
\returns The message of the notification as a string.
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
@ -188,7 +326,7 @@
|
||||
|
||||
/*!
|
||||
\fn void BNotification::SetContent(const BString& content)
|
||||
\brief Undocumented
|
||||
\brief Set a message for the notification.
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
@ -196,7 +334,11 @@
|
||||
|
||||
/*!
|
||||
\fn const char* BNotification::MessageID() const
|
||||
\brief Undocumented
|
||||
\brief Returns the identifier of the notification.
|
||||
|
||||
\see BNotification::SetMessageID() for the purpose of having an identifier.
|
||||
|
||||
\returns The identifier of the notification as a string.
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
@ -204,7 +346,15 @@
|
||||
|
||||
/*!
|
||||
\fn void BNotification::SetMessageID(const BString& id)
|
||||
\brief Undocumented
|
||||
\brief Sets notification's message identifier.
|
||||
|
||||
If you want to update the contents of an existing notification, you can
|
||||
set a identifier for this message. When you send a new or updated message
|
||||
with the same identifier, the \c notification_server will update the
|
||||
existing message with the new content.
|
||||
|
||||
In order to effectively use this feature, you will have to make sure the
|
||||
identifier is unique within the current application.
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
@ -212,7 +362,12 @@
|
||||
|
||||
/*!
|
||||
\fn float BNotification::Progress() const
|
||||
\brief Undocumented
|
||||
\brief Returns the progress for the notification.
|
||||
|
||||
\see BNotification::SetProgress() for more information about this value.
|
||||
|
||||
\returns A value between 0.0 and 1.0 if notification's type is
|
||||
\c B_PROGRESS_NOTIFICATION, or otherwise -1.
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
@ -220,7 +375,16 @@
|
||||
|
||||
/*!
|
||||
\fn void BNotification::SetProgress(float progress)
|
||||
\brief Undocumented
|
||||
\brief Sets progress information.
|
||||
|
||||
When you are building a notification of the type \c B_PROGRESS_NOTIFICATION
|
||||
the notification view will show a progress bar and a label that
|
||||
expresses the progress in a percentage. Using this method you can set
|
||||
what the bar and label express.
|
||||
|
||||
The valid range is between 0.0 and 1.0. If \c progress is lower than 0.0
|
||||
(i.e. negative), the value will be set to 0.0. If it is higher than 1.0,
|
||||
it will be set to 1.0.
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
@ -228,7 +392,10 @@
|
||||
|
||||
/*!
|
||||
\fn const char* BNotification::OnClickApp() const
|
||||
\brief Undocumented
|
||||
\brief Returns the signature of the application that will be called when
|
||||
the notification is clicked.
|
||||
|
||||
\see More information about this property in BNotification::SetOnClickApp().
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
@ -236,7 +403,20 @@
|
||||
|
||||
/*!
|
||||
\fn void BNotification::SetOnClickApp(const BString& app)
|
||||
\brief Undocumented
|
||||
\brief Set which application should be called when the notification is
|
||||
clicked by the user.
|
||||
|
||||
The value \c app should be a valid application signature, for example
|
||||
\c 'application/x-vnd.Haiku-StyledEdit'.
|
||||
|
||||
Using this property has precedence on when BNotification::SetOnClickFile()
|
||||
is used. If you want interacting with the notification opening a specific
|
||||
file, then you should use this method in combination with
|
||||
BNotification::AddOnClickRef().
|
||||
|
||||
\see Additional actions and parameters can be set through
|
||||
BNotification::SetOnClickFile(), BNotification::AddOnClickRef()
|
||||
and BNotification::AddOnClickArg().
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
@ -244,7 +424,10 @@
|
||||
|
||||
/*!
|
||||
\fn const entry_ref* BNotification::OnClickFile() const
|
||||
\brief Undocumented
|
||||
\brief Returns the reference to the file that will be opened when the
|
||||
notification is clicked.
|
||||
|
||||
\see More information about this property in BNotification::SetOnClickFile().
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
@ -252,7 +435,18 @@
|
||||
|
||||
/*!
|
||||
\fn status_t BNotification::SetOnClickFile(const entry_ref* file)
|
||||
\brief Undocumented
|
||||
\brief Set which file should be opened when the notification is
|
||||
clicked by the user.
|
||||
|
||||
The file will be opened by the default application for this file type.
|
||||
|
||||
You cannot use this action in combination with
|
||||
BNotification::SetOnClickApp(). If you use this way of setting an action,
|
||||
this action will be ignored.
|
||||
|
||||
\see Additional actions and parameters can be set through
|
||||
BNotification::SetOnClickApp(), BNotification::AddOnClickRef()
|
||||
and BNotification::AddOnClickArg().
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
@ -260,7 +454,13 @@
|
||||
|
||||
/*!
|
||||
\fn status_t BNotification::AddOnClickRef(const entry_ref* ref)
|
||||
\brief Undocumented
|
||||
\brief Add a \c ref to the list of arguments passed when a user clicks the
|
||||
notification.
|
||||
|
||||
This method allows you to construct a list of refs, that will be sent to
|
||||
the application specified by BNotification::AddOnClickApp(), or the one
|
||||
that is associated with BNotification::AddOnClickFile(). The refs will be
|
||||
handled by the application's BApplication::RefsReceived() hook method.
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
@ -268,7 +468,10 @@
|
||||
|
||||
/*!
|
||||
\fn int32 BNotification::CountOnClickRefs() const
|
||||
\brief Undocumented
|
||||
\brief Returns the number of refs to be passed when the user clicks on
|
||||
the notification.
|
||||
|
||||
\see BNotification::AddOnClickRef()
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
@ -276,7 +479,9 @@
|
||||
|
||||
/*!
|
||||
\fn const entry_ref* BNotification::OnClickRefAt(int32 index) const
|
||||
\brief Undocumented
|
||||
\brief Returns the ref that is stored at \c index.
|
||||
|
||||
\see BNotification::AddOnClickRef()
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
@ -284,7 +489,13 @@
|
||||
|
||||
/*!
|
||||
\fn status_t BNotification::AddOnClickArg(const BString& arg)
|
||||
\brief Undocumented
|
||||
\brief Add to a list of arguments that are passed to an application when
|
||||
the user clicks on the notification.
|
||||
|
||||
This method allows you to construct a list of arguments, that will be sent
|
||||
to the application specified by BNotification::AddOnClickApp(), or the one
|
||||
that is associated with BNotification::AddOnClickFile(). The args will be
|
||||
handled by the application's BApplication::ArgvReceived() hook method.
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
@ -292,7 +503,10 @@
|
||||
|
||||
/*!
|
||||
\fn int32 BNotification::CountOnClickArgs() const
|
||||
\brief Undocumented
|
||||
\brief Returns the number of args to be passed when the user clicks on
|
||||
the notification.
|
||||
|
||||
\see BNotification::AddOnClickArg()
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
@ -300,15 +514,20 @@
|
||||
|
||||
/*!
|
||||
\fn const char* BNotification::OnClickArgAt(int32 index) const
|
||||
\brief Undocumented
|
||||
\brief Returns the arg that is stored at \c index.
|
||||
|
||||
\see BNotification::AddOnClickArg()
|
||||
\since Haiku R1
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn const BBitmap* BNotification::Icon() const
|
||||
\brief Undocumented
|
||||
\brief Returns the icon for the notification.
|
||||
|
||||
\see BNotification::SetIcon() for more information on this property.
|
||||
|
||||
\return Returns a borrowed unchangeable reference to the icon.
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
@ -316,7 +535,15 @@
|
||||
|
||||
/*!
|
||||
\fn status_t BNotification::SetIcon(const BBitmap* icon)
|
||||
\brief Undocumented
|
||||
\brief Set the icon of the notification.
|
||||
|
||||
Set the icon for the notification. By default, the application icon is
|
||||
used. This method makes a copy of the \a icon.
|
||||
|
||||
\param icon The icon that should be displayed with the notification.
|
||||
\returns \c B_OK if everything went fine, \c B_NO_MEMORY when the \a icon
|
||||
could not be copied, or another error if something else went
|
||||
wrong.
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
@ -324,7 +551,23 @@
|
||||
|
||||
/*!
|
||||
\fn status_t BNotification::Send(bigtime_t timeout = -1)
|
||||
\brief Undocumented
|
||||
\brief Send the notification to the notification_server.
|
||||
|
||||
The notification is delivered asynchronously to the notification_server,
|
||||
which will display it according to its settings and filters.
|
||||
|
||||
After sending, you retain ownership of the notification. The advantage is
|
||||
that you can re-use the notification at a later moment, or use the object to
|
||||
update the notification. See BNotification::SetMessageID() about updating
|
||||
displayed notifications. If you allocate the notification on the heap, be
|
||||
sure to free the memory.
|
||||
|
||||
\param timeout The \a timeout in microsecond that the notification should
|
||||
be displayed. If you want to use the default timing, use the default
|
||||
argument or pass \c -1.
|
||||
\returns \c B_OK if everything went fine, \c B_BAD_PORT_ID if there was a
|
||||
problem connecting to the \c notification_server, or any other
|
||||
errors if something went wrong transmitting the notification.
|
||||
|
||||
\since Haiku R1
|
||||
*/
|
||||
|
BIN
docs/user/app/images/notification_error_type.png
Normal file
BIN
docs/user/app/images/notification_error_type.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.7 KiB |
BIN
docs/user/app/images/notification_group.png
Normal file
BIN
docs/user/app/images/notification_group.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
BIN
docs/user/app/images/notification_important_type.png
Normal file
BIN
docs/user/app/images/notification_important_type.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.9 KiB |
BIN
docs/user/app/images/notification_information_type.png
Normal file
BIN
docs/user/app/images/notification_information_type.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.8 KiB |
BIN
docs/user/app/images/notification_intro.png
Normal file
BIN
docs/user/app/images/notification_intro.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
BIN
docs/user/app/images/notification_progress_type.png
Normal file
BIN
docs/user/app/images/notification_progress_type.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.9 KiB |
@ -140,8 +140,6 @@ BNotification::~BNotification()
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Returns initialization status.
|
||||
*/
|
||||
status_t
|
||||
BNotification::InitCheck() const
|
||||
{
|
||||
@ -149,16 +147,6 @@ BNotification::InitCheck() const
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Returns a new BNotification object from @archive.
|
||||
|
||||
Returns a new BNotification object, allocated by new and created
|
||||
with the version of the constructor that takes BMessage archive.
|
||||
However, if the message doesn't contain an archived data for a
|
||||
BNotification object, this method returns NULL.
|
||||
|
||||
\return BNotification object from @archive or NULL if it doesn't
|
||||
contain a valid BNotification object.
|
||||
*/
|
||||
BArchivable*
|
||||
BNotification::Instantiate(BMessage* archive)
|
||||
{
|
||||
@ -169,13 +157,6 @@ BNotification::Instantiate(BMessage* archive)
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Archives the BNotification in the BMessages @archive.
|
||||
|
||||
\sa BArchivable::Archive(), Instantiate() static function.
|
||||
\return
|
||||
- \c B_OK: Everything went fine.
|
||||
- \c Other errors: Archiving has failed.
|
||||
*/
|
||||
status_t
|
||||
BNotification::Archive(BMessage* archive, bool deep) const
|
||||
{
|
||||
@ -241,10 +222,6 @@ BNotification::Archive(BMessage* archive, bool deep) const
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Returns source application signature.
|
||||
|
||||
\return Source application signature.
|
||||
*/
|
||||
const char*
|
||||
BNotification::SourceSignature() const
|
||||
{
|
||||
@ -252,10 +229,6 @@ BNotification::SourceSignature() const
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Returns source application name.
|
||||
|
||||
\return Source application name.
|
||||
*/
|
||||
const char*
|
||||
BNotification::SourceName() const
|
||||
{
|
||||
@ -263,11 +236,6 @@ BNotification::SourceName() const
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Notification's type.
|
||||
|
||||
\return A value of the notification_type enum that represents
|
||||
notification type.
|
||||
*/
|
||||
notification_type
|
||||
BNotification::Type() const
|
||||
{
|
||||
@ -275,10 +243,6 @@ BNotification::Type() const
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Returns notification's group.
|
||||
|
||||
\return Notification's group.
|
||||
*/
|
||||
const char*
|
||||
BNotification::Group() const
|
||||
{
|
||||
@ -288,10 +252,6 @@ BNotification::Group() const
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Sets notification's group.
|
||||
|
||||
Notifications can be grouped together setting the same group.
|
||||
*/
|
||||
void
|
||||
BNotification::SetGroup(const BString& group)
|
||||
{
|
||||
@ -299,10 +259,6 @@ BNotification::SetGroup(const BString& group)
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Returns notification's title.
|
||||
|
||||
\return Notification's title.
|
||||
*/
|
||||
const char*
|
||||
BNotification::Title() const
|
||||
{
|
||||
@ -312,8 +268,6 @@ BNotification::Title() const
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Set notification's title.
|
||||
*/
|
||||
void
|
||||
BNotification::SetTitle(const BString& title)
|
||||
{
|
||||
@ -321,10 +275,6 @@ BNotification::SetTitle(const BString& title)
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Returns notification's message.
|
||||
|
||||
\return Notification's message.
|
||||
*/
|
||||
const char*
|
||||
BNotification::Content() const
|
||||
{
|
||||
@ -334,8 +284,6 @@ BNotification::Content() const
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Sets notification's message.
|
||||
*/
|
||||
void
|
||||
BNotification::SetContent(const BString& content)
|
||||
{
|
||||
@ -343,10 +291,6 @@ BNotification::SetContent(const BString& content)
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Returns notification's message identifier.
|
||||
|
||||
\return Notification's message identifier.
|
||||
*/
|
||||
const char*
|
||||
BNotification::MessageID() const
|
||||
{
|
||||
@ -356,8 +300,6 @@ BNotification::MessageID() const
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Sets notification's message identifier.
|
||||
*/
|
||||
void
|
||||
BNotification::SetMessageID(const BString& id)
|
||||
{
|
||||
@ -365,16 +307,6 @@ BNotification::SetMessageID(const BString& id)
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Returns progress information.
|
||||
|
||||
If notification's type is \c B_PROGRESS_NOTIFICATION, returns a value
|
||||
between 0.0 and 1.0 that represent progress percentage.
|
||||
|
||||
If notification's type is not \c B_PROGRESS_NOTIFICATION, returns -1.
|
||||
|
||||
\return Percentage if notification's type is B_PROGRESS_NOTIFICATION
|
||||
or otherwise -1.
|
||||
*/
|
||||
float
|
||||
BNotification::Progress() const
|
||||
{
|
||||
@ -384,13 +316,6 @@ BNotification::Progress() const
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Sets progress information.
|
||||
|
||||
Sets progress percentage, this information will be used only
|
||||
if notification's type is \c B_PROGRESS_NOTIFICATION.
|
||||
|
||||
The value of @progress must be between 0.0 and 1.0.
|
||||
*/
|
||||
void
|
||||
BNotification::SetProgress(float progress)
|
||||
{
|
||||
@ -495,10 +420,6 @@ BNotification::OnClickArgAt(int32 index) const
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Notification's icon.
|
||||
|
||||
\return Notification's icon.
|
||||
*/
|
||||
const BBitmap*
|
||||
BNotification::Icon() const
|
||||
{
|
||||
@ -506,17 +427,6 @@ BNotification::Icon() const
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Sets notification's icon.
|
||||
|
||||
Sets notification's icon.
|
||||
This method does not assume ownership of @icon.
|
||||
|
||||
\param icon Icon
|
||||
\return
|
||||
- \c B_OK: Everything went fine.
|
||||
- \c B_NO_MEMORY: Allocation of @icon copy has failed.
|
||||
- \c Other errors: Creation of @icon copy failed for some reason.
|
||||
*/
|
||||
status_t
|
||||
BNotification::SetIcon(const BBitmap* icon)
|
||||
{
|
||||
@ -534,18 +444,6 @@ BNotification::SetIcon(const BBitmap* icon)
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Sends a notification to the notification_server.
|
||||
|
||||
The notification is delivered asynchronously to the notification_server,
|
||||
which will display it according to its settings and filters.
|
||||
|
||||
\param timeout Microseconds after the message fades out.
|
||||
\return
|
||||
- \c B_OK: Everything went fine.
|
||||
- \c B_BAD_PORT_ID: A connection to notification_server could not be
|
||||
established or the server is not up and running anymore.
|
||||
- \c Other errors: Building the message from the notification failed.
|
||||
*/
|
||||
status_t
|
||||
BNotification::Send(bigtime_t timeout)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user