1
#include "../Platform.h"
9
#ifdef NSIS_SUPPORT_BGBG
11
#define c1 header->bg_color1
12
#define c2 header->bg_color2
14
LRESULT CALLBACK BG_WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
18
case WM_WINDOWPOSCHANGING:
20
LPWINDOWPOS wp = (LPWINDOWPOS) lParam;
21
wp->flags |= SWP_NOACTIVATE;
22
wp->hwndInsertAfter = g_hwnd;
27
header *header = g_header;
30
HDC hdc=BeginPaint(hwnd,&ps);
35
lh.lbStyle = BS_SOLID;
37
GetClientRect(hwnd,&r);
38
// this portion by Drew Davidson, drewdavidson@mindspring.com
42
// JF: made slower, reduced to 4 pixels high, because I like how it looks better/
47
rv = (GetRValue(c2) * r.top + GetRValue(c1) * (ry-r.top)) / ry;
48
gv = (GetGValue(c2) * r.top + GetGValue(c1) * (ry-r.top)) / ry;
49
bv = (GetBValue(c2) * r.top + GetBValue(c1) * (ry-r.top)) / ry;
50
lh.lbColor = RGB(rv,gv,bv);
51
brush = CreateBrushIndirect(&lh);
52
// note that we don't need to do "SelectObject(hdc, brush)"
53
// because FillRect lets us specify the brush as a parameter.
55
FillRect(hdc, &r, brush);
60
if (header->bg_textcolor != -1)
62
HFONT newFont = CreateFontIndirect((LOGFONT *) header->blocks[NB_BGFONT].offset);
68
SetBkMode(hdc,TRANSPARENT);
69
SetTextColor(hdc,header->bg_textcolor);
70
oldFont = SelectObject(hdc,newFont);
71
DrawText(hdc,g_caption,-1,&r,DT_TOP|DT_LEFT|DT_SINGLELINE|DT_NOPREFIX);
72
SelectObject(hdc,oldFont);
73
DeleteObject(newFont);
80
return DefWindowProc(hwnd,uMsg,wParam,lParam);
83
#endif //NSIS_SUPPORT_BGBG
4
* This file is a part of NSIS.
6
* Copyright (C) 1999-2008 Nullsoft and Contributors
8
* Licensed under the zlib/libpng license (the "License");
9
* you may not use this file except in compliance with the License.
11
* Licence details can be found in the file COPYING.
13
* This software is provided 'as-is', without any express or implied
17
#include "../Platform.h"
25
#ifdef NSIS_SUPPORT_BGBG
27
#define c1 header->bg_color1
28
#define c2 header->bg_color2
30
LRESULT CALLBACK BG_WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
34
case WM_WINDOWPOSCHANGING:
36
LPWINDOWPOS wp = (LPWINDOWPOS) lParam;
37
wp->flags |= SWP_NOACTIVATE;
38
wp->hwndInsertAfter = g_hwnd;
43
header *header = g_header;
46
HDC hdc=BeginPaint(hwnd,&ps);
51
lh.lbStyle = BS_SOLID;
53
GetClientRect(hwnd,&r);
54
// this portion by Drew Davidson, drewdavidson@mindspring.com
58
// JF: made slower, reduced to 4 pixels high, because I like how it looks better/
63
rv = (GetRValue(c2) * r.top + GetRValue(c1) * (ry-r.top)) / ry;
64
gv = (GetGValue(c2) * r.top + GetGValue(c1) * (ry-r.top)) / ry;
65
bv = (GetBValue(c2) * r.top + GetBValue(c1) * (ry-r.top)) / ry;
66
lh.lbColor = RGB(rv,gv,bv);
67
brush = CreateBrushIndirect(&lh);
68
// note that we don't need to do "SelectObject(hdc, brush)"
69
// because FillRect lets us specify the brush as a parameter.
71
FillRect(hdc, &r, brush);
76
if (header->bg_textcolor != -1)
78
HFONT newFont = CreateFontIndirect((LOGFONT *) header->blocks[NB_BGFONT].offset);
84
SetBkMode(hdc,TRANSPARENT);
85
SetTextColor(hdc,header->bg_textcolor);
86
oldFont = SelectObject(hdc,newFont);
87
DrawText(hdc,g_caption,-1,&r,DT_TOP|DT_LEFT|DT_SINGLELINE|DT_NOPREFIX);
88
SelectObject(hdc,oldFont);
89
DeleteObject(newFont);
96
return DefWindowProc(hwnd,uMsg,wParam,lParam);
99
#endif //NSIS_SUPPORT_BGBG