Version: 2.9.4
Public Member Functions
wxThreadEvent Class Reference

#include </home/zeitlin/src/wx/github/interface/wx/event.h>

Inheritance diagram for wxThreadEvent:

Detailed Description

This class adds some simple functionality to wxEvent to facilitate inter-thread communication.

This event is not natively emitted by any control/class: it is just a helper class for the user. Its most important feature is the GetEventCategory() implementation which allows thread events NOT to be processed by wxEventLoopBase::YieldFor calls (unless the wxEVT_CATEGORY_THREAD is specified - which is never in wx code).

Library:  wxCore
Category:  Events, Threading
参照:
Multithreading Overview, wxEventLoopBase::YieldFor
Since:
2.9.0

Public Member Functions

 wxThreadEvent (wxEventType eventType=wxEVT_THREAD, int id=wxID_ANY)
 Constructor.
virtual wxEventClone () const
 Clones this event making sure that all internal members which use COW (only m_commandString for now; see Reference Counting) are unshared (see wxObject::UnShare).
virtual wxEventCategory GetEventCategory () const
 Returns wxEVT_CATEGORY_THREAD.
template<typename T >
void SetPayload (const T &payload)
 Sets custom data payload.
template<typename T >
GetPayload () const
 Get custom data payload.
long GetExtraLong () const
 Returns extra information integer value.
int GetInt () const
 Returns stored integer value.
wxString GetString () const
 Returns stored string value.
void SetExtraLong (long extraLong)
 Sets the extra information value.
void SetInt (int intCommand)
 Sets the integer value.
void SetString (const wxString &string)
 Sets the string value.

List of all members.


Constructor & Destructor Documentation

wxThreadEvent::wxThreadEvent ( wxEventType  eventType = wxEVT_THREAD,
int  id = wxID_ANY 
)

Constructor.


Member Function Documentation

virtual wxEvent* wxThreadEvent::Clone ( ) const [virtual]

Clones this event making sure that all internal members which use COW (only m_commandString for now; see Reference Counting) are unshared (see wxObject::UnShare).

Implements wxEvent.

virtual wxEventCategory wxThreadEvent::GetEventCategory ( ) const [virtual]

Returns wxEVT_CATEGORY_THREAD.

This is important to avoid unwanted processing of thread events when calling wxEventLoopBase::YieldFor().

Reimplemented from wxEvent.

long wxThreadEvent::GetExtraLong ( ) const

Returns extra information integer value.

int wxThreadEvent::GetInt ( ) const

Returns stored integer value.

template<typename T >
T wxThreadEvent::GetPayload ( ) const

Get custom data payload.

Correct type is checked in debug builds.

注:
This method is not available with Visual C++ 6.
Since:
2.9.1
参照:
SetPayload(), wxAny
wxString wxThreadEvent::GetString ( ) const

Returns stored string value.

void wxThreadEvent::SetExtraLong ( long  extraLong)

Sets the extra information value.

void wxThreadEvent::SetInt ( int  intCommand)

Sets the integer value.

template<typename T >
void wxThreadEvent::SetPayload ( const T &  payload)

Sets custom data payload.

The payload argument may be of any type that wxAny can handle (i.e. pretty much anything). Note that T's copy constructor must be thread-safe, i.e. create a copy that doesn't share anything with the original (see Clone()).

注:
This method is not available with Visual C++ 6.
Since:
2.9.1
参照:
GetPayload(), wxAny
void wxThreadEvent::SetString ( const wxString string)

Sets the string value.

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines