Main Page Class Hierarchy Compound List File List Compound Members File Members Related Pages Examples

# SDLMessageObject Class Reference

Base class of all objects (provides message handling). More...

`#include <sdlmessageobject.h>`

Inheritance diagram for SDLMessageObject

[legend]
Collaboration diagram for SDLMessageObject:

[legend]
List of all members.

## Public Methods
| SDLMessageObject ()
| Creates a SDLMessageObject. More...
virtual | ~SDLMessageObject ()
| Destroys a SDLMessageObject and removes it from the global object list. More...
void | EnableReceiver (bool enable)
| This function enables or disables receiving of SDL_Event messages. More...
SDLMessageObject* | SetCapture ()
| Set a message capture for this object. More...
void | ReleaseCapture ()
| Releases a previous capture. More...
SDLMessageObject* | SetInputFocus ()
void | ReleaseInputFocus ()
int | RunEventLoop (void* data)
| Run the modal message pump. More...
bool | IsEnabled ()
| returns true when the object can receive messages or false if not. More...
bool | SendMessage (SDLMessageObject* target, MSG_TYPE type, MSG_ID id, MSG_DATA data)
void | SetEventCallback (MSG_TYPE type, MSG_CALLBACK cbfunc, void *clientdata = NULL)
SDL_Event | WaitEvent (Uint32 delay=0)
## Static Public Methods
int | PumpIntoEventQueue (const SDL_Event* event)
| Sends an event to the global message queue. More...
## Protected Methods
virtual bool | eventActive (const SDL_ActiveEvent* active)
| Overridable Eventhandler for the SDL_ActiveEvent message. More...
virtual bool | eventKeyDown (const SDL_KeyboardEvent* key)
| Overridable Eventhandler for a SDL_KeyboardEvent message. More...
virtual bool | eventKeyUp (const SDL_KeyboardEvent* key)
| Overridable Eventhandler for a SDL_KeyboardEvent message. More...
virtual bool | eventMouseMotion (const SDL_MouseMotionEvent* motion)
| Overridable Eventhandler for a SDL_MouseMotionEvent message. More...
virtual bool | eventMouseButtonDown (const SDL_MouseButtonEvent* button)
| Overridable Eventhandler for a SDL_MouseButtonEvent message. More...
virtual bool | eventMouseButtonUp (const SDL_MouseButtonEvent* button)
| Overridable Eventhandler for a SDL_MouseButtonEvent message. More...
virtual bool | eventQuit (int id, SDLWidget* widget, unsigned long data)
| Overridable Eventhandler for a SDL_QuitEvent message. More...
virtual bool | eventSysWM (const SDL_SysWMEvent* syswm)
| Overridable Eventhandler for a SDL_SysWMEvent message. More...
virtual bool | eventMessage (MSG_MESSAGE* msg)
| Overridable Eventhandler for a SDL_SysUserEvent message. More...
virtual bool | eventButtonClick (int id, SDLWidget* widget)
virtual bool | eventScrollPos (int id, SDLWidget* widget, unsigned long data)
virtual bool | eventScrollTrack (int id, SDLWidget* widget, unsigned long data)
virtual void | eventInputFocusLost (SDLMessageObject* newfocus)
virtual void | eventIdle ()
virtual bool | AcceptEvent (const SDL_Event* event)
| Overridable message filter function. More...
virtual bool | ProcessEvent (const SDL_Event* event)
| Sends an event directly to an object. More...
## Protected Attributes
bool | my_quitEventLoop

## Detailed Description

Base class of all objects (provides message handling).

Author(s):
  Alexander Pipelka

Provides a message pump and global handlers for all other SDLMessageObject instances.

Definition at line 53 of file sdlmessageobject.h.

## Constructor & Destructor Documentation

SDLMessageObject::SDLMessageObject ( | )

| Creates a SDLMessageObject. An application must have a maximum of one SDLMessageObject. If you try to create more than one SDLMessageObject the constructor will exit your application with an console error message.

SDLMessageObject::~SDLMessageObject ( | )`[virtual]`

| Destroys a SDLMessageObject and removes it from the global object list.

## Member Function Documentation

bool SDLMessageObject::AcceptEvent ( | const SDL_Event * event )`[protected, virtual]`

  | Overridable message filter function. Derivated classes can filter special events. The default implementation returns 'false' which indicates that this message is not processed by this object. Parameters:
  event | SDL_Event message
Returns: Notifies the message pump if this message is processed by this object or it should be routed to the next message receiver. Reimplemented in SDLWidget.

void SDLMessageObject::EnableReceiver ( | bool enable )

  | This function enables or disables receiving of SDL_Event messages. Parameters:
  enable | Enable or disable the ability of receiving messages. When set to false no event handlers will be called for this object

bool SDLMessageObject::IsEnabled ( | )

| returns true when the object can receive messages or false if not.

bool SDLMessageObject::ProcessEvent ( | const SDL_Event * event )`[protected, virtual]`

  | Sends an event directly to an object. Parameters:
  event | SDL_Event message
Returns: Notifies the message pump if this message is processed by this object or it should be routed to the next message receiver. Reimplemented in SDLWidget.

int SDLMessageObject::PumpIntoEventQueue ( | const SDL_Event * event )`[static]`

  | Sends an event to the global message queue. Parameters:
  event | SDL_Event message
Returns: Notifies the message pump if this message is processed by this object or it should be routed to the next message receiver.

void SDLMessageObject::ReleaseCapture ( | )

| Releases a previous capture.

void SDLMessageObject::ReleaseInputFocus ( | )

int SDLMessageObject::RunEventLoop ( | void * data )

| Run the modal message pump. This function will exit when the main window was closed.

bool SDLMessageObject::SendMessage ( | SDLMessageObject * target,
| MSG_TYPE type,
| MSG_ID id,
| MSG_DATA data )

SDLMessageObject * SDLMessageObject::SetCapture ( | )

| Set a message capture for this object. This object will receive all SDL_Event messages regardless if it is able to process them or not.

void SDLMessageObject::SetEventCallback ( | MSG_TYPE type,
| MSG_CALLBACK cbfunc,
| void * clientdata = NULL )

| Examples: tut3.cpp, and tut4.cpp.

SDLMessageObject * SDLMessageObject::SetInputFocus ( | )

SDL_Event SDLMessageObject::WaitEvent ( | Uint32 delay = 0 )

bool SDLMessageObject::eventActive ( | const SDL_ActiveEvent * active )`[protected, virtual]`

  | Overridable Eventhandler for the SDL_ActiveEvent message. The default implementation returns 'false' which indicates that this message is not processed by this object. Parameters:
  active | SDL_ActiveEvent message
Returns: Notifies the message pump if this message is processed by this object or it should be routed to the next message receiver.

bool SDLMessageObject::eventButtonClick ( | int id,
| SDLWidget * widget )`[protected, virtual]`

| Reimplemented in SDLButtonGroup, SDLCheckButton, SDLRadioButton, SDLScrollBar, and SDLWindow.

void SDLMessageObject::eventIdle ( | )`[protected, virtual]`

void SDLMessageObject::eventInputFocusLost ( | SDLMessageObject * newfocus )`[protected, virtual]`

| Reimplemented in SDLLineEdit.

bool SDLMessageObject::eventKeyDown ( | const SDL_KeyboardEvent * key )`[protected, virtual]`

  | Overridable Eventhandler for a SDL_KeyboardEvent message. This handler is called when a key changed it's state from unpressed to pressed. The default implementation returns 'false' which indicates that this message is not processed by this object. Parameters:
  key | SDL_KeyboardEvent message
Returns: Notifies the message pump if this message is processed by this object or it should be routed to the next message receiver. Reimplemented in SDLLineEdit.

bool SDLMessageObject::eventKeyUp ( | const SDL_KeyboardEvent * key )`[protected, virtual]`

  | Overridable Eventhandler for a SDL_KeyboardEvent message. This handler is called when a key changed it's state from pressed to unpressed. The default implementation returns 'false' which indicates that this message is not processed by this object. Parameters:
  key | SDL_KeyboardEvent message
