Version: 3.0.2
wxNotificationMessage Class Reference

#include <wx/notifmsg.h>

+ Inheritance diagram for wxNotificationMessage:

Detailed Description

This class allows to show the user a message non intrusively.

Currently it is implemented natively for Windows and GTK and uses (non-modal) dialogs for the display of the notifications under the other platforms.

Notice that this class is not a window and so doesn't derive from wxWindow.

Library:  wxAdvanced
Category:  Miscellaneous

Public Types

enum  {
  Timeout_Auto = -1,
  Timeout_Never = 0
}
 Possible values for Show() timeout. More...
 

Public Member Functions

 wxNotificationMessage ()
 Default constructor, use SetParent(), SetTitle() and SetMessage() to initialize the object before showing it.
 
 wxNotificationMessage (const wxString &title, const wxString &message=wxEmptyString, wxWindow *parent=NULL, int flags=wxICON_INFORMATION)
 Create a notification object with the given attributes.
 
virtual ~wxNotificationMessage ()
 Destructor does not hide the notification.
 
virtual bool Close ()
 Hides the notification.
 
void SetFlags (int flags)
 This parameter can be currently used to specify the icon to show in the notification.
 
void SetMessage (const wxString &message)
 Set the main text of the notification.
 
void SetParent (wxWindow *parent)
 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 main application window by default.
 
void SetTitle (const wxString &title)
 Set the title, it must be a concise string (not more than 64 characters), use SetMessage() to give the user more details.
 
virtual bool Show (int timeout=Timeout_Auto)
 Show the notification to the user and hides it after timeout seconds are elapsed.
 
- Public Member Functions inherited from wxEvtHandler
 wxEvtHandler ()
 Constructor.
 
virtual ~wxEvtHandler ()
 Destructor.
 
virtual void QueueEvent (wxEvent *event)
 Queue event for a later processing.
 
virtual void AddPendingEvent (const wxEvent &event)
 Post an event to be processed later.
 
template<typename T , typename T1 , ... >
void CallAfter (void(T::*method)(T1,...), T1 x1,...)
 Asynchronously call the given method.
 
template<typename T >
void CallAfter (const T &functor)
 Asynchronously call the given functor.
 
virtual bool ProcessEvent (wxEvent &event)
 Processes an event, searching event tables and calling zero or more suitable event handler function(s).
 
bool ProcessEventLocally (wxEvent &event)
 Try to process the event in this handler and all those chained to it.
 
bool SafelyProcessEvent (wxEvent &event)
 Processes an event by calling ProcessEvent() and handles any exceptions that occur in the process.
 
void ProcessPendingEvents ()
 Processes the pending events previously queued using QueueEvent() or AddPendingEvent(); you must call this function only if you are sure there are pending events for this handler, otherwise a wxCHECK will fail.
 
void DeletePendingEvents ()
 Deletes all events queued on this event handler using QueueEvent() or AddPendingEvent().
 
virtual bool SearchEventTable (wxEventTable &table, wxEvent &event)
 Searches the event table, executing an event handler function if an appropriate one is found.
 
void Connect (int id, int lastId, wxEventType eventType, wxObjectEventFunction function, wxObject *userData=NULL, wxEvtHandler *eventSink=NULL)
 Connects the given function dynamically with the event handler, id and event type.
 
void Connect (int id, wxEventType eventType, wxObjectEventFunction function, wxObject *userData=NULL, wxEvtHandler *eventSink=NULL)
 See the Connect(int, int, wxEventType, wxObjectEventFunction, wxObject*, wxEvtHandler*) overload for more info.
 
void Connect (wxEventType eventType, wxObjectEventFunction function, wxObject *userData=NULL, wxEvtHandler *eventSink=NULL)
 See the Connect(int, int, wxEventType, wxObjectEventFunction, wxObject*, wxEvtHandler*) overload for more info.
 
