Use the system link color on our custom link controls
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6589 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
113be9b813
commit
ab554ae939
4 changed files with 31 additions and 4 deletions
|
@ -209,6 +209,17 @@ void WINAPI mySetWindowText(HWND hWnd, LPCTSTR pszText)
|
|||
SetWindowText(hWnd, pszText);
|
||||
}
|
||||
|
||||
static COLORREF GetLinkColor()
|
||||
{
|
||||
COLORREF clr = GetSysColor(COLOR_HOTLIGHT);
|
||||
#ifndef _WIN64
|
||||
// COLOR_HOTLIGHT is Win98/2000+. GetSysColorBrush is the correct way to
|
||||
// detect valid colors but here we just assume nobody uses black.
|
||||
if (!clr) clr = RGB(0,0,255);
|
||||
#endif
|
||||
return clr;
|
||||
}
|
||||
|
||||
int CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp, LPARAM pData) {
|
||||
static TCHAR szDir[MAX_PATH];
|
||||
|
||||
|
@ -552,8 +563,8 @@ int WINAPI ReadSettings(void) {
|
|||
pField->nMinLength = myGetProfileInt(_T("MinLen"), 0);
|
||||
pField->nMaxLength = myGetProfileInt(_T("MaxLen"), 0);
|
||||
|
||||
// Text color for LINK control, default is pure blue
|
||||
pField->hImage = (HANDLE)myGetProfileInt(_T("TxtColor"), RGB(0,0,255));
|
||||
// Text color for LINK control, default is the system default link color
|
||||
pField->hImage = (HANDLE)myGetProfileInt(_T("TxtColor"), GetLinkColor());
|
||||
|
||||
pField->nControlID = 1200 + nIdx;
|
||||
if (pField->nType == FIELD_FILEREQUEST || pField->nType == FIELD_DIRREQUEST)
|
||||
|
|
|
@ -20,6 +20,17 @@ HINSTANCE g_hInstance;
|
|||
struct nsDialog g_dialog;
|
||||
extra_parameters* g_pluginParms;
|
||||
|
||||
static COLORREF GetLinkColor()
|
||||
{
|
||||
COLORREF clr = GetSysColor(COLOR_HOTLIGHT);
|
||||
#ifndef _WIN64
|
||||
// COLOR_HOTLIGHT is Win98/2000+. GetSysColorBrush is the correct way to
|
||||
// detect valid colors but here we just assume nobody uses black.
|
||||
if (!clr) clr = RGB(0,0,255);
|
||||
#endif
|
||||
return clr;
|
||||
}
|
||||
|
||||
struct nsControl* NSDFUNC GetControl(HWND hwCtl)
|
||||
{
|
||||
unsigned id = (unsigned) GetProp(hwCtl, NSCONTROL_ID_PROP);
|
||||
|
@ -195,9 +206,9 @@ INT_PTR CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
|
|||
if (hideAccel)
|
||||
xtraDrawStyle |= DT_HIDEPREFIX;
|
||||
|
||||
// Use blue unless the user has set another using SetCtlColors
|
||||
// Use the system color unless the user has set another using SetCtlColors
|
||||
if (!GetWindowLongPtr(lpdis->hwndItem, GWLP_USERDATA))
|
||||
SetTextColor(lpdis->hDC, RGB(0,0,255));
|
||||
SetTextColor(lpdis->hDC, GetLinkColor());
|
||||
|
||||
// Draw the text
|
||||
DrawText(lpdis->hDC, text, -1, &rc, xtraDrawStyle | DT_CENTER | DT_VCENTER | DT_WORDBREAK);
|
||||
|
|
|
@ -24,6 +24,8 @@ Released on ?, 201?
|
|||
|
||||
\b Fixed CreateShortcut /NoWorkingDir parsing bug (\W{http://sf.net/p/nsis/bugs/1110/}{bug #1110})
|
||||
|
||||
\b nsDialogs and InstallOptions now use the system link color
|
||||
|
||||
\H{v3.0b1} 3.0 Beta 1
|
||||
|
||||
Released on October 6th, 2014
|
||||
|
|
|
@ -510,6 +510,9 @@ typedef DWORDLONG ULONGLONG,*PULONGLONG;
|
|||
#ifndef COLOR_WINDOW
|
||||
# define COLOR_WINDOW 5
|
||||
#endif
|
||||
#ifndef COLOR_HOTLIGHT
|
||||
# define COLOR_HOTLIGHT 26
|
||||
#endif
|
||||
|
||||
// resources
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue