#include "wxBusEvent.h"

wxDEFINE_EVENT(wx_BUSEVENT_MESSAGE, wxBusEvent);
//--------------------------------------------------------------
/* Constructor */
wxBusEvent::wxBusEvent(message_t message, const int id)
  : wxCommandEvent(wx_BUSEVENT_MESSAGE, id)
  , m_message(std::move(message))
{
  // Nothing to do here
}
//--------------------------------------------------------------
/* Clone method for wxWidgets event system */
wxEvent *wxBusEvent::Clone() const
{
  auto *clonedEvent = new wxBusEvent(m_message, GetId());
  clonedEvent->SetEventObject(GetEventObject());     // Copy the event object
  return clonedEvent;
}
//--------------------------------------------------------------
/* Get the message type ID */
wxBusEvent::MessageTypeID wxBusEvent::getMessageTypeID() const
{
  return m_message ? m_message->getMessageTypeID() : 0;     // Return 0 if message is null
}
//--------------------------------------------------------------
/* Get the message data */
wxBusEvent::message_t wxBusEvent::getMessage() const
{
  return m_message;
}
//--------------------------------------------------------------
