SendMessage(g_Globals._hwndShellView, nmsg, wparam, lparam);
break;
+ case PM_TRANSLATE_MSG:
+ {
+ /* TranslateAccelerator is called for all explorer windows that are open
+ so we have to decide if this is the correct recipient */
+ LPMSG lpmsg = (LPMSG)lparam;
+ HWND hwnd = lpmsg->hwnd;
+
+ while(hwnd)
+ {
+ if(hwnd == _hwnd)
+ break;
+
+ hwnd = GetParent(hwnd);
+ }
+
+ if (hwnd)
+ return _pShellView->TranslateAccelerator(lpmsg) == S_OK;
+ return false;
+ }
+
default: def:
return super::WndProc(nmsg, wparam, lparam);
}
/// Implementation of the Explorer desktop window
-struct DesktopWindow : public Window, public IShellBrowserImpl
+struct DesktopWindow : public PreTranslateWindow, public IShellBrowserImpl
{
- typedef Window super;
+ typedef PreTranslateWindow super;
DesktopWindow(HWND hwnd);
~DesktopWindow();
return false;
}
+bool ShellBrowser::TranslateAccelerator(LPMSG lpmsg)
+{
+ HWND hwnd;
+
+ /* TranslateAccelerator is called for all explorer windows that are open
+ so we have to decide if this is the correct recipient */
+ hwnd = lpmsg->hwnd;
+
+ while(hwnd)
+ {
+ if(hwnd == _hwnd)
+ break;
+
+ hwnd = GetParent(hwnd);
+ }
+
+ if (hwnd)
+ return _pShellView->TranslateAccelerator(lpmsg) == S_OK;
+
+ return false;
+}
bool ShellBrowser::select_folder(Entry* entry, bool expand)
{
SendMessage(_right_hwnd, WM_SYSCOLORCHANGE, 0, 0);
break;
+ case PM_TRANSLATE_MSG:
+ return _shellBrowser->TranslateAccelerator((MSG*)lparam);
+
default:
return super::WndProc(nmsg, wparam, lparam);
}
void invalidate_cache();
+ bool TranslateAccelerator(LPMSG lpmsg);
+
protected:
HWND _hwnd;
HWND _hwndFrame;
BOOL Window::pretranslate_msg(LPMSG pmsg)
{
+ if ((pmsg->message != WM_KEYDOWN) &&
+ (pmsg->message != WM_SYSKEYDOWN) &&
+ (pmsg->message != WM_SYSCHAR) &&
+ (pmsg->message != WM_CHAR))
+ {
+ return FALSE;
+ }
+
for(WindowSet::const_iterator it=Window::s_pretranslate_windows.begin(); it!=s_pretranslate_windows.end(); ++it)
if (SendMessage(*it, PM_TRANSLATE_MSG, 0, (LPARAM)pmsg))
return TRUE;
#define Frame_GetMenuInfo(hwnd) ((MenuInfo*)SNDMSG(hwnd, PM_FRM_GET_MENUINFO, 0, 0))
+ /**
+ PreTranslateWindow is used to register windows to be called by Window::pretranslate_msg().
+ This way you get PM_TRANSLATE_MSG messages before the message loop dispatches messages.
+ You can then for example use TranslateAccelerator() to implement key shortcuts.
+ */
+struct PreTranslateWindow : public Window
+{
+ typedef Window super;
+
+ PreTranslateWindow(HWND);
+ ~PreTranslateWindow();
+};
+
+
+
/**
Class ChildWindow represents MDI child windows.
It is used with class MainFrame.
*/
-struct ChildWindow : public Window
+struct ChildWindow : public PreTranslateWindow
{
- typedef Window super;
+ typedef PreTranslateWindow super;
ChildWindow(HWND hwnd, const ChildWndInfo& info);
#define PM_SETSTATUSTEXT (WM_APP+0x1E)
- /**
- PreTranslateWindow is used to register windows to be called by Window::pretranslate_msg().
- This way you get PM_TRANSLATE_MSG messages before the message loop dispatches messages.
- You can then for example use TranslateAccelerator() to implement key shortcuts.
- */
-struct PreTranslateWindow : public Window
-{
- typedef Window super;
-
- PreTranslateWindow(HWND);
- ~PreTranslateWindow();
-};
-
-
/**
The class DialogWindow implements modeless dialogs, which are managed by
Window::dispatch_dialog_msg() in Window::MessageLoop().