2003-07-24 Casper S. Hornstrup <chorns@users.sourceforge.net>

Move welcome from rosapps to here and beautify it a bit.

	* Makefile: Copy bootdata/autorun.inf, and bootdata/icon.ico to CD.
	(SYS_APPS) Add welcome.
	* include/defines.h (BS_FLAT): Define.
	* bootdata/autorun.inf: New file.
	* bootdata/icon.ico: Ditto.
	* subsys/system/welcome: New directory.
	* subsys/system/welcome/.cvsignore: New file.
	* subsys/system/welcome/Makefile: Ditto.
	* subsys/system/welcome/resource.h: Ditto.
	* subsys/system/welcome/welcome.c: Ditto.
	* subsys/system/welcome/welcome.rc: Ditto.
	* subsys/system/welcome/res/: New directory.
	* subsys/system/welcome/res/background-right.bmp: New file.
	* subsys/system/welcome/res/background-top.bmp: Ditto.
	* subsys/system/welcome/res/default.bmp: Ditto.
	* subsys/system/welcome/res/icon.ico: Ditto.
	* subsys/system/welcome/res/topic0.bmp: Ditto.
	* subsys/system/welcome/res/topic1.bmp: Ditto.
	* subsys/system/welcome/res/topic2.bmp: Ditto.

svn path=/trunk/; revision=5253
This commit is contained in:
Casper Hornstrup 2003-07-24 19:37:20 +00:00
parent 2b7294bcd1
commit b1026db1fa
18 changed files with 1053 additions and 3 deletions

View file

@ -1,3 +1,27 @@
2003-07-24 Casper S. Hornstrup <chorns@users.sourceforge.net>
Move welcome from rosapps to here and beautify it a bit.
* Makefile: Copy bootdata/autorun.inf, and bootdata/icon.ico to CD.
(SYS_APPS) Add welcome.
* include/defines.h (BS_FLAT): Define.
* bootdata/autorun.inf: New file.
* bootdata/icon.ico: Ditto.
* subsys/system/welcome: New directory.
* subsys/system/welcome/.cvsignore: New file.
* subsys/system/welcome/Makefile: Ditto.
* subsys/system/welcome/resource.h: Ditto.
* subsys/system/welcome/welcome.c: Ditto.
* subsys/system/welcome/welcome.rc: Ditto.
* subsys/system/welcome/res/: New directory.
* subsys/system/welcome/res/background-right.bmp: New file.
* subsys/system/welcome/res/background-top.bmp: Ditto.
* subsys/system/welcome/res/default.bmp: Ditto.
* subsys/system/welcome/res/icon.ico: Ditto.
* subsys/system/welcome/res/topic0.bmp: Ditto.
* subsys/system/welcome/res/topic1.bmp: Ditto.
* subsys/system/welcome/res/topic2.bmp: Ditto.
2003-07-23 James Tabor <jimtabor@adsl-64-217-116-74.dsl.hstntx.swbell.net>
lib/user32/misc/: stubs.c Removed stub for ClientToScreen.

View file

@ -81,8 +81,8 @@ NET_DEVICE_DRIVERS = ne2000
STORAGE_DRIVERS = atapi cdrom class2 disk scsiport
# System applications
# autochk cmd format gstart services setup usetup winlogon
SYS_APPS = autochk cmd format gstart services setup usetup winlogon
# autochk cmd format gstart services setup usetup welcome winlogon
SYS_APPS = autochk cmd format gstart services setup usetup welcome winlogon
# System services
# rpcss eventlog
@ -789,13 +789,14 @@ install_dirs:
$(RMKDIR) $(INSTALL_DIR)
install_before:
# $(RLINE) bootdata/autorun.inf $(INSTALL_DIR)/../autorun.inf
$(RLINE) bootdata/autorun.inf $(INSTALL_DIR)/../autorun.inf
$(RLINE) bootdata/readme.txt $(INSTALL_DIR)/../readme.txt
$(RLINE) bootdata/hivecls.inf $(INSTALL_DIR)/hivecls.inf
$(RLINE) bootdata/hivedef.inf $(INSTALL_DIR)/hivedef.inf
$(RLINE) bootdata/hivesft.inf $(INSTALL_DIR)/hivesft.inf
$(RLINE) bootdata/hivesys.inf $(INSTALL_DIR)/hivesys.inf
$(RLINE) bootdata/txtsetup.sif $(INSTALL_DIR)/txtsetup.sif
$(CP) bootdata/icon.ico $(INSTALL_DIR)/../icon.ico
$(CP) media/fonts $(INSTALL_DIR)
$(CP) media/nls $(INSTALL_DIR)

3
reactos/bootdata/autorun.inf Executable file
View file

@ -0,0 +1,3 @@
[autorun]
open=reactos\welcome.exe
icon=icon.ico

