From 5a11b5f4b59c46e919989a0fdd05d81ba5ac9347 Mon Sep 17 00:00:00 2001 From: Ian C Date: Thu, 24 Mar 2005 00:07:40 +0000 Subject: Code updates --- src/control.cpp | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) (limited to 'src/control.cpp') diff --git a/src/control.cpp b/src/control.cpp index abcf8fb..b824cca 100644 --- a/src/control.cpp +++ b/src/control.cpp @@ -18,8 +18,6 @@ // // ------------------------------------------------------------------------- // -// $Log$ -// #include "w32dlib/control.h" #include "w32dlib/dialog.h" @@ -83,12 +81,11 @@ BOOL Control::ProcessMessage(UINT msg, WPARAM wp, LPARAM lp) { if (m_cblist.count(msg)>0) { - W32DLibCallback cb=m_cblist[msg]; + CallbackDetails details=m_cblist[msg]; + W32DLibCallbackInterface *owner=details.owner; + W32DLibCallback cb=details.cb; - if (cb) - { - return cb(msg,wp,lp); - } + return (owner->*cb)(msg,wp,lp); } return false; @@ -97,19 +94,15 @@ BOOL Control::ProcessMessage(UINT msg, WPARAM wp, LPARAM lp) // ------------------------------------------------------------ // -void Control::AddCallback(UINT msg, W32DLibCallback callback) +void Control::AddCallback(UINT msg, + W32DLibCallbackInterface *owner, + W32DLibCallback callback) { - if (callback) - { - m_cblist[msg]=callback; - } - else - { - if (m_cblist.count(msg)) - { - m_cblist.remove(msg); - } - } + CallbackDetails details; + + details.owner=owner; + details.cb=callback; + m_cblist[msg]=details; } -- cgit v1.2.3