More work; we now have the background. Oh boy, this is gonna be fun, because Vista doesn't have things set up quite right compared to 7...
This commit is contained in:
parent
9e6baf0a61
commit
b82d1b0a3b
|
@ -60,29 +60,50 @@ static struct {
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO check errors
|
// TODO check errors
|
||||||
// TODO extract colors from the theme
|
|
||||||
void drawExplorerBackground(HTHEME theme, HDC dc, RECT *rcWindow, RECT *rcPaint)
|
void drawExplorerBackground(HTHEME theme, HDC dc, RECT *rcWindow, RECT *rcPaint)
|
||||||
{
|
{
|
||||||
static TRIVERTEX vertices[] = {
|
COLORREF color;
|
||||||
{ 0, 0, 4 << 8, 80 << 8, 130 << 8, 255 << 8 },
|
TRIVERTEX vertices[4];
|
||||||
{ 0, 0, 17 << 8, 101 << 8, 132 << 8, 255 << 8 },
|
|
||||||
{ 0, 0, 17 << 8, 101 << 8, 132 << 8, 255 << 8 },
|
|
||||||
{ 0, 0, 29 << 8, 121 << 8, 134 << 8, 255 << 8 },
|
|
||||||
};
|
|
||||||
static GRADIENT_RECT gr[2] = {
|
static GRADIENT_RECT gr[2] = {
|
||||||
{ 0, 1 },
|
{ 0, 1 },
|
||||||
{ 2, 3 },
|
{ 2, 3 },
|
||||||
};
|
};
|
||||||
|
|
||||||
vertices[0].x = rcPaint->left;
|
// TODO get constant names
|
||||||
vertices[0].y = 0;
|
GetThemeColor(theme,
|
||||||
vertices[1].x = rcPaint->right;
|
2, 0,
|
||||||
vertices[1].y = (rcWindow->bottom - rcWindow->top) / 2;
|
3810, &color);
|
||||||
vertices[2].x = rcPaint->left;
|
vertices[0].x = rcWindow->left;
|
||||||
vertices[2].y = (rcWindow->bottom - rcWindow->top) / 2;
|
vertices[0].y = rcWindow->top;
|
||||||
vertices[3].x = rcPaint->right;
|
vertices[0].Red = ((COLOR16) GetRValue(color)) << 8;
|
||||||
vertices[3].y = rcWindow->bottom - rcWindow->top;
|
vertices[0].Green = ((COLOR16) GetGValue(color)) << 8;
|
||||||
GradientFill(dc, vertices, 4, (PVOID) gr, 2, GRADIENT_FILL_RECT_V);
|
vertices[0].Blue = ((COLOR16) GetBValue(color)) << 8;
|
||||||
|
vertices[0].Alpha = ((COLOR16) LOBYTE(color >> 24)) << 8;
|
||||||
|
|
||||||
|
GetThemeColor(theme,
|
||||||
|
2, 0,
|
||||||
|
3811, &color);
|
||||||
|
vertices[1].x = (rcWindow->right - rcWindow->left) / 2;
|
||||||
|
vertices[1].y = rcWindow->bottom;
|
||||||
|
vertices[1].Red = ((COLOR16) GetRValue(color)) << 8;
|
||||||
|
vertices[1].Green = ((COLOR16) GetGValue(color)) << 8;
|
||||||
|
vertices[1].Blue = ((COLOR16) GetBValue(color)) << 8;
|
||||||
|
vertices[1].Alpha = ((COLOR16) LOBYTE(color >> 24)) << 8;
|
||||||
|
|
||||||
|
vertices[2] = vertices[1];
|
||||||
|
vertices[2].y = rcWindow->top;
|
||||||
|
|
||||||
|
GetThemeColor(theme,
|
||||||
|
2, 0,
|
||||||
|
3812, &color);
|
||||||
|
vertices[3].x = rcWindow->right;
|
||||||
|
vertices[3].y = rcWindow->bottom;
|
||||||
|
vertices[3].Red = ((COLOR16) GetRValue(color)) << 8;
|
||||||
|
vertices[3].Green = ((COLOR16) GetGValue(color)) << 8;
|
||||||
|
vertices[3].Blue = ((COLOR16) GetBValue(color)) << 8;
|
||||||
|
vertices[3].Alpha = ((COLOR16) LOBYTE(color >> 24)) << 8;
|
||||||
|
|
||||||
|
GradientFill(dc, vertices, 4, (PVOID) gr, 2, GRADIENT_FILL_RECT_H);
|
||||||
DrawThemeBackground(theme, dc,
|
DrawThemeBackground(theme, dc,
|
||||||
1, 0,
|
1, 0,
|
||||||
rcWindow, rcPaint);
|
rcWindow, rcPaint);
|
||||||
|
@ -539,6 +560,8 @@ void handleEvents(HWND hwnd, WPARAM wParam)
|
||||||
|
|
||||||
LRESULT CALLBACK wndproc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
LRESULT CALLBACK wndproc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
|
HDC dc;
|
||||||
|
PAINTSTRUCT ps;
|
||||||
NMHDR *nm = (NMHDR *) lParam;
|
NMHDR *nm = (NMHDR *) lParam;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -553,11 +576,26 @@ LRESULT CALLBACK wndproc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
break;
|
break;
|
||||||
case WM_SIZE:
|
case WM_SIZE:
|
||||||
repositionButtons(hwnd);
|
repositionButtons(hwnd);
|
||||||
|
// TODO check errors
|
||||||
|
InvalidateRect(hwnd, NULL, TRUE);
|
||||||
break;
|
break;
|
||||||
case WM_THEMECHANGED:
|
case WM_THEMECHANGED:
|
||||||
updateTheme(hwnd);
|
updateTheme(hwnd);
|
||||||
repositionButtons(hwnd);
|
repositionButtons(hwnd);
|
||||||
break;
|
break;
|
||||||
|
case WM_PAINT:
|
||||||
|
// TODO check errors
|
||||||
|
dc = BeginPaint(hwnd, &ps);
|
||||||
|
{RECT w;
|
||||||
|
GetClientRect(hwnd,&w);
|
||||||
|
drawExplorerBackground(theme, dc, &w, &(ps.rcPaint));}
|
||||||
|
EndPaint(hwnd, &ps);
|
||||||
|
return 0;
|
||||||
|
case WM_PRINTCLIENT:
|
||||||
|
{RECT w;
|
||||||
|
GetClientRect(hwnd,&w);
|
||||||
|
drawExplorerBackground(theme, (HDC) wParam, &w, &w);}
|
||||||
|
return 0;
|
||||||
#if 0
|
#if 0
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
handleEvents(hwnd, wParam);
|
handleEvents(hwnd, wParam);
|
||||||
|
|
Loading…
Reference in New Issue