Sowl  1.0
Simple Object Window Library
sowl::MessageLoop Class Reference

Encapsulates a generic message loop. More...

#include <MessageLoop.h>

Public Member Functions

virtual int Run ()
 Implements a generic message loop following a "template method pattern". Variant parts (GetMessage, HandleErrorAndExit, ProcessMessage) are implemented as virtual methods, so they can be overriden on inherited classes. More...
 
virtual int GetMessage (MSG &message)
 Encapsulates a call to ::GetMessage without filters. More...
 
virtual bool HandleErrorAndExit ()
 Default implementation for handling errors. Do nothing and returns 'false'. More...
 
virtual void ProcessMessage (MSG &message)
 Default implementation of message processing. Calls TranslateMessage and DispatchMessage. More...
 

Detailed Description

Encapsulates a generic message loop.

Member Function Documentation

int MessageLoop::GetMessage ( MSG &  message)
virtual

Encapsulates a call to ::GetMessage without filters.

Parameters
messageReceive information about the message retrieved.
Returns
If the call was successful, returns 1. If it fails, return -1. If loop must ends, returns 0.
bool MessageLoop::HandleErrorAndExit ( )
virtual

Default implementation for handling errors. Do nothing and returns 'false'.

Returns
Indicates if the loop must exist: 'true' for exit. 'false' for continue.
void MessageLoop::ProcessMessage ( MSG &  message)
virtual

Default implementation of message processing. Calls TranslateMessage and DispatchMessage.

Parameters
messageInformation about the message to be processing.
int MessageLoop::Run ( )
virtual

Implements a generic message loop following a "template method pattern". Variant parts (GetMessage, HandleErrorAndExit, ProcessMessage) are implemented as virtual methods, so they can be overriden on inherited classes.

Returns
Exit code of the loop that comes from a call to ::PostQuitMessage.

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