summaryrefslogtreecommitdiff
path: root/src/control.cpp
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2005-03-28 01:42:58 +0000
committerIan C <ianc@noddybox.co.uk>2005-03-28 01:42:58 +0000
commit82f1d860690dc0a2d0210db12344f7ea5e88b6a4 (patch)
tree517481a81e64cc70b5187ce6eeb20d8fa326fa54 /src/control.cpp
parent4f54380eb1f7574bf9cc147cb8870508da09e10c (diff)
Added ComboBox. Also improved callback filtering and made controls auto register themselves.
Diffstat (limited to 'src/control.cpp')
-rw-r--r--src/control.cpp31
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);
}