applied patch #1871856 - nsDialogs: support for keyboard cues for link control
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@5482 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
26d527f8e4
commit
ae3e2cff89
1 changed files with 22 additions and 4 deletions
|
@ -5,6 +5,14 @@
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "rtl.h"
|
#include "rtl.h"
|
||||||
|
|
||||||
|
#ifndef ODS_NOACCEL
|
||||||
|
#define ODS_NOACCEL 0x0100
|
||||||
|
#define ODS_NOFOCUSRECT 0x0200
|
||||||
|
#endif
|
||||||
|
#ifndef DT_HIDEPREFIX
|
||||||
|
#define DT_HIDEPREFIX 0x00100000
|
||||||
|
#endif
|
||||||
|
|
||||||
HINSTANCE g_hInstance;
|
HINSTANCE g_hInstance;
|
||||||
struct nsDialog g_dialog;
|
struct nsDialog g_dialog;
|
||||||
extra_parameters* g_pluginParms;
|
extra_parameters* g_pluginParms;
|
||||||
|
@ -115,6 +123,13 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
RECT rc;
|
RECT rc;
|
||||||
char text[1024];
|
char text[1024];
|
||||||
|
|
||||||
|
// http://blogs.msdn.com/oldnewthing/archive/2005/05/03/414317.aspx#414357
|
||||||
|
// says we should call SystemParametersInfo(SPI_GETKEYBOARDCUES,...) to make
|
||||||
|
// sure, does not seem to be required, might be a win2k bug, or it might
|
||||||
|
// only apply to menus
|
||||||
|
BOOL hideFocus = (lpdis->itemState & ODS_NOFOCUSRECT);
|
||||||
|
BOOL hideAccel = (lpdis->itemState & ODS_NOACCEL);
|
||||||
|
|
||||||
struct nsControl* ctl = GetControl(lpdis->hwndItem);
|
struct nsControl* ctl = GetControl(lpdis->hwndItem);
|
||||||
if (ctl == NULL)
|
if (ctl == NULL)
|
||||||
break;
|
break;
|
||||||
|
@ -141,20 +156,23 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
if (lpdis->itemAction & ODA_DRAWENTIRE)
|
if (lpdis->itemAction & ODA_DRAWENTIRE)
|
||||||
{
|
{
|
||||||
|
DWORD xtraDrawStyle = (g_dialog.rtl ? DT_RTLREADING : 0);
|
||||||
|
if (hideAccel)
|
||||||
|
xtraDrawStyle |= DT_HIDEPREFIX;
|
||||||
|
|
||||||
// Get TxtColor unless the user has set another using SetCtlColors
|
// Get TxtColor unless the user has set another using SetCtlColors
|
||||||
if (!GetWindowLong(lpdis->hwndItem, GWL_USERDATA))
|
if (!GetWindowLong(lpdis->hwndItem, GWL_USERDATA))
|
||||||
SetTextColor(lpdis->hDC, RGB(0,0,255));
|
SetTextColor(lpdis->hDC, RGB(0,0,255));
|
||||||
|
|
||||||
// Draw the text
|
// Draw the text
|
||||||
DrawText(lpdis->hDC, text, -1, &rc, DT_CENTER | DT_VCENTER | DT_WORDBREAK | (g_dialog.rtl ? DT_RTLREADING : 0));
|
DrawText(lpdis->hDC, text, -1, &rc, xtraDrawStyle | DT_CENTER | DT_VCENTER | DT_WORDBREAK);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the focus rect if needed
|
// Draw the focus rect if needed
|
||||||
if (((lpdis->itemState & ODS_FOCUS) && (lpdis->itemAction & ODA_DRAWENTIRE)) || (lpdis->itemAction & ODA_FOCUS))
|
if (((lpdis->itemState & ODS_FOCUS) && (lpdis->itemAction & ODA_DRAWENTIRE)) || (lpdis->itemAction & ODA_FOCUS))
|
||||||
{
|
{
|
||||||
// NB: when not in DRAWENTIRE mode, this will actually toggle the focus
|
if (!hideFocus)
|
||||||
// rectangle since it's drawn in a XOR way
|
DrawFocusRect(lpdis->hDC, &rc);
|
||||||
DrawFocusRect(lpdis->hDC, &rc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue