Pyro higlevel API
Public Member Functions | Friends | List of all members
os::Handler Class Reference
Inheritance diagram for os::Handler:
os::Looper os::View os::Application os::RegistrarManager os::Window os_priv::DirKeeper os::CalendarView::DayView os::CalendarView::DOWView os::DropdownMenu::DropdownView os::IconView::MainView os::AlertView os::CalendarView 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::ToolTipView os_priv::SplitterSeparator SplashView TopView

Public Member Functions

 Handler (const 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...
 
String GetName () const
 Get the handlers name. More...
 
void SetName (const 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...
 
HandlerGetNextHandler () const
 Get the next handler in a handler chain. More...
 
void AddFilter (MessageFilter *pcFilter)
 
void RemoveFilter (MessageFilter *pcFilter)
 
const MsgFilterListGetFilterList () const
 
const uint32 GetToken ()
 Get the handlers token. More...
 

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
cNameA 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 (kurt@.nosp@m.athe.nosp@m.os.cx)
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 (kurt@.nosp@m.athe.nosp@m.os.cx)

References os::Looper::RemoveHandler().

Member Function Documentation

void Handler::AddFilter ( MessageFilter pcFilter)

References RemoveFilter().

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 (kurt@.nosp@m.athe.nosp@m.os.cx)

Referenced by os::IconDirectoryView::KeyDown(), os::Messenger::Messenger(), os::ScrollBar::MouseDown(), os::ScrollBar::MouseMove(), os::ScrollBar::MouseUp(), os::Event::PostEvent(), os::Looper::PostMessage(), os::Event::Register(), os::IconDirectoryView::ReRead(), os::Messenger::SendMessage(), os::Message::SendReply(), os::Event::SetMonitorEnabled(), os::IconView::StartScroll(), os::IconView::StopScroll(), os::ScrollBar::TimerTick(), and os::Event::~Event().

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 (kurt@.nosp@m.athe.nosp@m.os.cx)

Referenced by os::LayoutNode::AddChild(), and os::StatusBar::SetText().

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 (kurt@.nosp@m.athe.nosp@m.os.cx)
const uint32 Handler::GetToken ( )
Description:
Get the token assigned to the handler.
Returns
The token of the handler.
Author
Arno Klenke (arno_.nosp@m.klen.nosp@m.ke@ya.nosp@m.hoo..nosp@m.de)

Referenced by os::Event::Register(), and os::Event::SetMonitorEnabled().

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
pcMessageThe 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 (kurt@.nosp@m.athe.nosp@m.os.cx)

Reimplemented in HandlerSelector, InfoWin, MountDialogWin, os::ProgressRequester, os::RegistrarManager, RenameFileWin, NewDirWin, os::DirectoryView, os::FontRequester, os::IconDirectoryView, os::Alert, os_priv::DirKeeper, os::InputBox, os::Application, os::DropdownMenu, os::Spinner, os::ColorRequester, os::FileRequester, os::DropdownMenu::DropdownView, os::ColorSelector, os::CalendarView, and os::DateView.

References os::Looper::PostMessage().

Referenced by os::Looper::DispatchMessage(), os::FileRequester::HandleMessage(), os::ColorRequester::HandleMessage(), os::Spinner::HandleMessage(), os::DropdownMenu::HandleMessage(), os::Application::HandleMessage(), os::InputBox::HandleMessage(), os::Alert::HandleMessage(), os::IconDirectoryView::HandleMessage(), NewDirWin::HandleMessage(), RenameFileWin::HandleMessage(), os::RegistrarManager::HandleMessage(), os::ProgressRequester::HandleMessage(), MountDialogWin::HandleMessage(), InfoWin::HandleMessage(), and HandlerSelector::HandleMessage().

void Handler::RemoveFilter ( MessageFilter pcFilter)
void Handler::SetName ( const String cName)
Description:
Rename the handler
Parameters
cNameThe new handler name.
See Also
GetName(), os::Looper::FindHandler()
Author
Kurt Skauen (kurt@.nosp@m.athe.nosp@m.os.cx)
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
pcNextHandlerPointer 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 (kurt@.nosp@m.athe.nosp@m.os.cx)
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 (kurt@.nosp@m.athe.nosp@m.os.cx)

Reimplemented in os::IconView::MainView, os::Menu, os::ScrollBar, and os::ToolTip.

Referenced by os::ScrollBar::TimerTick().

Friends And Related Function Documentation

friend class Looper
friend
friend class Message
friend
friend class Messenger
friend
friend class NodeMonitor
friend
friend class Window
friend