summaryrefslogtreecommitdiff
path: root/src/dialog.cpp
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2005-04-02 01:53:30 +0000
committerIan C <ianc@noddybox.co.uk>2005-04-02 01:53:30 +0000
commit98164e7547f7ea21204e69885158cd0494e08c5d (patch)
tree24d0957da8fb5fd68481e10d442cfbb534ff4494 /src/dialog.cpp
parenteffc648f262bd3bd7b57d4e76db2f768510be55c (diff)
Added simple support for dialog menus
Diffstat (limited to 'src/dialog.cpp')
-rw-r--r--src/dialog.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/dialog.cpp b/src/dialog.cpp
index 512dbdd..7a26a16 100644
--- a/src/dialog.cpp
+++ b/src/dialog.cpp
@@ -28,6 +28,7 @@ namespace W32DLib
// ------------------------------------------------------------
//
Dialog::Dialog() : Window()
+ , m_menuowner(0)
{
}
@@ -94,11 +95,21 @@ void Dialog::AddControl(Control *control)
// ------------------------------------------------------------
//
+void Dialog::SetMenuProc(Window *owner, W32DLibCallback callback)
+{
+ m_menuowner=owner;
+ m_menuproc=callback;
+}
+
+
+// ------------------------------------------------------------
+//
BOOL Dialog::InstanceProc(HWND wnd, UINT msg, WPARAM wp, LPARAM lp)
{
BOOL ret=FALSE;
WORD lo=LOWORD(wp);
+ bool handled=false;
switch(msg)
{
@@ -127,7 +138,7 @@ BOOL Dialog::InstanceProc(HWND wnd, UINT msg, WPARAM wp, LPARAM lp)
ret=Window::InstanceProc(wnd,msg,wp,lp);
break;
- // Messages passed onto controls
+ // Messages passed onto menus and controls
//
case WM_COMMAND:
// Check for windows and resources in the wp
@@ -141,9 +152,20 @@ BOOL Dialog::InstanceProc(HWND wnd, UINT msg, WPARAM wp, LPARAM lp)
" for resource " << (*i)->ResourceID());
ret=(*i)->ProcessMessage(msg,wp,lp);
+ handled=true;
break;
}
}
+
+ if (!handled && m_menuowner)
+ {
+ W32DEBUGOUT(MsgName(msg) << " (" << msg <<
+ ", " << wp << ", " << lp << ")" <<
+ " passed onto MenuProc");
+
+ ret=(m_menuowner->*m_menuproc)(msg,wp,lp);
+ }
+
break;
default: