2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: notifmsg.h
|
2008-03-10 11:24:38 -04:00
|
|
|
// Purpose: interface of wxNotificationMessage
|
2008-03-08 08:52:38 -05:00
|
|
|
// Author: wxWidgets team
|
2010-07-13 09:29:13 -04:00
|
|
|
// Licence: wxWindows licence
|
2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxNotificationMessage
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-10-13 04:55:12 -04:00
|
|
|
This class allows to show the user a message non intrusively.
|
|
|
|
|
2012-07-27 11:36:54 -04:00
|
|
|
Currently it is implemented natively for Windows and GTK and uses
|
2008-10-13 04:55:12 -04:00
|
|
|
(non-modal) dialogs for the display of the notifications under the other
|
2012-07-27 11:36:54 -04:00
|
|
|
platforms.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
Notice that this class is not a window and so doesn't derive from wxWindow.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-10-13 04:55:12 -04:00
|
|
|
@library{wxadv}
|
|
|
|
@category{misc}
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
class wxNotificationMessage : public wxEvtHandler
|
|
|
|
{
|
|
|
|
public:
|
2012-02-20 16:56:52 -05:00
|
|
|
/// Possible values for Show() timeout.
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
Timeout_Auto = -1, ///< Notification will be hidden automatically.
|
|
|
|
Timeout_Never = 0 ///< Notification will never time out.
|
|
|
|
};
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
2008-10-13 04:55:12 -04:00
|
|
|
Default constructor, use SetParent(), SetTitle() and SetMessage() to
|
|
|
|
initialize the object before showing it.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
wxNotificationMessage();
|
2008-10-13 04:55:12 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
Create a notification object with the given attributes.
|
|
|
|
|
|
|
|
See SetTitle(), SetMessage(), SetParent() and SetFlags() for the
|
|
|
|
description of the corresponding parameters.
|
|
|
|
*/
|
|
|
|
wxNotificationMessage(const wxString& title, const wxString& message = wxEmptyString,
|
|
|
|
wxWindow* parent = NULL, int flags = wxICON_INFORMATION);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2012-07-27 11:36:54 -04:00
|
|
|
/**
|
|
|
|
Destructor does not hide the notification.
|
|
|
|
|
|
|
|
The notification can continue to be shown even after the C++ object was
|
|
|
|
destroyed, call Close() explicitly if it needs to be hidden.
|
|
|
|
*/
|
|
|
|
virtual ~wxNotificationMessage();
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
Hides the notification.
|
2008-10-13 04:55:12 -04:00
|
|
|
|
|
|
|
Returns @true if it was hidden or @false if it couldn't be done
|
|
|
|
(e.g. on some systems automatically hidden notifications can't be
|
|
|
|
hidden manually).
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool Close();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
This parameter can be currently used to specify the icon to show in the
|
2008-10-13 04:55:12 -04:00
|
|
|
notification.
|
|
|
|
|
|
|
|
Valid values are @c wxICON_INFORMATION, @c wxICON_WARNING and
|
|
|
|
@c wxICON_ERROR (notice that @c wxICON_QUESTION is not allowed here).
|
2008-03-08 08:52:38 -05:00
|
|
|
Some implementations of this class may not support the icons.
|
|
|
|
*/
|
|
|
|
void SetFlags(int flags);
|
|
|
|
|
|
|
|
/**
|
2008-10-13 04:55:12 -04:00
|
|
|
Set the main text of the notification.
|
|
|
|
|
|
|
|
This should be a more detailed description than the title but still limited
|
|
|
|
to reasonable length (not more than 256 characters).
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void SetMessage(const wxString& message);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Set the parent for this notification: the notification will be associated with
|
|
|
|
the top level parent of this window or, if this method is not called, with the
|
2008-10-13 04:55:12 -04:00
|
|
|
main application window by default.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void SetParent(wxWindow* parent);
|
|
|
|
|
|
|
|
/**
|
2008-03-08 09:43:31 -05:00
|
|
|
Set the title, it must be a concise string (not more than 64 characters), use
|
2008-10-13 04:55:12 -04:00
|
|
|
SetMessage() to give the user more details.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void SetTitle(const wxString& title);
|
|
|
|
|
|
|
|
/**
|
2008-10-13 04:55:12 -04:00
|
|
|
Show the notification to the user and hides it after @a timeout seconds
|
|
|
|
are elapsed.
|
|
|
|
|
|
|
|
Special values @c Timeout_Auto and @c Timeout_Never can be used here,
|
|
|
|
notice that you shouldn't rely on @a timeout being exactly respected
|
|
|
|
because the current platform may only support default timeout value
|
2008-03-08 08:52:38 -05:00
|
|
|
and also because the user may be able to close the notification.
|
2008-10-13 04:55:12 -04:00
|
|
|
|
2012-07-27 11:36:54 -04:00
|
|
|
@note When using native notifications in wxGTK, the timeout is ignored
|
|
|
|
for the notifications with @c wxICON_WARNING or @c wxICON_ERROR
|
|
|
|
flags, they always remain shown unless they're explicitly hidden by
|
|
|
|
the user, i.e. behave as if Timeout_Auto were given.
|
|
|
|
|
2008-10-13 04:55:12 -04:00
|
|
|
@return @false if an error occurred.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool Show(int timeout = Timeout_Auto);
|
2008-03-08 08:52:38 -05:00
|
|
|
};
|
2008-03-10 11:24:38 -04:00
|
|
|
|