bool Disconnect (wxEventType eventType, wxObjectEventFunction function, wxObject *userData=NULL, wxEvtHandler *eventSink=NULL)
 Disconnects the given function dynamically from the event handler, using the specified parameters as search criteria and returning true if a matching function has been found and removed.
 
bool Disconnect (int id=wxID_ANY, wxEventType eventType=wxEVT_NULL, wxObjectEventFunction function=NULL, wxObject *userData=NULL, wxEvtHandler *eventSink=NULL)
 See the Disconnect(wxEventType, wxObjectEventFunction, wxObject*, wxEvtHandler*) overload for more info.
 
bool Disconnect (int id, int lastId, wxEventType eventType, wxObjectEventFunction function=NULL, wxObject *userData=NULL, wxEvtHandler *eventSink=NULL)
 See the Disconnect(wxEventType, wxObjectEventFunction, wxObject*, wxEvtHandler*) overload for more info.
 
template<typename EventTag , typename Functor >
void Bind (const EventTag &eventType, Functor functor, int id=wxID_ANY, int lastId=wxID_ANY, wxObject *userData=NULL)
 Binds the given function, functor or method dynamically with the event.
 
template<typename EventTag , typename Class , typename EventArg , typename EventHandler >
void Bind (const EventTag &eventType, void(Class::*method)(EventArg &), EventHandler *handler, int id=wxID_ANY, int lastId=wxID_ANY, wxObject *userData=NULL)
 See the Bind<>(const EventTag&, Functor, int, int, wxObject*) overload for more info.
 
template<typename EventTag , typename Functor >
bool Unbind (const EventTag &eventType, Functor functor, int id=wxID_ANY, int lastId=wxID_ANY, wxObject *userData=NULL)
 Unbinds the given function, functor or method dynamically from the event handler, using the specified parameters as search criteria and returning true if a matching function has been found and removed.
 
template<typename EventTag , typename Class , typename EventArg , typename EventHandler >
bool Unbind (const EventTag &eventType, void(Class::*method)(EventArg &), EventHandler *handler, int id=wxID_ANY, int lastId=wxID_ANY, wxObject *userData=NULL)
 See the Unbind<>(const EventTag&, Functor, int, int, wxObject*) overload for more info.
 
void * GetClientData () const
 Returns user-supplied client data.
 
wxClientDataGetClientObject () const
 Returns a pointer to the user-supplied client data object.
 
void SetClientData (void *data)
 Sets user-supplied client data.
 
void SetClientObject (wxClientData *data)
 Set the client data object.
 
bool GetEvtHandlerEnabled () const
 Returns true if the event handler is enabled, false otherwise.
 
wxEvtHandlerGetNextHandler () const
 Returns the pointer to the next handler in the chain.
 
wxEvtHandlerGetPreviousHandler () const
 Returns the pointer to the previous handler in the chain.
 
void SetEvtHandlerEnabled (bool enabled)
 Enables or disables the event handler.
 
virtual void SetNextHandler (wxEvtHandler *handler)
 Sets the pointer to the next handler.
 
virtual void SetPreviousHandler (wxEvtHandler *handler)
 Sets the pointer to the previous handler.
 
void Unlink ()
 Unlinks this event handler from the chain it's part of (if any); then links the "previous" event handler to the "next" one (so that the chain won't be interrupted).
 
bool IsUnlinked () const
 Returns true if the next and the previous handler pointers of this event handler instance are NULL.
 
- Public Member Functions inherited from wxObject
 wxObject ()
 Default ctor; initializes to NULL the internal reference data.
 
 wxObject (const wxObject &other)
 Copy ctor.
 
virtual ~wxObject ()
 Destructor.
 
virtual wxClassInfoGetClassInfo () const
 This virtual function is redefined for every class that requires run-time type information, when using the wxDECLARE_CLASS macro (or similar).
 
