Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

os::Handler Class Reference

#include <handler.h>

Inheritance diagram for os::Handler::

os::Looper os::View os::Application os::Window os_priv::DirKeeper os::AlertView os::Control os::DropdownMenu os::LayoutView os::ListViewCol os::ListViewContainer os::ListViewHeader os::Menu os::ProgressBar os::ProgressView os::StringView os::TableView os::TabView os::TextEdit TopView List of all members.

Public Methods

 Handler (const std::string &cName)
 Construct a handler. More...

virtual ~Handler ()
 Destructor. More...

virtual void TimerTick (int nID)
 Timer dispatch member. More...

virtual void HandleMessage (Message *pcMessage)
 Handle a message targeted at this handler. More...

std::string GetName () const
 Get the loopers name. More...

void SetName (const std::string &cName)
 Rename the handler. More...

LooperGetLooper () const
 Get a pointer to the looper this handler belongs to. More...

void SetNextHandler (Handler *pcNextHandler)
 Set a handler that should handle messages this handler is not interrested in. More...

Handler * GetNextHandler () const
 Get the next handler in a handler chain. More...

void AddFilter (MessageFilter *pcFilter)
void RemoveFilter (MessageFilter *pcFilter)
const MsgFilterListGetFilterList () const

Friends

class Looper
class Message
class Messenger
class NodeMonitor
class Window

Constructor & Destructor Documentation

Handler::Handler const std::string & cName
 

Description:
Initialize the handler and give it a name. The name does not need to be unique unless you want to be able to look it up with os::Looper::FindHandler()
Parameters:
cName   A name identifying the handler. This can be passed to os::Looper::FindHandler() on a looper to find the handler object when it have been added to the looper with os::Looper::AddHandler().
Author:
Kurt Skauen ([email protected])

Handler::~Handler [virtual]
 

Description:
Free all resources allocated by the handler. If the handler is member of a looper it will detach itself from the looper and delete all message filters associated with the handler.
Author:
Kurt Skauen ([email protected])


Member Function Documentation

void Handler::AddFilter MessageFilter * pcFilter
 

const MsgFilterList & Handler::GetFilterList const
 

Looper * Handler::GetLooper const
 

Description:
GetLooper() returns a pointer to the looper this handler have been added to with os::Looper::AddHandler(). If the handler has not been added to any looper NULL will be returned.

If this is called on a os::Looper object (os::Looper is a subclass of os::Handler) this member will always return a pointer to itself.

Returns:
Pointer to the looper this handler is a member to or NULL if it have not yet been added to a looper.
See also:
os::Looper::AddHandler()
Author:
Kurt Skauen ([email protected])

std::string Handler::GetName const
 

Description:
Get the name assigned to the handler in the constructor or with the SetName() member.
Returns:
The current name of the handler.
See also:
SetName(), os::Looper::FindHandler()
Author:
Kurt Skauen ([email protected])

Reimplemented in os::Looper.

Handler * Handler::GetNextHandler const
 

Description:
Get the next handler in a handler chain (as set with SetNextHandler()).
Returns:
Pointer to the next handler in the handler chain or NULL if no "next" handler is set.
See also:
SetNextHandler(), HandleMessage()
Author:
Kurt Skauen ([email protected])

void Handler::HandleMessage Message * pcMessage [virtual]
 

Description:
Overload this member to dispatch messages sendt to this handler. When a looper receives a message for one of it's handlers it will call the taget handlers HandleMessage() to allow the handler to dispatch the message.

The message passed in pcMessage is also available through os::Looper::GetCurrentMessage() and os::Looper::DetachCurrentMessage() until this member returns. This is normally not very usefull for HandleMessage() itself but it can be convinient for other members called from HandleMessage() in case they need data from the message that was not passed on from HandleMessage().

The looper will be locked when this member is called. The default implementation of this member will pass the message on to the next handler if one was set with SetNextHandler().

Note:
Never do any lenthy operations in any hook members that are called from the looper thread if the looper is involved with the GUI (for example if the looper is a os::Window). The looper will not be able to dispatch messages until the hook returns so spending a long time in this members will make the GUI feel unresponsive.
Parameters:
pcMessage   The message that should be handled. This message will be deleted by the looper when HandleMessage() returns unless you detach it with os::Looper::DetachCurrentMessage(),
See also:
os::Looper::DispatchMessage(), os::Looper::DetachCurrentMessage()
Author:
Kurt Skauen ([email protected])

Reimplemented in os_priv::DirKeeper, os::Application, os::DirectoryView, os::DropdownMenu, os::FileRequester, os::Alert, os::ProgressRequester, and os::Spinner.

void Handler::RemoveFilter MessageFilter * pcFilter
 

void Handler::SetName const std::string & cName
 

Description:
Rename the handler
Parameters:
cName   The new handler name.
See also:
GetName(), os::Looper::FindHandler()
Author:
Kurt Skauen ([email protected])

Reimplemented in os::Looper.

void Handler::SetNextHandler Handler * pcNextHandler
 

Description:
The default implementation of HandleMessage() will check if there is set an alternative handler through SetNextHandler() and if so the message will be forwarded to this handler.
Parameters:
pcNextHandler   Pointer to the handler that should receive messages after we are done with them or NULL to disable the forwarding.
See also:
GetNextHandler(), HandleMessage()
Author:
Kurt Skauen ([email protected])

void Handler::TimerTick int nID [virtual]
 

Description:
This member will be called by the looper thread when a timer targeting this handler expires.

When a timer created with os::Looper::AddTimer() expires the looper thread will lock the looper and call this member on the target for the expired timer. If more than one timers are created it is possible to distinguish them by the timer ID that is assigned to the timer with os::Looper::AddTimer() and that is passed to TimerTick() through the nID parameter.

Note:
Never do any lenthy operations in any hook members that are called from the looper thread if the looper is involved with the GUI (for example if the looper is a os::Window). The looper will not be able to dispatch messages until the hook returns so spending a long time in this members will make the GUI feel unresponsive.
Warning:
Parameters:
return  
Error codes:
See also:
Author:
Kurt Skauen ([email protected])

Reimplemented in os::Menu, and os::ScrollBar.


Friends And Related Function Documentation

friend class Looper [friend]
 

friend class Message [friend]
 

friend class Messenger [friend]
 

Reimplemented in os::Looper.

friend class NodeMonitor [friend]
 

Reimplemented in os::Looper.

friend class Window [friend]
 

Reimplemented in os::Application, os::Looper, and os::View.


Generated at Tue Sep 11 15:27:48 2001 for AtheOS higlevel API by doxygen1.2.9.1 written by Dimitri van Heesch, © 1997-2001