mirror of
https://github.com/reactos/reactos.git
synced 2024-08-12 14:16:30 +00:00
[explorer]
- Implement calling IShellView_TranslateAccelerator - Fixes accelerators like Ctrl+c , Ctrl+v, etc in windows svn path=/trunk/; revision=57671
This commit is contained in:
parent
e9d11b2672
commit
db13cd87ac
|
@ -479,6 +479,26 @@ LRESULT DesktopWindow::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
|
||||||
SendMessage(g_Globals._hwndShellView, nmsg, wparam, lparam);
|
SendMessage(g_Globals._hwndShellView, nmsg, wparam, lparam);
|
||||||
break;
|
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:
|
default: def:
|
||||||
return super::WndProc(nmsg, wparam, lparam);
|
return super::WndProc(nmsg, wparam, lparam);
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,9 +48,9 @@ protected:
|
||||||
|
|
||||||
|
|
||||||
/// Implementation of the Explorer desktop window
|
/// 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(HWND hwnd);
|
||||||
~DesktopWindow();
|
~DesktopWindow();
|
||||||
|
|
|
@ -599,6 +599,27 @@ bool ShellBrowser::jump_to_pidl(LPCITEMIDLIST pidl)
|
||||||
return false;
|
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)
|
bool ShellBrowser::select_folder(Entry* entry, bool expand)
|
||||||
{
|
{
|
||||||
|
@ -707,6 +728,9 @@ LRESULT MDIShellBrowserChild::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
|
||||||
SendMessage(_right_hwnd, WM_SYSCOLORCHANGE, 0, 0);
|
SendMessage(_right_hwnd, WM_SYSCOLORCHANGE, 0, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PM_TRANSLATE_MSG:
|
||||||
|
return _shellBrowser->TranslateAccelerator((MSG*)lparam);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return super::WndProc(nmsg, wparam, lparam);
|
return super::WndProc(nmsg, wparam, lparam);
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,6 +141,8 @@ struct ShellBrowser : public IShellBrowserImpl
|
||||||
|
|
||||||
void invalidate_cache();
|
void invalidate_cache();
|
||||||
|
|
||||||
|
bool TranslateAccelerator(LPMSG lpmsg);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
HWND _hwnd;
|
HWND _hwnd;
|
||||||
HWND _hwndFrame;
|
HWND _hwndFrame;
|
||||||
|
|
|
@ -591,6 +591,14 @@ void Window::unregister_pretranslate(HWND hwnd)
|
||||||
|
|
||||||
BOOL Window::pretranslate_msg(LPMSG pmsg)
|
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)
|
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))
|
if (SendMessage(*it, PM_TRANSLATE_MSG, 0, (LPARAM)pmsg))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -282,13 +282,28 @@ struct MenuInfo
|
||||||
#define Frame_GetMenuInfo(hwnd) ((MenuInfo*)SNDMSG(hwnd, PM_FRM_GET_MENUINFO, 0, 0))
|
#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.
|
Class ChildWindow represents MDI child windows.
|
||||||
It is used with class MainFrame.
|
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);
|
ChildWindow(HWND hwnd, const ChildWndInfo& info);
|
||||||
|
|
||||||
|
@ -325,20 +340,6 @@ protected:
|
||||||
#define PM_SETSTATUSTEXT (WM_APP+0x1E)
|
#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
|
The class DialogWindow implements modeless dialogs, which are managed by
|
||||||
Window::dispatch_dialog_msg() in Window::MessageLoop().
|
Window::dispatch_dialog_msg() in Window::MessageLoop().
|
||||||
|
|
Loading…
Reference in a new issue