wxObjectRefDataGetRefData () const
 Returns the wxObject::m_refData pointer, i.e. the data referenced by this object.
 
bool IsKindOf (const wxClassInfo *info) const
 Determines whether this class is a subclass of (or the same class as) the given class.
 
bool IsSameAs (const wxObject &obj) const
 Returns true if this object has the same data pointer as obj.
 
void Ref (const wxObject &clone)
 Makes this object refer to the data in clone.
 
void SetRefData (wxObjectRefData *data)
 Sets the wxObject::m_refData pointer.
 
void UnRef ()
 Decrements the reference count in the associated data, and if it is zero, deletes the data.
 
void UnShare ()
 This is the same of AllocExclusive() but this method is public.
 
void operator delete (void *buf)
 The delete operator is defined for debugging versions of the library only, when the identifier WXDEBUG is defined.
 
void * operator new (size_t size, const wxString &filename=NULL, int lineNum=0)
 The new operator is defined for debugging versions of the library only, when the identifier WXDEBUG is defined.
 

Additional Inherited Members

- Static Public Member Functions inherited from wxEvtHandler
static void AddFilter (wxEventFilter *filter)
 Add an event filter whose FilterEvent() method will be called for each and every event processed by wxWidgets.
 
static void RemoveFilter (wxEventFilter *filter)
 Remove a filter previously installed with AddFilter().
 
- Protected Member Functions inherited from wxEvtHandler
virtual bool TryBefore (wxEvent &event)
 Method called by ProcessEvent() before examining this object event tables.
 
virtual bool TryAfter (wxEvent &event)
 Method called by ProcessEvent() as last resort.
 
- Protected Attributes inherited from wxObject
wxObjectRefDatam_refData
 Pointer to an object which is the object's reference-counted data.
 

Member Enumeration Documentation

anonymous enum

Possible values for Show() timeout.

Enumerator:
Timeout_Auto 

Notification will be hidden automatically.

Timeout_Never 

Notification will never time out.

Constructor & Destructor Documentation

wxNotificationMessage::wxNotificationMessage ( )

Default constructor, use SetParent(), SetTitle() and SetMessage() to initialize the object before showing it.

wxNotificationMessage::wxNotificationMessage ( const wxString title,
const wxString message = wxEmptyString,
wxWindow parent = NULL,
int  flags = wxICON_INFORMATION 
)

Create a notification object with the given attributes.

See SetTitle(), SetMessage(), SetParent() and SetFlags() for the description of the corresponding parameters.

virtual wxNotificationMessage::~wxNotificationMessage ( )
virtual

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.

Member Function Documentation

virtual bool wxNotificationMessage::Close ( )
virtual

Hides the notification.

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

void wxNotificationMessage::SetFlags ( int  flags)

This parameter can be currently used to specify the icon to show in the notification.

Valid values are wxICON_INFORMATION, wxICON_WARNING and wxICON_ERROR (notice that wxICON_QUESTION is not allowed here). Some implementations of this class may not support the icons.

void wxNotificationMessage::SetMessage ( const wxString message)

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

void wxNotificationMessage::SetParent ( wxWindow parent)

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 main application window by default.

void wxNotificationMessage::SetTitle ( const wxString title)

Set the title, it must be a concise string (not more than 64 characters), use SetMessage() to give the user more details.

virtual bool wxNotificationMessage::Show ( int  timeout = Timeout_Auto)
virtual

Show the notification to the user and hides it after timeout seconds are elapsed.

Special values Timeout_Auto and Timeout_Never can be used here, notice that you shouldn't rely on timeout being exactly respected because the current platform may only support default timeout value and also because the user may be able to close the notification.

Note
When using native notifications in wxGTK, the timeout is ignored for the notifications with wxICON_WARNING or wxICON_ERROR flags, they always remain shown unless they're explicitly hidden by the user, i.e. behave as if Timeout_Auto were given.
Returns
false if an error occurred.