/* wm_listener.h: Windows event listener callback interface. Copyright 2002 Red Hat, Inc. Written by Philip Aston This file is part of Cygwin. This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ #ifndef __WM_LISTENER_H__ #define __WM_LISTENER_H__ #include #include class wm_listener { protected: virtual ~wm_listener() {}; public: virtual void wm_event (UINT uMsg, WPARAM wParam, LPARAM lParam) = 0; }; /* Non-intrusive, thread-safe list of wm_listeners. */ class wm_listener_list { struct node { wm_listener& m_listener; node* const m_next; node (wm_listener& listener, node* next) : m_listener (listener), m_next (next) {} }; node* m_head; pthread_mutex_t m_mutex; public: wm_listener_list (); void add (wm_listener& l); void wm_event (UINT uMsg, WPARAM wParam, LPARAM lParam); }; #endif /*__WM_LISTENER_H__*/