BIN
reactos/bootdata/icon.ico Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -626,6 +626,7 @@ extern "C" {
#define BS_TOP (0x400L)
#define BS_USERBUTTON (0x8L)
#define BS_VCENTER (0xc00L)
#define BS_FLAT (0x8000L)
#define CBS_AUTOHSCROLL (0x40L)
#define CBS_DISABLENOSCROLL (0x800L)
#define CBS_DROPDOWN (0x2L)

View file

@ -0,0 +1,4 @@
*.coff
*.exe
*.o
*.map

View file

@ -0,0 +1,17 @@
# $Id: Makefile,v 1.1 2003/07/24 19:37:20 chorns Exp $
PATH_TO_TOP = ../../..
TARGET_TYPE = program
TARGET_APPTYPE = windows
TARGET_NAME = welcome
TARGET_INSTALLDIR = system32
TARGET_OBJECTS = $(TARGET_NAME).o
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View file

@ -0,0 +1,88 @@
#define IDS_APPTITLE 1000
#define IDS_DEFAULTTOPICTITLE 1001
#define IDS_DEFAULTTOPICDESC 1002
#define IDS_FONTNAME 1003
//#define IDS_CHECKTEXT 1004
#define IDS_CLOSETEXT 1005
#define IDS_TOPICBUTTON0 1010
#define IDS_TOPICBUTTON1 1011
#define IDS_TOPICBUTTON2 1012
#define IDS_TOPICBUTTON3 1013
#define IDS_TOPICBUTTON4 1014
#define IDS_TOPICBUTTON5 1015
#define IDS_TOPICBUTTON6 1016
#define IDS_TOPICBUTTON7 1017
#define IDS_TOPICBUTTON8 1018
#define IDS_TOPICBUTTON9 1019
#define IDS_TOPICTITLE0 1020
#define IDS_TOPICTITLE1 1021
#define IDS_TOPICTITLE2 1022
#define IDS_TOPICTITLE3 1023
#define IDS_TOPICTITLE4 1024
#define IDS_TOPICTITLE5 1025
#define IDS_TOPICTITLE6 1026
#define IDS_TOPICTITLE7 1027
#define IDS_TOPICTITLE8 1028
#define IDS_TOPICTITLE9 1029
#define IDS_TOPICDESC0 1030
#define IDS_TOPICDESC1 1031
#define IDS_TOPICDESC2 1032
#define IDS_TOPICDESC3 1033
#define IDS_TOPICDESC4 1034
#define IDS_TOPICDESC5 1035
#define IDS_TOPICDESC6 1036
#define IDS_TOPICDESC7 1037
#define IDS_TOPICDESC8 1038
#define IDS_TOPICDESC9 1039
#define IDS_TOPICACTION0 1040
#define IDS_TOPICACTION1 1041
#define IDS_TOPICACTION2 1042
#define IDS_TOPICACTION3 1043
#define IDS_TOPICACTION4 1044
#define IDS_TOPICACTION5 1045
#define IDS_TOPICACTION6 1046
#define IDS_TOPICACTION7 1047
#define IDS_TOPICACTION8 1048
#define IDS_TOPICACTION9 1049
#define IDS_TOPICOPTION0 1050
#define IDS_TOPICOPTION1 1051
#define IDS_TOPICOPTION2 1052
#define IDS_TOPICOPTION3 1053
#define IDS_TOPICOPTION4 1054
#define IDS_TOPICOPTION5 1055
#define IDS_TOPICOPTION6 1056
#define IDS_TOPICOPTION7 1057
#define IDS_TOPICOPTION8 1058
#define IDS_TOPICOPTION9 1059
/* Bitmaps */
#define IDB_TITLEBITMAP 101
#define IDB_DEFAULTTOPICBITMAP 102
#define IDB_TBACKGROUNDBITMAP 103
#define IDB_RBACKGROUNDBITMAP 104
#if 0
#define IDB_TOPICBITMAP0 110
#define IDB_TOPICBITMAP1 111
#define IDB_TOPICBITMAP2 112
#define IDB_TOPICBITMAP3 113
#define IDB_TOPICBITMAP4 114
#define IDB_TOPICBITMAP5 115
#define IDB_TOPICBITMAP6 116
#define IDB_TOPICBITMAP7 117
#define IDB_TOPICBITMAP8 118
#define IDB_TOPICBITMAP9 119
#endif
#define IDC_CLOSEBUTTON 2000
#define IDC_CHECKBUTTON 2001
#define IDI_MAIN 3000

View file

@ -0,0 +1,814 @@
/*
* ReactOS applications
* Copyright (C) 2001, 2002 ReactOS Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: welcome.c,v 1.1 2003/07/24 19:37:20 chorns Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS welcome/autorun application
* FILE: subsys/system/welcome/welcome.c
* PROGRAMMERS: Eric Kohl (ekohl@rz-online.de)
* Casper S. Hornstrup (chorns@users.sourceforge.net)
*/
#include "../../reactos/include/reactos/version.h"
#include <windows.h>
#include <string.h>
#include <stdio.h>
#include <tchar.h>
#include "resource.h"
#define LIGHT_BLUE 0x00F0CAA6
#define DARK_BLUE 0x00996633
/* GLOBALS ******************************************************************/
TCHAR szFrameClass [] = "WelcomeWindowClass";
TCHAR szAppTitle [80];
HINSTANCE hInstance;
HWND hwndMain = 0;
HWND hwndDefaultTopic = 0;
HBITMAP hTitleBitmap = 0;
HBITMAP hTopBackgroundBitmap = 0;
HBITMAP hRightBackgroundBitmap = 0;
HDC hdcDisplay=0;
HDC hdcMem = 0;
int nTopic = -1;
int nDefaultTopic = -1;
ULONG ulInnerWidth = 480;
ULONG ulInnerHeight = 360;
HBITMAP hDefaultTopicBitmap;
HBITMAP hTopicBitmap[10];
HWND hwndTopicButton[10];
HWND hwndCloseButton;
HWND hwndCheckButton;
HFONT hfontTopicButton;
HFONT hfontTopicTitle;
HFONT hfontTopicDescription;
HFONT hfontCheckButton;
HFONT hfontBannerTitle;
HBRUSH hbrLightBlue;
HBRUSH hbrDarkBlue;
HBRUSH hbrRightPanel;
RECT rcTitlePanel;
RECT rcLeftPanel;
RECT rcRightPanel;
WNDPROC fnOldBtn;
LRESULT CALLBACK
MainWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
/* FUNCTIONS ****************************************************************/
int WINAPI
WinMain(HINSTANCE hInst,
HINSTANCE hPrevInstance,
LPSTR lpszCmdLine,
int nCmdShow)
{
WNDCLASSEX wndclass;
MSG msg;
int xPos;
int yPos;
int xWidth;
int yHeight;
RECT rcWindow;
HICON hMainIcon;
DWORD dwStyle = WS_OVERLAPPED | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_CAPTION | WS_SYSMENU | WS_VISIBLE;
hInstance = hInst;
/* Load icons */
hMainIcon = LoadIcon (hInstance, MAKEINTRESOURCE(IDI_MAIN));
/* Register the window class */
wndclass.style = CS_OWNDC;
wndclass.lpfnWndProc = (WNDPROC)MainWndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = hInstance;
wndclass.hIcon = hMainIcon;
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW);
wndclass.hbrBackground = 0;
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = szFrameClass;
wndclass.cbSize = sizeof(WNDCLASSEX);
wndclass.hIconSm = 0;
RegisterClassEx(&wndclass);
rcWindow.top = 0;
rcWindow.bottom = ulInnerHeight - 1;
rcWindow.left = 0;
rcWindow.right = ulInnerWidth - 1;
AdjustWindowRect(&rcWindow,
dwStyle,
FALSE);
xWidth = rcWindow.right - rcWindow.left;
yHeight = rcWindow.bottom - rcWindow.top;
xPos = (GetSystemMetrics(SM_CXSCREEN) - xWidth) / 2;
yPos = (GetSystemMetrics(SM_CYSCREEN) - yHeight) / 2;
rcTitlePanel.top = 0;
rcTitlePanel.bottom = 93;
rcTitlePanel.left = 0;
rcTitlePanel.right = ulInnerWidth - 1;
rcLeftPanel.top = rcTitlePanel.bottom;
rcLeftPanel.bottom = ulInnerHeight - 1;
rcLeftPanel.left = 0;
rcLeftPanel.right = ulInnerWidth / 3;
rcRightPanel.top = rcLeftPanel.top;
rcRightPanel.bottom = rcLeftPanel.bottom;
rcRightPanel.left = rcLeftPanel.right;
rcRightPanel.right = ulInnerWidth - 1;
if (!LoadString(hInstance, (UINT)MAKEINTRESOURCE(IDS_APPTITLE), szAppTitle, 80))
_tcscpy(szAppTitle, TEXT("ReactOS Welcome"));
/* Create main window */
hwndMain = CreateWindow(szFrameClass,
szAppTitle,
dwStyle,
xPos,
yPos,
xWidth,
yHeight,
0,
0,
hInstance,
NULL);
ShowWindow(hwndMain, nCmdShow);
UpdateWindow(hwndMain);
while (GetMessage(&msg, NULL, 0, 0) != FALSE)
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return(msg.wParam);
}
LRESULT CALLBACK
ButtonSubclassWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
LONG i;
if (uMsg == WM_MOUSEMOVE)
{
i = GetWindowLong(hWnd, GWL_ID);
if (nTopic != i)
{
nTopic = i;
SetFocus(hWnd);
InvalidateRect(hwndMain, NULL, TRUE);
}
}
return(CallWindowProc(fnOldBtn, hWnd, uMsg, wParam, lParam));
}
static BOOL
RunApplication(int nTopic)
{
PROCESS_INFORMATION ProcessInfo;
STARTUPINFO StartupInfo;
CHAR AppName[256];
CHAR CurrentDir[256];
int nLength;
InvalidateRect(hwndMain, NULL, TRUE);
GetCurrentDirectory(256, CurrentDir);
nLength = LoadString(hInstance, IDS_TOPICACTION0 + nTopic, AppName, 256);
if (nLength == 0)
return(FALSE);
if (stricmp(AppName, "explorer.exe") == 0)
{
strcat(AppName, " ");
strcat(AppName, CurrentDir);
}
memset(&StartupInfo, 0, sizeof(STARTUPINFO));
StartupInfo.cb = sizeof(STARTUPINFO);
StartupInfo.lpTitle = "Test";
StartupInfo.dwFlags = STARTF_USESHOWWINDOW;
StartupInfo.wShowWindow = SW_SHOWNORMAL;
CreateProcess(NULL, AppName, NULL, NULL, FALSE, CREATE_NEW_CONSOLE,NULL,
CurrentDir,
&StartupInfo,
&ProcessInfo);
CloseHandle(ProcessInfo.hProcess);
CloseHandle(ProcessInfo.hThread);
return(TRUE);
}
static VOID
SubclassButton(HWND hWnd)
{
fnOldBtn = (WNDPROC)SetWindowLong(hWnd, GWL_WNDPROC, (LPARAM)ButtonSubclassWndProc);
}
static DWORD
GetButtonHeight(HDC hDC,
HFONT hFont,
PSZ szText,
DWORD dwWidth)
{
HFONT hOldFont;
RECT rect;
rect.left = 0;
rect.right = dwWidth - 20;
rect.top = 0;
rect.bottom = 25;
hOldFont = SelectObject(hDC, hFont);
DrawText(hDC, szText, -1, &rect, DT_TOP | DT_CALCRECT | DT_WORDBREAK);
SelectObject(hDC, hOldFont);
return(rect.bottom-rect.top + 14);
}
static LRESULT
OnCreate(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
char szText[80];
int i,nLength;
DWORD dwTop;
DWORD dwHeight = 0;
hbrLightBlue = CreateSolidBrush (LIGHT_BLUE);
hbrDarkBlue = CreateSolidBrush(DARK_BLUE);
hbrRightPanel = CreateSolidBrush (0x00FFFFFF);
/* Banner fonts */
hfontBannerTitle = CreateFont(-30,0,0,0,FW_BOLD,
FALSE,FALSE,FALSE,ANSI_CHARSET,
OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY,
FF_DONTCARE,
"Arial");
hfontTopicTitle = CreateFont(-18,0,0,0,FW_NORMAL,
FALSE,FALSE,FALSE,ANSI_CHARSET,
OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY,
FF_DONTCARE,
"Arial");
hfontTopicDescription = CreateFont(-11,0,0,0,FW_THIN,
FALSE,FALSE,FALSE,ANSI_CHARSET,
OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY,
FF_DONTCARE,
"Arial");
hfontTopicButton = CreateFont(-11,0,0,0,FW_BOLD,
FALSE,FALSE,FALSE,ANSI_CHARSET,
OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY,
FF_DONTCARE,
"Arial");
/* Load bitmaps */
hTitleBitmap = LoadBitmap (hInstance, MAKEINTRESOURCE(IDB_TITLEBITMAP));
hDefaultTopicBitmap = LoadBitmap (hInstance, MAKEINTRESOURCE(IDB_DEFAULTTOPICBITMAP));
#if 0
for (i=0;i < 10; i++)
{
hTopicBitmap[i] = LoadBitmap (hInstance, MAKEINTRESOURCE(IDB_TOPICBITMAP0+i));
}
#endif
hTopBackgroundBitmap = LoadBitmap (hInstance, MAKEINTRESOURCE(IDB_TBACKGROUNDBITMAP));
hRightBackgroundBitmap = LoadBitmap (hInstance, MAKEINTRESOURCE(IDB_RBACKGROUNDBITMAP));
hdcDisplay = CreateDC ("DISPLAY", NULL, NULL, NULL);
hdcMem = CreateCompatibleDC (hdcDisplay);
/* load and create buttons */
dwTop = rcLeftPanel.top;
for (i=0;i < 10; i++)
{
nLength = LoadString(hInstance, IDS_TOPICBUTTON0+i,szText,80);
if (nLength > 0)
{
dwHeight = GetButtonHeight(hdcMem,
hfontTopicButton,
szText,
rcLeftPanel.right - rcLeftPanel.left);
hwndTopicButton[i] = CreateWindow("BUTTON",
szText,
WS_CHILDWINDOW | WS_VISIBLE | WS_TABSTOP | BS_MULTILINE | BS_OWNERDRAW,
rcLeftPanel.left,
dwTop,
rcLeftPanel.right - rcLeftPanel.left,
dwHeight,
hWnd,
(HMENU)i,
hInstance,
NULL);
hwndDefaultTopic = hwndTopicButton[i];
nDefaultTopic = i;
SubclassButton(hwndTopicButton[i]);
SendMessage(hwndTopicButton[i], WM_SETFONT, (WPARAM)hfontTopicButton, MAKELPARAM(TRUE,0));
}
else
{
hwndTopicButton[i] = 0;
}
dwTop += dwHeight;
}
/* Create exit button */
nLength = LoadString(hInstance, IDS_CLOSETEXT, szText, 80);
if (nLength > 0)
{
hwndCloseButton = CreateWindow("BUTTON",
szText,
WS_VISIBLE | WS_CHILD | BS_FLAT,
rcRightPanel.right - 10 - 57,
rcRightPanel.bottom - 10 - 21,
57,
21,
hWnd,
(HMENU)IDC_CLOSEBUTTON,
hInstance,
NULL);
hwndDefaultTopic = 0;
nDefaultTopic = -1;
SendMessage(hwndCloseButton, WM_SETFONT, (WPARAM)hfontTopicButton, MAKELPARAM(TRUE,0));
}
else
{
hwndCloseButton = 0;
}
#if 0
/* Create checkbox */
nLength = LoadString(hInstance, IDS_CHECKTEXT,szText,80);
if (nLength > 0)
{
hfontCheckButton = CreateFont(-10,0,0,0,FW_THIN,FALSE,FALSE,FALSE,ANSI_CHARSET,
OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY,
FF_DONTCARE,
"Tahoma");
hwndCheckButton = CreateWindow("BUTTON",
szText,
WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
rcLeftPanel.left + 8,
rcLeftPanel.bottom - 8 - 13,
rcLeftPanel.right - rcLeftPanel.left - 16,
13,
hWnd,
(HMENU)IDC_CHECKBUTTON,
hInstance,
NULL);
SendMessage(hwndCheckButton, WM_SETFONT, (WPARAM)hfontCheckButton, MAKELPARAM(TRUE,0));
}
else
{
hwndCheckButton = 0;
hfontCheckButton = 0;
}
#endif
return 0;
}
static LRESULT
OnCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
if (LOWORD(wParam) == IDC_CLOSEBUTTON)
{
DestroyWindow(hWnd);
}
else if ((LOWORD(wParam) < 10))
{
if (RunApplication(LOWORD(wParam)) == FALSE)
{
DestroyWindow(hWnd);
}
}
return 0;
}
static VOID
PaintBanner(HDC hdc, LPRECT rcPanel)
{
HBITMAP hOldBitmap;
HBRUSH hOldBrush;
HFONT hOldFont;
RECT rcTitle;
int oldBkMode;
CHAR version[50];
/* Gradient background bitmap */
hOldBitmap = SelectObject(hdcMem, hTopBackgroundBitmap);
BitBlt(hdc,
rcPanel->left,
rcPanel->top,
rcPanel->right - rcPanel->left,
rcPanel->bottom - 3,
hdcMem, 0, 0, SRCCOPY);
SelectObject(hdc, hOldBitmap);
hOldFont = SelectObject (hdc, hfontBannerTitle);
SetTextColor(hdc, 0x00000000);
oldBkMode = GetBkMode(hdc);
SetBkMode(hdc, TRANSPARENT);
sprintf(version, "ReactOS %d.%d.%d",
KERNEL_VERSION_MAJOR,
KERNEL_VERSION_MINOR,
KERNEL_VERSION_PATCH_LEVEL);
rcTitle.top = 5;
rcTitle.left = 15;
DrawTextA(hdc, version, -1, &rcTitle, DT_TOP | DT_CALCRECT);
DrawTextA(hdc, version, -1, &rcTitle, DT_TOP);
SetBkMode(hdc, oldBkMode);
SelectObject(hdc, hOldFont);
/* dark blue line */
hOldBrush = SelectObject(hdc, hbrDarkBlue);
PatBlt(hdc,
rcPanel->left,
rcPanel->bottom - 3,
rcPanel->right - rcPanel->left,
3,
PATCOPY);
SelectObject(hdc, hOldBrush);
}
static LRESULT
OnPaint(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
HPEN hPen;
HPEN hOldPen;
HDC hdc;
PAINTSTRUCT ps;
HBITMAP hOldBitmap = 0;
HBRUSH hOldBrush;
HFONT hOldFont;
RECT rcTitle, rcDescription;
TCHAR szTopicTitle[80];
TCHAR szTopicDesc[256];
int nLength;
//BITMAP bmpInfo;
hdc = BeginPaint(hWnd, &ps);
/* Banner panel */
PaintBanner(hdc, &rcTitlePanel);
/* Left panel */
hOldBrush = SelectObject (hdc, hbrLightBlue);
PatBlt(hdc,
rcLeftPanel.left,
rcLeftPanel.top,
rcLeftPanel.right - rcLeftPanel.left,
rcLeftPanel.bottom - rcLeftPanel.top,
PATCOPY);
/* Right panel */
/* Gradient background bitmap */
hOldBitmap = SelectObject(hdcMem, hRightBackgroundBitmap);
BitBlt(hdc,
rcRightPanel.left,
rcRightPanel.top,
rcRightPanel.right - rcRightPanel.left,
rcRightPanel.bottom - rcRightPanel.top,
hdcMem, 0, 0, SRCCOPY);
SelectObject(hdc, hOldBitmap);
hPen = CreatePen(PS_SOLID, 0, DARK_BLUE);
hOldPen = SelectObject(hdc, hPen);
MoveToEx(hdc, rcRightPanel.left, rcRightPanel.top, NULL);
LineTo(hdc, rcRightPanel.left, rcRightPanel.bottom);
SelectObject(hdc, hOldPen);
DeleteObject(hPen);
#if 0
/* Draw topic bitmap */
if ((nTopic == -1) && (hDefaultTopicBitmap != 0))
{
GetObject(hDefaultTopicBitmap, sizeof(BITMAP), &bmpInfo);
hOldBitmap = SelectObject (hdcMem, hDefaultTopicBitmap);
BitBlt(hdc,
rcRightPanel.right - bmpInfo.bmWidth,
rcRightPanel.bottom - bmpInfo.bmHeight,
bmpInfo.bmWidth,
bmpInfo.bmHeight,
hdcMem,
0,
0,
SRCCOPY);
}
else if (hTopicBitmap[nTopic] != 0)
{
GetObject(hTopicBitmap[nTopic], sizeof(BITMAP), &bmpInfo);
hOldBitmap = SelectObject (hdcMem, hTopicBitmap[nTopic]);
BitBlt(hdc,
rcRightPanel.right - bmpInfo.bmWidth,
rcRightPanel.bottom - bmpInfo.bmHeight,
bmpInfo.bmWidth,
bmpInfo.bmHeight,
hdcMem,
0,
0,
SRCCOPY);
}
#endif
if (nTopic == -1)
{
nLength = LoadString(hInstance, IDS_DEFAULTTOPICTITLE, szTopicTitle, 80);
}
else
{
nLength = LoadString(hInstance, IDS_TOPICTITLE0 + nTopic, szTopicTitle, 80);
if (nLength == 0)
nLength = LoadString(hInstance, IDS_DEFAULTTOPICTITLE, szTopicTitle, 80);
}
if (nTopic == -1)
{
nLength = LoadString(hInstance, IDS_DEFAULTTOPICDESC, szTopicDesc, 256);
}
else
{
nLength = LoadString(hInstance, IDS_TOPICDESC0 + nTopic, szTopicDesc, 256);
if (nLength == 0)
nLength = LoadString(hInstance, IDS_DEFAULTTOPICDESC, szTopicDesc, 256);
}
SetBkMode(hdc, TRANSPARENT);
/* Draw topic title */
rcTitle.left = rcRightPanel.left + 12;
rcTitle.right = rcRightPanel.right - 8;
rcTitle.top = rcRightPanel.top + 8;
rcTitle.bottom = rcTitle.top + 57;
hOldFont = SelectObject(hdc, hfontTopicTitle);
DrawText(hdc, szTopicTitle, -1, &rcTitle, DT_TOP | DT_CALCRECT);
SetTextColor(hdc, DARK_BLUE);
DrawText(hdc, szTopicTitle, -1, &rcTitle, DT_TOP);
/* Draw topic description */
rcDescription.left = rcRightPanel.left + 12;
rcDescription.right = rcRightPanel.right - 8;
rcDescription.top = rcTitle.bottom + 8;
rcDescription.bottom = rcRightPanel.bottom - 20;
SelectObject(hdc, hfontTopicDescription);
SetTextColor(hdc, 0x00000000);
DrawText(hdc, szTopicDesc, -1, &rcDescription, DT_TOP | DT_WORDBREAK);
SetBkMode(hdc, OPAQUE);
SelectObject(hdc, hOldFont);
SelectObject (hdcMem, hOldBrush);
SelectObject (hdcMem, hOldBitmap);
EndPaint(hWnd, &ps);
return 0;
}
static LRESULT
OnDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
LPDRAWITEMSTRUCT lpDis = (LPDRAWITEMSTRUCT)lParam;
HPEN hPen, hOldPen;
HBRUSH hOldBrush;
CHAR szText[80];
int iBkMode;
if (lpDis->hwndItem == hwndCloseButton)
{
DrawFrameControl(lpDis->hDC,
&lpDis->rcItem,
DFC_BUTTON,
DFCS_BUTTONPUSH | DFCS_FLAT);
}
else
{
if (lpDis->CtlID == (ULONG)nTopic)
hOldBrush = SelectObject(lpDis->hDC, hbrRightPanel);
else
hOldBrush = SelectObject(lpDis->hDC, hbrLightBlue);
PatBlt(lpDis->hDC,
lpDis->rcItem.left,
lpDis->rcItem.top,
lpDis->rcItem.right,
lpDis->rcItem.bottom,
PATCOPY);
SelectObject(lpDis->hDC, hOldBrush);
hPen = CreatePen(PS_SOLID, 0, DARK_BLUE);
hOldPen = SelectObject(lpDis->hDC, hPen);
MoveToEx(lpDis->hDC, lpDis->rcItem.left, lpDis->rcItem.bottom-1, NULL);
LineTo(lpDis->hDC, lpDis->rcItem.right, lpDis->rcItem.bottom-1);
SelectObject(lpDis->hDC, hOldPen);
DeleteObject(hPen);
InflateRect(&lpDis->rcItem, -10, -4);
OffsetRect(&lpDis->rcItem, 0, 1);
GetWindowText(lpDis->hwndItem, szText, 80);
SetTextColor(lpDis->hDC, 0x00000000);
iBkMode = SetBkMode(lpDis->hDC, TRANSPARENT);
DrawText(lpDis->hDC, szText, -1, &lpDis->rcItem, DT_TOP | DT_LEFT | DT_WORDBREAK);
SetBkMode(lpDis->hDC, iBkMode);
}
return 0;
}
static LRESULT
OnMouseMove(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
if (nTopic != -1)
{
nTopic = -1;
SetFocus(hWnd);
InvalidateRect(hwndMain, NULL, TRUE);
}
return 0;
}
static LRESULT
OnCtlColorStatic(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
if ((HWND)lParam == hwndCheckButton)
{
SetBkColor((HDC)wParam, LIGHT_BLUE);
return((LRESULT)hbrLightBlue);
}
return 0;
}
static LRESULT
OnActivate(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
nTopic = -1;
InvalidateRect(hwndMain, NULL, TRUE);
return(0);
}
static LRESULT
OnDestroy(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
int i;
for (i=0;i<10;i++)
{
if (hwndTopicButton[i] != 0)
DestroyWindow(hwndTopicButton[i]);
}
if (hwndCloseButton != 0)
DestroyWindow(hwndCloseButton);
if (hwndCheckButton != 0)
DestroyWindow(hwndCheckButton);
DeleteDC(hdcMem);
DeleteDC(hdcDisplay);
/* delete bitmaps */
DeleteObject(hDefaultTopicBitmap);
DeleteObject(hTitleBitmap);
for (i=0;i<10;i++)
{
if (hTopicBitmap[i] != 0)
DeleteObject(hTopicBitmap[i]);
}
DeleteObject(hTopBackgroundBitmap);
DeleteObject(hRightBackgroundBitmap);
DeleteObject(hfontTopicTitle);
DeleteObject(hfontTopicDescription);
DeleteObject(hfontTopicButton);
DeleteObject(hfontBannerTitle);
if (hfontCheckButton != 0)
DeleteObject(hfontCheckButton);
DeleteObject(hbrLightBlue);
DeleteObject(hbrDarkBlue);
DeleteObject(hbrRightPanel);
return 0;
}
LRESULT CALLBACK
MainWndProc(HWND hWnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam)
{
switch(uMsg)
{
case WM_CREATE:
return(OnCreate(hWnd, wParam, lParam));
case WM_COMMAND:
return(OnCommand(hWnd, wParam, lParam));
case WM_ACTIVATE:
return(OnActivate(hWnd, wParam, lParam));
case WM_PAINT:
return(OnPaint(hWnd, wParam, lParam));
case WM_DRAWITEM:
return(OnDrawItem(hWnd, wParam, lParam));
case WM_CTLCOLORSTATIC:
return(OnCtlColorStatic(hWnd, wParam, lParam));
case WM_MOUSEMOVE:
return(OnMouseMove(hWnd, wParam, lParam));
case WM_DESTROY:
OnDestroy(hWnd, wParam, lParam);
PostQuitMessage(0);
return(0);
}
return(DefWindowProc(hWnd, uMsg, wParam, lParam));
}
/* EOF */

