Something went wrong. Try again.
Reactos
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354/* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS Logon User Interface Host * FILE: base/system/logonui/NT5design.c * PROGRAMMERS: Ged Murphy (gedmurphy@reactos.org) */
#include "logonui.h"#include <strsafe.h>
/* GLOBALS ******************************************************************/
#define NT5_TOP_BORDER_HEIGHT 80#define NT5_BOTTOM_BORDER_HEIGHT 96
/* FUNCTIONS ****************************************************************/
static VOIDNT5_DrawLogoffCaptionText(LPWSTR lpText, HDC hdcMem){ HFONT hFont; LOGFONTW LogFont; RECT TextRect; INT PrevBkMode;
/* Setup the font we'll use */ ZeroMemory(&LogFont, sizeof(LOGFONTW)); LogFont.lfCharSet = DEFAULT_CHARSET; LogFont.lfHeight = 22; LogFont.lfWeight = 109; // From WinXP disassembly StringCchCopyW(LogFont.lfFaceName, _countof(LogFont.lfFaceName), L"Arial");
/* Create it */ hFont = CreateFontIndirectW(&LogFont); if (hFont) { /* Set the font and font colour */ SelectObject(hdcMem, hFont); SetTextColor(hdcMem, RGB(255, 255, 255));
/* Create the text rect */ TextRect.top = (g_pInfo->cy / 2) + 34; TextRect.bottom = (g_pInfo->cy / 2) + 34 + (GetDeviceCaps(hdcMem, LOGPIXELSY)); TextRect.left = g_pInfo->cx / 3; TextRect.right = (g_pInfo->cx / 2) + 35 + 137;
/* Set the background mode to transparent */ PrevBkMode = SetBkMode(hdcMem, TRANSPARENT);
/* Draw the text to the mem DC */ DrawTextW(hdcMem, lpText, -1, &TextRect, DT_NOPREFIX | DT_WORDBREAK | DT_RIGHT); // WinXP disassembly uses 0x812
/* Set the previous background mode */ SetBkMode(hdcMem, PrevBkMode);
/* Delete the font */ DeleteObject(hFont); }}
static VOIDNT5_DrawLogoffIcon(HDC hdcMem){ HBITMAP hBitmap; BITMAP bitmap; HDC hTempDC;
/* Load the XP logo */ hBitmap = (HBITMAP)LoadImageW(g_pInfo->hInstance, MAKEINTRESOURCEW(IDB_MAIN_ROS_LOGO), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR); if (hBitmap) { /* Get the bitmap dimensions */ GetObjectW(hBitmap, sizeof(BITMAP), &bitmap);
/* Create a temp DC for the bitmap */ hTempDC = CreateCompatibleDC(hdcMem); if (hTempDC) { /* Select the bitmap onto the temp DC */ SelectObject(hTempDC, hBitmap);
/* Paint it onto the centre block */ BitBlt(hdcMem, (g_pInfo->cx / 2) + 35, (g_pInfo->cy / 2) - 72, bitmap.bmWidth, bitmap.bmHeight, hTempDC, 0, 0, SRCCOPY);
/* Delete the DC */ DeleteDC(hTempDC); }
/* Delete the bitmap */ DeleteObject(hBitmap); }}
VOIDNT5_RefreshLogoffScreenText(LPWSTR lpText, HDC hdcMem){ /* FIXME: clear previous text */
/* Draw the new text */ NT5_DrawLogoffCaptionText(lpText, hdcMem);}
VOIDNT5_CreateLogoffScreen(LPWSTR lpText, HDC hdcMem){ /* Draw the reactos logo */ NT5_DrawLogoffIcon(hdcMem);
/* Draw the first text string */ NT5_DrawLogoffCaptionText(lpText, hdcMem);}
HDCNT5_DrawBaseBackground(HDC hdcDesktop){ HBITMAP hBitmap = NULL; HDC hdcMem = NULL;
/* Create an an off screen DC to match the desktop DC */ hdcMem = CreateCompatibleDC(hdcDesktop); if (hdcMem) { /* Create a bitmap to draw the logoff screen onto */ hBitmap = CreateCompatibleBitmap(hdcDesktop, g_pInfo->cx, g_pInfo->cy); if (hBitmap) { /* Select it onto our off screen DC*/ SelectObject(hdcMem, hBitmap);
/* Draw the centre block */ { HBITMAP hTempBitmap; HBRUSH hBrush; BITMAP bitmap; HDC hTempDC;
/* Paint the blue centre block */ hBrush = CreateSolidBrush(RGB(90, 126, 220)); SelectObject(hdcMem, hBrush); PatBlt(hdcMem, 0, NT5_TOP_BORDER_HEIGHT, g_pInfo->cx, g_pInfo->cy - NT5_TOP_BORDER_HEIGHT - NT5_BOTTOM_BORDER_HEIGHT, PATCOPY); DeleteObject(hBrush);
/* Load the shine effect */ hTempBitmap = (HBITMAP)LoadImageW(g_pInfo->hInstance, MAKEINTRESOURCEW(IDB_MAIN_PANEL_SHINE), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR); if (hTempBitmap) { /* Get the bitmap dimensions */ GetObjectW(hTempBitmap, sizeof(BITMAP), &bitmap);
/* Create a temp DC for the bitmap */ hTempDC = CreateCompatibleDC(hdcDesktop); if (hTempDC) { /* Select the bitmap onto the temp DC */ SelectObject(hTempDC, hTempBitmap);
/* Paint it onto the top left of the centre block */ BitBlt(hdcMem, 0, NT5_TOP_BORDER_HEIGHT, bitmap.bmWidth, bitmap.bmHeight, hTempDC, 0, 0, SRCCOPY);
/* Delete the DC */ DeleteDC(hTempDC); }
/* Delete the bitmap */ DeleteObject(hTempBitmap); } }
/* Draw the top border */ { HBITMAP hTempBitmap; HBRUSH hBrush; BITMAP bitmap; HDC hTempDC;
/* Create the blue brush and paint the top bar */ hBrush = CreateSolidBrush(RGB(0, 48, 156)); SelectObject(hdcMem, hBrush); PatBlt(hdcMem, 0, 0, g_pInfo->cx, NT5_TOP_BORDER_HEIGHT, PATCOPY); DeleteObject(hBrush);
/* Load the top divider strip */ hTempBitmap = (HBITMAP)LoadImageW(g_pInfo->hInstance, MAKEINTRESOURCEW(IDB_TOP_DIVIDER_STRIP), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR); if (hTempBitmap) { /* Get the bitmap dimensions */ GetObjectW(hTempBitmap, sizeof(BITMAP), &bitmap);
/* Create a temp DC for the bitmap */ hTempDC = CreateCompatibleDC(hdcDesktop); if (hTempDC) { /* Select the bitmap onto the temp DC */ SelectObject(hTempDC, hTempBitmap);
/* Paint the bitmap */ StretchBlt(hdcMem, 0, NT5_TOP_BORDER_HEIGHT - bitmap.bmHeight, g_pInfo->cx, NT5_TOP_BORDER_HEIGHT, hTempDC, 0, 0, bitmap.bmWidth, NT5_TOP_BORDER_HEIGHT, SRCCOPY);
/* Delete the DC */ DeleteDC(hTempDC); }
/* Delete the bitmap */ DeleteObject(hTempBitmap); } }
/* Draw the bottom border */ { HBITMAP hTempBitmap; TRIVERTEX vertex[2]; GRADIENT_RECT gRect; BITMAP bitmap; HDC hTempDC;
/* * We paint the divider strip first as it's 3 * pixels high but MS only show 2 of them. */
/* Load the bottom divider strip */ hTempBitmap = (HBITMAP)LoadImage(g_pInfo->hInstance, MAKEINTRESOURCE(IDB_BOTTOM_DIVIDER_STRIP), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR); if (hTempBitmap) { /* Get the bitmap dimensions */ GetObjectW(hTempBitmap, sizeof(BITMAP), &bitmap);
/* Create a temp DC for the bitmap */ hTempDC = CreateCompatibleDC(hdcDesktop); if (hTempDC) { /* Select the bitmap onto the temp DC */ SelectObject(hTempDC, hTempBitmap);
/* Paint the bitmap */ StretchBlt(hdcMem, 0, g_pInfo->cy - NT5_BOTTOM_BORDER_HEIGHT, g_pInfo->cx, g_pInfo->cy - NT5_BOTTOM_BORDER_HEIGHT + bitmap.bmHeight, hTempDC, 0, 0, bitmap.bmWidth, g_pInfo->cy - NT5_BOTTOM_BORDER_HEIGHT + bitmap.bmHeight, SRCCOPY);
/* Delete the DC */ DeleteDC(hTempDC); }
/* Delete the bitmap */ DeleteObject(hTempBitmap); }
/* Setup the left hand vertex */ vertex[0].x = 0; vertex[0].y = g_pInfo->cy - NT5_BOTTOM_BORDER_HEIGHT + 2; // paint over 1 pixel of the bitmap vertex[0].Red = 0x3900; vertex[0].Green = 0x3400; vertex[0].Blue = 0xAE00; vertex[0].Alpha = 0x0000;
/* Setup the right hand vertex */ vertex[1].x = g_pInfo->cx; vertex[1].y = g_pInfo->cy; vertex[1].Red = 0x0000; vertex[1].Green = 0x3000; vertex[1].Blue = 0x9600; vertex[1].Alpha = 0x0000;
/* Set the vertex structs */ gRect.UpperLeft = 0; gRect.LowerRight = 1;
/* Paint the gradient across the bottom */ GradientFill(hdcMem, vertex, 2, &gRect, 1, GRADIENT_FILL_RECT_H); }
/* Delete the bitmap */ DeleteObject(hBitmap); } }
return hdcMem;}
/* EOF */