Draw themed size gripper
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7023 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
2502961051
commit
8de43bfab1
4 changed files with 44 additions and 3 deletions
|
@ -242,7 +242,7 @@ INT_PTR CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam
|
|||
PAINTSTRUCT ps;
|
||||
GetGripperPos(hwndDlg, g_resize.griprect);
|
||||
HDC hdc = BeginPaint(hwndDlg, &ps);
|
||||
DrawFrameControl(hdc, &g_resize.griprect, DFC_SCROLL, DFCS_SCROLLSIZEGRIP);
|
||||
DrawGripper(hwndDlg, hdc, g_resize.griprect);
|
||||
EndPaint(hwndDlg, &ps);
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ void CreateToolBar()
|
|||
if (hasCC4_71) { // Version 4.71
|
||||
SendMessage(g_toolbar.hwnd, TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_DRAWDDARROWS);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
// Old Windows 95 toolbar, 256 color bitmap with system palette
|
||||
|
|
|
@ -986,3 +986,42 @@ HFONT CreateFont(int Height, int Weight, DWORD PitchAndFamily, LPCTSTR Face)
|
|||
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
|
||||
PitchAndFamily, Face);
|
||||
}
|
||||
|
||||
#ifndef SP_GRIPPER
|
||||
#ifndef HTHEME
|
||||
#define HTHEME HTHEME_OLDSDK
|
||||
struct OLDSDK_TYPE_HTHEME {int unused;}; typedef struct OLDSDK_TYPE_HTHEME* HTHEME;
|
||||
#endif
|
||||
#define SP_GRIPPER 3
|
||||
#endif
|
||||
struct VisualStyles {
|
||||
VisualStyles() : m_OpenThemeData(NULL) {}
|
||||
static HTHEME WINAPI Compat_OpenThemeData(HWND hWnd, LPCWSTR Class) { return NULL; }
|
||||
HTHEME OpenThemeData(HWND hWnd, LPCWSTR Class) { return (InitUXTheme(), m_OpenThemeData(hWnd, Class)); }
|
||||
void InitUXTheme()
|
||||
{
|
||||
if (m_OpenThemeData) return ;
|
||||
HMODULE hUXT = LoadLibraryA("UXTHEME");
|
||||
if (!((FARPROC&) m_OpenThemeData = GetProcAddress(hUXT, "OpenThemeData"))) m_OpenThemeData = Compat_OpenThemeData;
|
||||
(FARPROC&) CloseThemeData = GetProcAddress(hUXT, "CloseThemeData");
|
||||
(FARPROC&) DrawThemeBackground = GetProcAddress(hUXT, "DrawThemeBackground");
|
||||
}
|
||||
|
||||
HTHEME(WINAPI*m_OpenThemeData)(HWND,LPCWSTR);
|
||||
HRESULT(WINAPI*CloseThemeData)(HTHEME);
|
||||
HRESULT(WINAPI*DrawThemeBackground)(HTHEME,HDC,int,int,LPCRECT,LPCRECT);
|
||||
} VS;
|
||||
|
||||
void DrawGripper(HWND hWnd, HDC hDC, const RECT&r)
|
||||
{
|
||||
HTHEME hTheme = VS.OpenThemeData(hWnd, L"STATUS");
|
||||
if (hTheme)
|
||||
{
|
||||
VS.DrawThemeBackground(hTheme, hDC, SP_GRIPPER, 0, &r, NULL);
|
||||
VS.CloseThemeData(hTheme);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawFrameControl(hDC, const_cast<LPRECT>(&r), DFC_SCROLL, DFCS_SCROLLSIZEGRIP);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,10 +84,12 @@ bool OpenUrlInDefaultBrowser(HWND hwnd, LPCSTR Url);
|
|||
HMENU FindSubMenu(HMENU hMenu, UINT uId);
|
||||
HFONT CreateFont(int Height, int Weight, DWORD PitchAndFamily, LPCTSTR Face);
|
||||
|
||||
inline void GetGripperPos(HWND hwnd, RECT&r)
|
||||
void DrawGripper(HWND hWnd, HDC hDC, const RECT&r);
|
||||
static inline void GetGripperPos(HWND hwnd, RECT&r)
|
||||
{
|
||||
GetClientRect(hwnd, &r);
|
||||
r.left = r.right - GetSystemMetrics(SM_CXVSCROLL);
|
||||
r.top = r.bottom - GetSystemMetrics(SM_CYVSCROLL);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue