diff options
Diffstat (limited to 'src/control.cpp')
-rw-r--r-- | src/control.cpp | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/src/control.cpp b/src/control.cpp index 75f96a1..a8a221f 100644 --- a/src/control.cpp +++ b/src/control.cpp @@ -34,6 +34,7 @@ Control::Control(Dialog *parent, int resource_id) : m_resid(resource_id), m_cblist() { + m_parent->AddControl(this); } @@ -59,32 +60,46 @@ BOOL Control::ProcessMessage(UINT msg, WPARAM wp, LPARAM lp) if (msg==WM_INITDIALOG) { m_wnd=GetDlgItem(m_parent->GetHWND(),m_resid); + W32DEBUGOUT("Got HWND " << m_wnd << " for " << m_resid); } - if (m_cblist.count(msg)>0) - { - CallbackDetails details=m_cblist[msg]; - Window *owner=details.owner; - W32DLibCallback cb=details.cb; + WORD hi=HIWORD(wp); + CallbackList::const_iterator i; - return (owner->*cb)(msg,wp,lp); + for(i=m_cblist.begin();i!=m_cblist.end();++i) + { + CallbackDetails details=*i; + + if (details.msg==msg) + { + if (details.notif==0 || details.notif==hi) + { + Window *owner=details.owner; + W32DLibCallback cb=details.cb; + + return (owner->*cb)(msg,wp,lp); + } + } } - return false; + return FALSE; } // ------------------------------------------------------------ // void Control::AddCallback(UINT msg, + UINT notification, Window *owner, W32DLibCallback callback) { CallbackDetails details; + details.msg=msg; + details.notif=notification; details.owner=owner; details.cb=callback; - m_cblist[msg]=details; + m_cblist.push_back(details); } |