os::Handler Class Reference

Inheritance diagram for os::Handler:

os::Looper os::View os::Application os::RegistrarManager os::Window os_priv::DirKeeper os::DropdownMenu::DropdownView os::IconView::MainView os::AlertView os::Control os::DropdownMenu os::ImageView os::LayoutView os::ListViewCol os::ListViewContainer os::ListViewHeader os::Menu os::PopupMenu os::ProgressView os::Separator os::Splitter os::StringView os::TableView os::TabView os::TextEdit os_priv::SplitterSeparator TopView List of all members.

Public Member Functions

 Handler (const String &cName)
 Construct a handler.
virtual ~Handler ()
 Destructor.
virtual void TimerTick (int nID)
 Timer dispatch member.
virtual void HandleMessage (Message *pcMessage)
 Handle a message targeted at this handler.
String GetName () const
 Get the handlers name.
void SetName (const String &cName)
 Rename the handler.
LooperGetLooper () const
 Get a pointer to the looper this handler belongs to.
void SetNextHandler (Handler *pcNextHandler)
 Set a handler that should handle messages this handler is not interrested in.
HandlerGetNextHandler () const
 Get the next handler in a handler chain.
void AddFilter (MessageFilter *pcFilter)
void RemoveFilter (MessageFilter *pcFilter)
const MsgFilterListGetFilterList () const
const uint32 GetToken ()
 Get the handlers token.

Friends

class Looper
class Message
class Messenger
class NodeMonitor
class Window

Constructor & Destructor Documentation

Handler::Handler ( const 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::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::IconView::MainView, os::Menu, and os::ScrollBar.

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::DropdownMenu::DropdownView, os_priv::DirKeeper, NewDirWin, InfoWin, RenameFileWin, HandlerSelector, MountDialogWin, os::Application, os::ColorRequester, os::ColorSelector, os::DirectoryView, os::DropdownMenu, os::FileRequester, os::FontRequester, os::IconDirectoryView, os::InputBox, os::Alert, os::ProgressRequester, os::Spinner, and os::RegistrarManager.

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.

void Handler::SetName ( const 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.

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])

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])

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::AddFilter ( MessageFilter pcFilter  ) 

void Handler::RemoveFilter ( MessageFilter pcFilter  ) 

const MsgFilterList & Handler::GetFilterList (  )  const

const uint32 Handler::GetToken (  ) 

Description:
Get the token assigned to the handler.
Returns:
The token of the handler.
Author:
Arno Klenke ([email protected])


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 on Sat May 9 22:51:09 2009 for Syllable higlevel API by  doxygen 1.5.1