Core: Win32 DHCtrl accelerator support

git-svn-id: svn://ultimatepp.org/upp/trunk@9887 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2016-05-27 13:39:54 +00:00
parent 4556bd6352
commit 17d6ec8c4a
4 changed files with 49 additions and 3 deletions

View file

@ -6,14 +6,41 @@ NAMESPACE_UPP
#ifndef PLATFORM_WINCE
Vector<DHCtrl *> DHCtrl::all_active;
void DHCtrl::RemoveActive()
{
for(;;) {
int q = FindIndex(all_active, this);
if(q < 0)
return;
all_active.Remove(q);
}
}
bool DHCtrl::PreprocessMessageAll(MSG& msg)
{
for(auto q : all_active)
if(q->PreprocessMessage(msg))
return true;
return false;
}
bool DHCtrl::PreprocessMessage(MSG& msg)
{
return false;
}
void DHCtrl::NcCreate(HWND _hwnd)
{
hwnd = _hwnd;
all_active.Add(this);
}
void DHCtrl::NcDestroy()
{
hwnd = NULL;
RemoveActive();
}
LRESULT DHCtrl::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
@ -28,6 +55,7 @@ void DHCtrl::CloseHWND()
if(hwnd) {
DestroyWindow(hwnd);
hwnd = NULL;
RemoveActive();
}
}
@ -80,6 +108,7 @@ DHCtrl::~DHCtrl()
{
CloseHWND();
BackPaint(EXCLUDEPAINT);
RemoveActive();
}
#endif

View file

@ -57,6 +57,7 @@ public:
virtual void NcDestroy();
virtual void PreDestroy();
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
virtual bool PreprocessMessage(MSG& msg);
HWND GetHWND() const { return parent ? NULL : top ? top->hwnd : NULL; }
HWND GetOwnerHWND() const;

View file

@ -79,11 +79,20 @@ public:
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
virtual void NcCreate(HWND hwnd);
virtual void NcDestroy();
virtual bool PreprocessMessage(MSG& msg);
private:
void OpenHWND();
void SyncHWND();
void RemoveActive();
static Vector<DHCtrl *> all_active;
static bool PreprocessMessageAll(MSG& msg);
friend class Ctrl;
protected:
void CloseHWND();
HWND hwnd;

View file

@ -611,6 +611,11 @@ void Ctrl::NcDestroy()
WndFree();
}
bool Ctrl::PreprocessMessage(MSG& msg)
{
return false;
}
LRESULT CALLBACK Ctrl::WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
GuiLock __;
@ -747,9 +752,11 @@ void Ctrl::sProcessMSG(MSG& msg)
Ctrl::hotkey[(int)msg.wParam]();
return;
}
if(msg.message != WM_SYSKEYDOWN && msg.message != WM_SYSKEYUP
|| PassWindowsKey((dword)msg.wParam) || msg.wParam == VK_MENU) //17.11 Mirek - fix to get windows menu invoked on Alt+Space
TranslateMessage(&msg); // 04/09/07: TRC fix to make barcode reader going better
if(!DHCtrl::PreprocessMessageAll(msg))
if(msg.message != WM_SYSKEYDOWN && msg.message != WM_SYSKEYUP
|| PassWindowsKey((dword)msg.wParam) || msg.wParam == VK_MENU) //17.11 Mirek - fix to get windows menu invoked on Alt+Space
TranslateMessage(&msg); // 04/09/07: TRC fix to make barcode reader going better
#if 0
DDUMP(msg.hwnd);