ReactOS 0.4.15-dev-8348-gc1b9bb5
NT5design.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Logon User Interface Host
4 * FILE: base/system/logonui/NT5design.c
5 * PROGRAMMERS: Ged Murphy (gedmurphy@reactos.org)
6 */
7
8#include "logonui.h"
9#include <strsafe.h>
10
11
12/* GLOBALS ******************************************************************/
13
14#define NT5_TOP_BORDER_HEIGHT 80
15#define NT5_BOTTOM_BORDER_HEIGHT 96
16
17
18/* FUNCTIONS ****************************************************************/
19
20static VOID
22 HDC hdcMem)
23{
25 LOGFONTW LogFont;
26 RECT TextRect;
27 INT PrevBkMode;
28
29 /* Setup the font we'll use */
30 ZeroMemory(&LogFont, sizeof(LOGFONTW));
31 LogFont.lfCharSet = DEFAULT_CHARSET;
32 LogFont.lfHeight = 22;
33 LogFont.lfWeight = 109; // From WinXP disassembly
34 StringCchCopyW(LogFont.lfFaceName, _countof(LogFont.lfFaceName), L"Arial");
35
36 /* Create it */
37 hFont = CreateFontIndirectW(&LogFont);
38 if (hFont)
39 {
40 /* Set the font and font colour */
42 SetTextColor(hdcMem, RGB(255, 255, 255));
43
44 /* Create the text rect */
45 TextRect.top = (g_pInfo->cy / 2) + 34;
46 TextRect.bottom = (g_pInfo->cy / 2) + 34 + (GetDeviceCaps(hdcMem, LOGPIXELSY));
47 TextRect.left = g_pInfo->cx / 3;
48 TextRect.right = (g_pInfo->cx / 2) + 35 + 137;
49
50 /* Set the background mode to transparent */
51 PrevBkMode = SetBkMode(hdcMem, TRANSPARENT);
52
53 /* Draw the text to the mem DC */
55 lpText,
56 -1,
57 &TextRect,
58 DT_NOPREFIX | DT_WORDBREAK | DT_RIGHT); // WinXP disassembly uses 0x812
59
60 /* Set the previous background mode */
61 SetBkMode(hdcMem, PrevBkMode);
62
63 /* Delete the font */
65 }
66}
67
68static VOID
70{
73 HDC hTempDC;
74
75 /* Load the XP logo */
76 hBitmap = (HBITMAP)LoadImageW(g_pInfo->hInstance,
79 0,
80 0,
82 if (hBitmap)
83 {
84 /* Get the bitmap dimensions */
85 GetObjectW(hBitmap, sizeof(BITMAP), &bitmap);
86
87 /* Create a temp DC for the bitmap */
88 hTempDC = CreateCompatibleDC(hdcMem);
89 if (hTempDC)
90 {
91 /* Select the bitmap onto the temp DC */
92 SelectObject(hTempDC, hBitmap);
93
94 /* Paint it onto the centre block */
96 (g_pInfo->cx / 2) + 35,
97 (g_pInfo->cy / 2) - 72,
98 bitmap.bmWidth,
99 bitmap.bmHeight,
100 hTempDC,
101 0,
102 0,
103 SRCCOPY);
104
105 /* Delete the DC */
106 DeleteDC(hTempDC);
107 }
108
109 /* Delete the bitmap */
111 }
112}
113
114VOID
116 HDC hdcMem)
117{
118 /* FIXME: clear previous text */
119
120 /* Draw the new text */
122}
123
124VOID
126 HDC hdcMem)
127{
128 /* Draw the reactos logo */
130
131 /* Draw the first text string */
133}
134
135HDC
137{
139 HDC hdcMem = NULL;
140
141 /* Create an an off screen DC to match the desktop DC */
142 hdcMem = CreateCompatibleDC(hdcDesktop);
143 if (hdcMem)
144 {
145 /* Create a bitmap to draw the logoff screen onto */
146 hBitmap = CreateCompatibleBitmap(hdcDesktop, g_pInfo->cx, g_pInfo->cy);
147 if (hBitmap)
148 {
149 /* Select it onto our off screen DC*/
151
152 /* Draw the centre block */
153 {
154 HBITMAP hTempBitmap;
155 HBRUSH hBrush;
157 HDC hTempDC;
158
159 /* Paint the blue centre block */
160 hBrush = CreateSolidBrush(RGB(90, 126, 220));
161 SelectObject(hdcMem, hBrush);
163 0,
165 g_pInfo->cx,
167 PATCOPY);
168 DeleteObject(hBrush);
169
170 /* Load the shine effect */
171 hTempBitmap = (HBITMAP)LoadImageW(g_pInfo->hInstance,
174 0,
175 0,
177 if (hTempBitmap)
178 {
179 /* Get the bitmap dimensions */
180 GetObjectW(hTempBitmap, sizeof(BITMAP), &bitmap);
181
182 /* Create a temp DC for the bitmap */
183 hTempDC = CreateCompatibleDC(hdcDesktop);
184 if (hTempDC)
185 {
186 /* Select the bitmap onto the temp DC */
187 SelectObject(hTempDC, hTempBitmap);
188
189 /* Paint it onto the top left of the centre block */
191 0,
193 bitmap.bmWidth,
194 bitmap.bmHeight,
195 hTempDC,
196 0,
197 0,
198 SRCCOPY);
199
200 /* Delete the DC */
201 DeleteDC(hTempDC);
202 }
203
204 /* Delete the bitmap */
205 DeleteObject(hTempBitmap);
206 }
207 }
208
209 /* Draw the top border */
210 {
211 HBITMAP hTempBitmap;
212 HBRUSH hBrush;
214 HDC hTempDC;
215
216 /* Create the blue brush and paint the top bar */
217 hBrush = CreateSolidBrush(RGB(0, 48, 156));
218 SelectObject(hdcMem, hBrush);
220 DeleteObject(hBrush);
221
222 /* Load the top divider strip */
223 hTempBitmap = (HBITMAP)LoadImageW(g_pInfo->hInstance,
226 0,
227 0,
229 if (hTempBitmap)
230 {
231 /* Get the bitmap dimensions */
232 GetObjectW(hTempBitmap, sizeof(BITMAP), &bitmap);
233
234 /* Create a temp DC for the bitmap */
235 hTempDC = CreateCompatibleDC(hdcDesktop);
236 if (hTempDC)
237 {
238 /* Select the bitmap onto the temp DC */
239 SelectObject(hTempDC, hTempBitmap);
240
241 /* Paint the bitmap */
243 0,
244 NT5_TOP_BORDER_HEIGHT - bitmap.bmHeight,
245 g_pInfo->cx,
247 hTempDC,
248 0,
249 0,
250 bitmap.bmWidth,
252 SRCCOPY);
253
254 /* Delete the DC */
255 DeleteDC(hTempDC);
256 }
257
258 /* Delete the bitmap */
259 DeleteObject(hTempBitmap);
260 }
261 }
262
263 /* Draw the bottom border */
264 {
265 HBITMAP hTempBitmap;
266 TRIVERTEX vertex[2];
267 GRADIENT_RECT gRect;
269 HDC hTempDC;
270
271 /*
272 * We paint the divider strip first as it's 3
273 * pixels high but MS only show 2 of them.
274 */
275
276 /* Load the bottom divider strip */
277 hTempBitmap = (HBITMAP)LoadImage(g_pInfo->hInstance,
280 0,
281 0,
283 if (hTempBitmap)
284 {
285 /* Get the bitmap dimensions */
286 GetObjectW(hTempBitmap, sizeof(BITMAP), &bitmap);
287
288 /* Create a temp DC for the bitmap */
289 hTempDC = CreateCompatibleDC(hdcDesktop);
290 if (hTempDC)
291 {
292 /* Select the bitmap onto the temp DC */
293 SelectObject(hTempDC, hTempBitmap);
294
295 /* Paint the bitmap */
297 0,
299 g_pInfo->cx,
300 g_pInfo->cy - NT5_BOTTOM_BORDER_HEIGHT + bitmap.bmHeight,
301 hTempDC,
302 0,
303 0,
304 bitmap.bmWidth,
305 g_pInfo->cy - NT5_BOTTOM_BORDER_HEIGHT + bitmap.bmHeight,
306 SRCCOPY);
307
308 /* Delete the DC */
309 DeleteDC(hTempDC);
310 }
311
312 /* Delete the bitmap */
313 DeleteObject(hTempBitmap);
314 }
315
316 /* Setup the left hand vertex */
317 vertex[0].x = 0;
318 vertex[0].y = g_pInfo->cy - NT5_BOTTOM_BORDER_HEIGHT + 2; // paint over 1 pixel of the bitmap
319 vertex[0].Red = 0x3900;
320 vertex[0].Green = 0x3400;
321 vertex[0].Blue = 0xAE00;
322 vertex[0].Alpha = 0x0000;
323
324 /* Setup the right hand vertex */
325 vertex[1].x = g_pInfo->cx;
326 vertex[1].y = g_pInfo->cy;
327 vertex[1].Red = 0x0000;
328 vertex[1].Green = 0x3000;
329 vertex[1].Blue = 0x9600;
330 vertex[1].Alpha = 0x0000;
331
332 /* Set the vertex structs */
333 gRect.UpperLeft = 0;
334 gRect.LowerRight = 1;
335
336 /* Paint the gradient across the bottom */
337 GradientFill(hdcMem,
338 vertex,
339 2,
340 &gRect,
341 1,
342 GRADIENT_FILL_RECT_H);
343 }
344
345 /* Delete the bitmap */
347 }
348 }
349
350 return hdcMem;
351}
352
353/* EOF */
VOID NT5_RefreshLogoffScreenText(LPWSTR lpText, HDC hdcMem)
Definition: NT5design.c:115
#define NT5_BOTTOM_BORDER_HEIGHT
Definition: NT5design.c:15
static VOID NT5_DrawLogoffCaptionText(LPWSTR lpText, HDC hdcMem)
Definition: NT5design.c:21
#define NT5_TOP_BORDER_HEIGHT
Definition: NT5design.c:14
HDC NT5_DrawBaseBackground(HDC hdcDesktop)
Definition: NT5design.c:136
static VOID NT5_DrawLogoffIcon(HDC hdcMem)
Definition: NT5design.c:69
VOID NT5_CreateLogoffScreen(LPWSTR lpText, HDC hdcMem)
Definition: NT5design.c:125
HFONT hFont
Definition: main.c:53
#define IDB_TOP_DIVIDER_STRIP
Definition: resource.h:5
#define IDB_MAIN_PANEL_SHINE
Definition: resource.h:3
#define IDB_BOTTOM_DIVIDER_STRIP
Definition: resource.h:6
#define IDB_MAIN_ROS_LOGO
Definition: resource.h:4
#define NULL
Definition: types.h:112
static HBITMAP hBitmap
Definition: timezone.c:26
static VOID BitBlt(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_reads_bytes_(Delta *Height) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Delta)
Definition: common.c:57
#define RGB(r, g, b)
Definition: precomp.h:71
pKey DeleteObject()
static struct CommonInfo * g_pInfo
static HBITMAP
Definition: button.c:44
static HDC
Definition: imagelist.c:92
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:16
#define L(x)
Definition: ntvdm.h:50
#define _countof(array)
Definition: sndvol32.h:70
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
LONG lfHeight
Definition: dimm.idl:59
LONG lfWeight
Definition: dimm.idl:63
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
BYTE lfCharSet
Definition: dimm.idl:67
Definition: bl.h:1331
ULONG LowerRight
Definition: wingdi.h:2806
ULONG UpperLeft
Definition: wingdi.h:2805
Definition: uimain.c:89
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
Definition: mesh.c:4558
float x
Definition: hlsl.c:29
float y
Definition: hlsl.c:29
int32_t INT
Definition: typedefs.h:58
HDC hdcMem
Definition: welcome.c:104
#define ZeroMemory
Definition: winbase.h:1712
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define LOGPIXELSY
Definition: wingdi.h:719
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define DEFAULT_CHARSET
Definition: wingdi.h:384
#define TRANSPARENT
Definition: wingdi.h:950
BOOL WINAPI StretchBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_opt_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)
#define SRCCOPY
Definition: wingdi.h:333
#define PATCOPY
Definition: wingdi.h:335
BOOL WINAPI PatBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1056
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:918
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
BOOL WINAPI DeleteDC(_In_ HDC)
#define DT_NOPREFIX
Definition: winuser.h:537
#define IMAGE_BITMAP
Definition: winuser.h:211
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE hInst, _In_ LPCWSTR name, _In_ UINT type, _In_ int cx, _In_ int cy, _In_ UINT fuLoad)
Definition: cursoricon.c:2247
#define DT_WORDBREAK
Definition: winuser.h:544
#define LoadImage
Definition: winuser.h:5824
#define LR_DEFAULTCOLOR
Definition: winuser.h:1087
#define DT_RIGHT
Definition: winuser.h:538
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define MAKEINTRESOURCE
Definition: winuser.h:591
WCHAR * LPWSTR
Definition: xmlstorage.h:184