You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
924 B
39 lines
924 B
#include "basicEventHandler.h"
|
|
|
|
#include "basicEventHeap.h"
|
|
|
|
// Constructor implementation
|
|
basicEventHandler::basicEventHandler()
|
|
{
|
|
m_bEventsAttached = false;
|
|
attachEvents();
|
|
}
|
|
|
|
basicEventHandler::basicEventHandler(bool attach)
|
|
{
|
|
m_bEventsAttached = false;
|
|
if ( attach ) attachEvents();
|
|
}
|
|
|
|
void basicEventHandler::attachEvents(void)
|
|
{
|
|
if ( m_bEventsAttached ) return;
|
|
m_bEventsAttached = true;
|
|
basicEventHeap::getInstance()->addHandler( this, true );
|
|
}
|
|
|
|
void basicEventHandler::detachEvents(void)
|
|
{
|
|
if ( ! m_bEventsAttached ) return;
|
|
m_bEventsAttached = false;
|
|
// Only an existing heap: after basicEventHeap::destroyInstance() (application exit) a late
|
|
// destructor must not create a new heap and dispatch thread
|
|
basicEventHeap * tHeap = basicEventHeap::existingInstance();
|
|
if ( tHeap ) tHeap->removeHandler( this );
|
|
}
|
|
|
|
// Destructor implementation
|
|
basicEventHandler::~basicEventHandler()
|
|
{
|
|
detachEvents();
|
|
}
|