View file

@ -0,0 +1,98 @@
#include "resource.h"
/* Icons */
IDI_MAIN ICON DISCARDABLE "res/icon.ico"
/* Bitmaps */
IDB_TITLEBITMAP BITMAP DISCARDABLE "res/title.bmp"
IDB_DEFAULTTOPICBITMAP BITMAP DISCARDABLE "res/default.bmp"
IDB_TBACKGROUNDBITMAP BITMAP DISCARDABLE "res/background-top.bmp"
IDB_RBACKGROUNDBITMAP BITMAP DISCARDABLE "res/background-right.bmp"
//IDB_TOPICBITMAP0 BITMAP DISCARDABLE "res/topic0.bmp"
//IDB_TOPICBITMAP1 BITMAP DISCARDABLE "res/topic1.bmp"
//IDB_TOPICBITMAP2 BITMAP DISCARDABLE "res/topic2.bmp"
//IDB_TOPICBITMAP3 BITMAP DISCARDABLE "res/topic3.bmp"
//IDB_TOPICBITMAP4 BITMAP DISCARDABLE "res/topic4.bmp"
//IDB_TOPICBITMAP5 BITMAP DISCARDABLE "res/topic5.bmp"
//IDB_TOPICBITMAP6 BITMAP DISCARDABLE "res/topic6.bmp"
//IDB_TOPICBITMAP7 BITMAP DISCARDABLE "res/topic7.bmp"
//IDB_TOPICBITMAP8 BITMAP DISCARDABLE "res/topic8.bmp"
//IDB_TOPICBITMAP9 BITMAP DISCARDABLE "res/topic9.bmp"
/* String Tables */
/* Default settings */
STRINGTABLE DISCARDABLE
BEGIN
IDS_APPTITLE "ReactOS - Welcome"
IDS_DEFAULTTOPICTITLE "ReactOS"
IDS_DEFAULTTOPICDESC "Welcome to React Operating System.\n\nClick a topic on the left."
//IDS_CHECKTEXT "Show this dialog again"
IDS_CLOSETEXT "Exit"
END
/* Topic buttons */
STRINGTABLE DISCARDABLE
BEGIN
// IDS_TOPICBUTTON0 "Online Registration"
IDS_TOPICBUTTON0 "Install ReactOS"
IDS_TOPICBUTTON1 "Browse this CD"
// IDS_TOPICBUTTON4 "E&xit"
// IDS_TOPICBUTTON5 "Empty Topic 5"
// IDS_TOPICBUTTON6 "Empty Topic 6"
// IDS_TOPICBUTTON7 "Empty Topic 7"
// IDS_TOPICBUTTON8 "Empty Topic 8"
// IDS_TOPICBUTTON9 "Empty Topic 9"
END
/* Topic titles */
STRINGTABLE DISCARDABLE
BEGIN
// IDS_TOPICTITLE0 "Online Registration"
IDS_TOPICTITLE0 "Install ReactOS"
IDS_TOPICTITLE1 "Browse this CD"
// IDS_TOPICTITLE3 "Exit"
// IDS_TOPICTITLE4 "Empty Topic Title 4"
// IDS_TOPICTITLE5 "Empty Topic Title 5"
// IDS_TOPICTITLE6 "Empty Topic Title 6"
// IDS_TOPICTITLE7 "Empty Topic Title 7"
// IDS_TOPICTITLE8 "Empty Topic Title 8"
// IDS_TOPICTITLE9 "Empty Topic Title 9"
END
/* Topic descriptions */
STRINGTABLE DISCARDABLE
BEGIN
// IDS_TOPICDESC0 "Register your ReactOS now!\n\nWith registering your ReactOS you get a lot of additional benefits, like unsolicited product information, incompetent hotline services and huge amounts of third-party junk mail."
IDS_TOPICDESC0 "Create a new ReactOS installation on your computer or upgrade an existing installation."
IDS_TOPICDESC1 "Browse the CD."
// IDS_TOPICDESC3 "Click to exit this application."
// IDS_TOPICDESC4 "Topic description 4.\n\nDescribe topic 4 here."
// IDS_TOPICDESC5 "Topic description 5.\n\nDescribe topic 5 here."
// IDS_TOPICDESC6 "Topic description 6.\n\nDescribe topic 6 here."
// IDS_TOPICDESC7 "Topic description 7.\n\nDescribe topic 7 here."
// IDS_TOPICDESC8 "Topic description 8.\n\nDescribe topic 8 here."
// IDS_TOPICDESC9 "Topic description 9.\n\nDescribe topic 9 here."
END
/* Topic actions */
STRINGTABLE DISCARDABLE
BEGIN
// IDS_TOPICACTION0 "signup.exe"
IDS_TOPICACTION0 "setup.exe"
IDS_TOPICACTION1 "explorer.exe"
// IDS_TOPICACTION3 "..."
// IDS_TOPICACTION4 "..."
// IDS_TOPICACTION5 "..."
// IDS_TOPICACTION6 "..."
// IDS_TOPICACTION7 "..."
// IDS_TOPICACTION8 "..."
// IDS_TOPICACTION9 "..."
END
/* EOF */