Returns: Notifies the message pump if this message is processed by this object or it should be routed to the next message receiver. Reimplemented in SDLApplication.

bool SDLMessageObject::eventMessage ( | MSG_MESSAGE * msg )`[protected, virtual]`

  | Overridable Eventhandler for a SDL_SysUserEvent message. The default implementation returns 'false' which indicates that this message is not processed by this object. Parameters:
  event | SDL_SysUserEvent message
Returns: Notifies the message pump if this message is processed by this object or it should be routed to the next message receiver.

bool SDLMessageObject::eventMouseButtonDown ( | const SDL_MouseButtonEvent * button )`[protected, virtual]`

  | Overridable Eventhandler for a SDL_MouseButtonEvent message. This handler is called when a mouse button is pressed. The default implementation returns 'false' which indicates that this message is not processed by this object. Parameters:
  button | SDL_MouseButtonEvent message
Returns: Notifies the message pump if this message is processed by this object or it should be routed to the next message receiver. Reimplemented in SDLUserButton, SDLLineEdit, SDLListBox, SDLScrollBar::ScrollButton, SDLScrollBar, SDLWidgetDnD, and SDLWindow.

bool SDLMessageObject::eventMouseButtonUp ( | const SDL_MouseButtonEvent * button )`[protected, virtual]`

  | Overridable Eventhandler for a SDL_MouseButtonEvent message. This handler is called when a mouse button is released. The default implementation returns 'false' which indicates that this message is not processed by this object. Parameters:
  button | SDL_MouseButtonEvent message
Returns: Notifies the message pump if this message is processed by this object or it should be routed to the next message receiver. Reimplemented in SDLUserButton, SDLCheckButton, SDLListBox, SDLListBoxBaseItem, SDLRadioButton, SDLScrollBar::ScrollButton, SDLScrollBar, SDLSlider, SDLWidgetDnD, and SDLWindow.

bool SDLMessageObject::eventMouseMotion ( | const SDL_MouseMotionEvent * motion )`[protected, virtual]`

  | Overridable Eventhandler for a SDL_MouseMotionEvent message. This handler is called when mouse movement is detected. The default implementation returns 'false' which indicates that this message is not processed by this object. Parameters:
  motion | SDL_MouseMotionEvent message
Returns: Notifies the message pump if this message is processed by this object or it should be routed to the next message receiver. Reimplemented in SDLListBox, SDLScrollBar::ScrollButton, SDLScrollBar, SDLWidgetDnD, and SDLWindow.

bool SDLMessageObject::eventQuit ( | int id,
| SDLWidget * widget,
| unsigned long data )`[protected, virtual]`

  | Overridable Eventhandler for a SDL_QuitEvent message. The default implementation returns 'false' which indicates that this message is not processed by this object. Parameters:
  quit | SDL_QuitEvent message
Returns: Notifies the message pump if this message is processed by this object or it should be routed to the next message receiver. Reimplemented in SDLApplication.

bool SDLMessageObject::eventScrollPos ( | int id,
| SDLWidget * widget,
| unsigned long data )`[protected, virtual]`

| Reimplemented in SDLWidgetList.

bool SDLMessageObject::eventScrollTrack ( | int id,
| SDLWidget * widget,
| unsigned long data )`[protected, virtual]`

| Reimplemented in SDLWidgetList.

bool SDLMessageObject::eventSysWM ( | const SDL_SysWMEvent * syswm )`[protected, virtual]`

  | Overridable Eventhandler for a SDL_SysWMEvent message. The default implementation returns 'false' which indicates that this message is not processed by this object. Parameters:
  syswm | SDL_SysWMEvent message
Returns: Notifies the message pump if this message is processed by this object or it should be routed to the next message receiver.

## Member Data Documentation

bool SDLMessageObject::my_quitEventLoop`[protected]`

| Definition at line 255 of file sdlmessageobject.h.

The documentation for this class was generated from the following file:

- sdlmessageobject.h