Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages | Examples

PG_MessageObject Class Reference

Inheritance diagram for PG_MessageObject:

Inheritance graph
[legend]
Collaboration diagram for PG_MessageObject:

Collaboration graph
[legend]
List of all members.

Detailed Description

Base class of all objects (provides message handling).

Author:
Alexander Pipelka

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


Public Member Functions

 PG_MessageObject ()
 Creates a PG_MessageObject.

virtual ~PG_MessageObject ()
 Destroys a PG_MessageObject and removes it from the global object list.

void EnableReceiver (bool enable)
 This function enables or disables receiving of SDL_Event messages.

PG_MessageObjectSetCapture ()
 Set a message capture for this object.

void ReleaseCapture ()
 Releases a previous capture.

PG_MessageObjectGetCapture ()
 Return the current capture object.

PG_MessageObjectSetInputFocus ()
 Set an inputfocus for this object.

void ReleaseInputFocus ()
 Release the inputfocus.

bool IsEnabled ()
 Check if the object can receive messages.

void TranslateNumpadKeys (SDL_KeyboardEvent *key)
 Translates numeric keypad keys into other keys in dependency of NUM_LOCK state.

virtual bool ProcessEvent (const SDL_Event *event)
 Sends an event directly to an object.


Static Public Member Functions

bool PumpIntoEventQueue (const SDL_Event *event)
 Sends an event to the global message queue.

SDL_Event WaitEvent (Uint32 delay=0)

Public Attributes

SignalAppIdle sigAppIdle

Protected Member Functions

virtual bool eventActive (const SDL_ActiveEvent *active)
 Overridable Eventhandler for the SDL_ActiveEvent message.

virtual bool eventKeyDown (const SDL_KeyboardEvent *key)
 Overridable Eventhandler for a SDL_KeyboardEvent message.

virtual bool eventKeyUp (const SDL_KeyboardEvent *key)
 Overridable Eventhandler for a SDL_KeyboardEvent message.

virtual bool eventMouseMotion (const SDL_MouseMotionEvent *motion)
 Overridable Eventhandler for a SDL_MouseMotionEvent message.

virtual bool eventMouseButtonDown (const SDL_MouseButtonEvent *button)
 Overridable Eventhandler for a SDL_MouseButtonEvent message.

virtual bool eventMouseButtonUp (const SDL_MouseButtonEvent *button)
 Overridable Eventhandler for a SDL_MouseButtonEvent message.

virtual bool eventQuit (int id, PG_MessageObject *widget, unsigned long data)
 Overridable Eventhandler for a SDL_QuitEvent message.

virtual bool eventQuitModal (int id, PG_MessageObject *widget, unsigned long data)
 Overridable Eventhandler for a MSG_QUITMODAL message.

virtual bool eventSysWM (const SDL_SysWMEvent *syswm)
 Overridable Eventhandler for a SDL_SysWMEvent message.

virtual bool eventResize (const SDL_ResizeEvent *event)
 Overridable Eventhandler for a SDL_ResizeEvent message.

virtual void eventInputFocusLost (PG_MessageObject *newfocus)
virtual void eventIdle ()
virtual bool AcceptEvent (const SDL_Event *event)
 Overridable message filter function.


Static Protected Attributes

bool my_quitEventLoop
vector< PG_MessageObject * > objectList
PG_MessageObjectcaptureObject

Friends

class PG_Application


Constructor & Destructor Documentation

PG_MessageObject::PG_MessageObject  ) 
 

Creates a PG_MessageObject.

virtual PG_MessageObject::~PG_MessageObject  )  [virtual]
 

Destroys a PG_MessageObject and removes it from the global object list.


Member Function Documentation

virtual bool PG_MessageObject::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 PG_Widget.

void PG_MessageObject::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

virtual bool PG_MessageObject::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.

virtual void PG_MessageObject::eventIdle  )  [protected, virtual]
 

virtual void PG_MessageObject::eventInputFocusLost PG_MessageObject newfocus  )  [protected, virtual]
 

Reimplemented in PG_LineEdit.

virtual bool PG_MessageObject::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 PG_Application, PG_LineEdit, and PG_PopupMenu.

virtual bool PG_MessageObject::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 PG_Application.

virtual bool PG_MessageObject::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 PG_Button, PG_ListBox, PG_MaskEdit, PG_PopupMenu, PG_ScrollBar, PG_WidgetDnD, and PG_Window.

virtual bool PG_MessageObject::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 PG_Button, PG_CheckButton, PG_LineEdit, PG_ListBox, PG_ListBoxBaseItem, PG_PopupMenu, PG_RadioButton, PG_ScrollBar, PG_Slider, PG_WidgetDnD, and PG_Window.

virtual bool PG_MessageObject::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 PG_ListBox, PG_PopupMenu, PG_ScrollBar, PG_WidgetDnD, and PG_Window.

virtual bool PG_MessageObject::eventQuit int  id,
PG_MessageObject 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:
id id of the sending widget
widget pointer to the widget
data event specific data
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 PG_Application.

virtual bool PG_MessageObject::eventQuitModal int  id,
PG_MessageObject widget,
unsigned long  data
[protected, virtual]
 

Overridable Eventhandler for a MSG_QUITMODAL message.

The default implementation returns 'false' which indicates that this message is not processed by this object.

Parameters:
id id of the sending widget
widget pointer to the widget
data event specific data
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 PG_Widget.

virtual bool PG_MessageObject::eventResize const SDL_ResizeEvent *  event  )  [protected, virtual]
 

Overridable Eventhandler for a SDL_ResizeEvent message.

The default implementation returns 'false' which indicates that this message is not processed by this object.

Parameters:
event SDL_ResizeEvent 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 PG_Application.

virtual bool PG_MessageObject::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.

PG_MessageObject* PG_MessageObject::GetCapture  ) 
 

Return the current capture object.

bool PG_MessageObject::IsEnabled  ) 
 

Check if the object can receive messages.

Returns:
true/false returns true when the object can receive messages or false if not.

virtual bool PG_MessageObject::ProcessEvent const SDL_Event *  event  )  [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.

bool PG_MessageObject::PumpIntoEventQueue const SDL_Event *  event  )  [static]
 

Sends an event to the global message queue.

Parameters:
event SDL_Event message
Returns:
true - the message was processed by the framework
Examples:
dblbuffer.cpp.

void PG_MessageObject::ReleaseCapture  ) 
 

Releases a previous capture.

void PG_MessageObject::ReleaseInputFocus  ) 
 

Release the inputfocus.

PG_MessageObject* PG_MessageObject::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.

PG_MessageObject* PG_MessageObject::SetInputFocus  ) 
 

Set an inputfocus for this object.

Returns:
pointer to the object that had the inputfocus till now If the inputfocus is set all key events will be sent to this object

void PG_MessageObject::TranslateNumpadKeys SDL_KeyboardEvent *  key  ) 
 

Translates numeric keypad keys into other keys in dependency of NUM_LOCK state.

Should be called in eventKeyDown() for proper numeric keypad behaviour.

Parameters:
key SDL_KeyboardEvent* key to translate

SDL_Event PG_MessageObject::WaitEvent Uint32  delay = 0  )  [static]
 


Friends And Related Function Documentation

friend class PG_Application [friend]
 


Member Data Documentation

PG_MessageObject* PG_MessageObject::captureObject [static, protected]
 

bool PG_MessageObject::my_quitEventLoop [static, protected]
 

vector<PG_MessageObject*> PG_MessageObject::objectList [static, protected]
 

SignalAppIdle PG_MessageObject::sigAppIdle
 



The ParaGUI Project - Alexander Pipelka