diff --git a/reactos/apps/tests/Makefile b/reactos/apps/tests/Makefile index 9bc3c844f71..5046dc25766 100644 --- a/reactos/apps/tests/Makefile +++ b/reactos/apps/tests/Makefile @@ -8,8 +8,8 @@ include $(PATH_TO_TOP)/rules.mak # test_old tests TEST_APPS = accelerator alive apc args atomtest bench bitblt button \ -button2 capclock carets cliarea combo consume copymove count dibtest \ -dump_shared_data edit enumwnd enumws event global_mem hello mdi \ +button2 capclock carets combo consume copymove count dibtest dump_shared_data \ +edit enumwnd enumws event global_mem gradient hello mdi \ hivetest icontest isotest lineclip linetest lock lpc \ mktime mstest multithrdwin multiwin mutex nptest patblt primitives pteb \ regtest sectest sertest shaptest shm statst statst2 stretchblt suspend \ diff --git a/reactos/apps/tests/cliarea/cliarea.c b/reactos/apps/tests/cliarea/cliarea.c deleted file mode 100644 index d109231726a..00000000000 --- a/reactos/apps/tests/cliarea/cliarea.c +++ /dev/null @@ -1,97 +0,0 @@ -#include -#include -#include -//HFONT tf; -LRESULT WINAPI MainWndProc(HWND, UINT, WPARAM, LPARAM); - -int WINAPI -WinMain(HINSTANCE hInstance, - HINSTANCE hPrevInstance, - LPSTR lpszCmdLine, - int nCmdShow) -{ - WNDCLASS wc; - MSG msg; - HWND hWnd; - - wc.lpszClassName = "CliAreaClass"; - wc.lpfnWndProc = MainWndProc; - wc.style = CS_VREDRAW | CS_HREDRAW; - wc.hInstance = hInstance; - wc.hIcon = LoadIcon(NULL, (LPCTSTR)IDI_APPLICATION); - wc.hCursor = LoadCursor(NULL, (LPCTSTR)IDC_ARROW); - wc.hbrBackground = (HBRUSH)GetStockObject(GRAY_BRUSH); - wc.lpszMenuName = NULL; - wc.cbClsExtra = 0; - wc.cbWndExtra = 0; - if (RegisterClass(&wc) == 0) - { - fprintf(stderr, "RegisterClass failed (last error 0x%lX)\n", - GetLastError()); - return(1); - } - - hWnd = CreateWindow("CliAreaClass", - "ClientArea Test", - WS_OVERLAPPEDWINDOW|WS_HSCROLL|WS_VSCROLL, - 0, - 0, - CW_USEDEFAULT, - CW_USEDEFAULT, - NULL, - NULL, - hInstance, - NULL); - if (hWnd == NULL) - { - fprintf(stderr, "CreateWindow failed (last error 0x%lX)\n", - GetLastError()); - return(1); - } - - //tf = CreateFontA(14, 0, 0, TA_BASELINE, FW_NORMAL, FALSE, FALSE, FALSE, - // ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, - // DEFAULT_QUALITY, FIXED_PITCH|FF_DONTCARE, "Timmons"); - - ShowWindow(hWnd, nCmdShow); - - while(GetMessage(&msg, NULL, 0, 0)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - - //DeleteObject(tf); - - return msg.wParam; -} - -LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - HDC hDC; - char txt[100]; - - switch(msg) - { - case WM_LBUTTONUP: - { - RECT Rect; - GetWindowRect(hWnd, &Rect); - SendMessage(hWnd, WM_NCCALCSIZE, 0, (LPARAM)(&Rect)); - hDC = GetWindowDC(0); - Rectangle(hDC, Rect.left, Rect.top, Rect.right, Rect.bottom); - sprintf(txt, "Client coordinates: %lu, %lu, %lu, %lu", Rect.left, Rect.top, Rect.right, Rect.bottom); - TextOut(hDC, Rect.left + 1, Rect.top + 1, (LPCTSTR)txt, strlen(txt)); - ReleaseDC(0, hDC); - break; - } - - case WM_DESTROY: - PostQuitMessage(0); - break; - - default: - return DefWindowProc(hWnd, msg, wParam, lParam); - } - return 0; -} diff --git a/reactos/apps/tests/cliarea/.cvsignore b/reactos/apps/tests/gradient/.cvsignore similarity index 100% rename from reactos/apps/tests/cliarea/.cvsignore rename to reactos/apps/tests/gradient/.cvsignore diff --git a/reactos/apps/tests/gradient/gradient.c b/reactos/apps/tests/gradient/gradient.c new file mode 100644 index 00000000000..e291b2101ec --- /dev/null +++ b/reactos/apps/tests/gradient/gradient.c @@ -0,0 +1,181 @@ +#include +#include +#include + +LRESULT WINAPI MainWndProc(HWND, UINT, WPARAM, LPARAM); + +int WINAPI +WinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPSTR lpszCmdLine, + int nCmdShow) +{ + WNDCLASS wc; + MSG msg; + HWND hWnd; + + wc.lpszClassName = "GradientClass"; + wc.lpfnWndProc = MainWndProc; + wc.style = CS_VREDRAW | CS_HREDRAW; + wc.hInstance = hInstance; + wc.hIcon = LoadIcon(NULL, (LPCTSTR)IDI_APPLICATION); + wc.hCursor = LoadCursor(NULL, (LPCTSTR)IDC_ARROW); + wc.hbrBackground = (HBRUSH)GetStockObject(GRAY_BRUSH); + wc.lpszMenuName = NULL; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + if (RegisterClass(&wc) == 0) + { + fprintf(stderr, "RegisterClass failed (last error 0x%lX)\n", + GetLastError()); + return(1); + } + + hWnd = CreateWindow("GradientClass", + "GradientFill Test", + WS_OVERLAPPEDWINDOW|WS_HSCROLL|WS_VSCROLL, + 0, + 0, + CW_USEDEFAULT, + CW_USEDEFAULT, + NULL, + NULL, + hInstance, + NULL); + if (hWnd == NULL) + { + fprintf(stderr, "CreateWindow failed (last error 0x%lX)\n", + GetLastError()); + return(1); + } + + //tf = CreateFontA(14, 0, 0, TA_BASELINE, FW_NORMAL, FALSE, FALSE, FALSE, + // ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, + // DEFAULT_QUALITY, FIXED_PITCH|FF_DONTCARE, "Timmons"); + + ShowWindow(hWnd, nCmdShow); + + while(GetMessage(&msg, NULL, 0, 0)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + + //DeleteObject(tf); + + return msg.wParam; +} +LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + HDC hDC; + + switch(msg) + { + case WM_PAINT: + { + PAINTSTRUCT ps; + TRIVERTEX vert [5] ; + GRADIENT_TRIANGLE gTRi[3]; + GRADIENT_RECT gRect[2]; + hDC = BeginPaint(hWnd, &ps); + + vert [0] .x = 0; + vert [0] .y = 0; + vert [0] .Red = 0xff00; + vert [0] .Green = 0xff00; + vert [0] .Blue = 0xff00; + vert [0] .Alpha = 0x0000; + + vert [1] .x = 300; + vert [1] .y = 20; + vert [1] .Red = 0x0000; + vert [1] .Green = 0x0000; + vert [1] .Blue = 0xff00; + vert [1] .Alpha = 0x0000; + + vert [2] .x = 100; + vert [2] .y = 200; + vert [2] .Red = 0xff00; + vert [2] .Green = 0x0000; + vert [2] .Blue = 0x0000; + vert [2] .Alpha = 0x0000; + + vert [3] .x = 250; + vert [3] .y = 300; + vert [3] .Red = 0x8000; + vert [3] .Green = 0x8000; + vert [3] .Blue = 0x0000; + vert [3] .Alpha = 0x0000; + + vert [4] .x = 325; + vert [4] .y = 300; + vert [4] .Red = 0x0000; + vert [4] .Green = 0xff00; + vert [4] .Blue = 0x0000; + vert [4] .Alpha = 0x0000; + + gTRi[0].Vertex1 = 0; + gTRi[0].Vertex2 = 1; + gTRi[0].Vertex3 = 2; + + gTRi[1].Vertex1 = 1; + gTRi[1].Vertex2 = 2; + gTRi[1].Vertex3 = 3; + + gTRi[2].Vertex1 = 1; + gTRi[2].Vertex2 = 3; + gTRi[2].Vertex3 = 4; + + GdiGradientFill(hDC,vert,5,&gTRi,3,GRADIENT_FILL_TRIANGLE); + + + vert [0] .x = 5; + vert [0] .y = 200; + vert [0] .Red = 0x0000; + vert [0] .Green = 0x0000; + vert [0] .Blue = 0x0000; + vert [0] .Alpha = 0x0000; + + vert [1] .x = 90; + vert [1] .y = 240; + vert [1] .Red = 0x0000; + vert [1] .Green = 0x0000; + vert [1] .Blue = 0xff00; + vert [1] .Alpha = 0x0000; + + vert [2] .x = 5; + vert [2] .y = 245; + vert [2] .Red = 0x0000; + vert [2] .Green = 0x0000; + vert [2] .Blue = 0x0000; + vert [2] .Alpha = 0x0000; + + vert [3] .x = 90; + vert [3] .y = 300; + vert [3] .Red = 0x0000; + vert [3] .Green = 0x0000; + vert [3] .Blue = 0xff00; + vert [3] .Alpha = 0x0000; + + gRect[0].UpperLeft = 0; + gRect[0].LowerRight = 1; + + gRect[1].UpperLeft = 2; + gRect[1].LowerRight = 3; + + GdiGradientFill(hDC,vert,4,&gRect[0],1,GRADIENT_FILL_RECT_H); + GdiGradientFill(hDC,vert,4,&gRect[1],1,GRADIENT_FILL_RECT_V); + + EndPaint(hWnd, &ps); + break; + } + + case WM_DESTROY: + PostQuitMessage(0); + break; + + default: + return DefWindowProc(hWnd, msg, wParam, lParam); + } + return 0; +} diff --git a/reactos/apps/tests/cliarea/makefile b/reactos/apps/tests/gradient/makefile similarity index 67% rename from reactos/apps/tests/cliarea/makefile rename to reactos/apps/tests/gradient/makefile index 3a6cd07ebc4..d4988c2da10 100644 --- a/reactos/apps/tests/cliarea/makefile +++ b/reactos/apps/tests/gradient/makefile @@ -1,4 +1,4 @@ -# $Id: makefile,v 1.2 2003/11/14 17:13:16 weiden Exp $ +# $Id: makefile,v 1.1 2004/02/08 21:57:35 weiden Exp $ PATH_TO_TOP = ../../.. @@ -8,9 +8,9 @@ TARGET_TYPE = program TARGET_APPTYPE = windows -TARGET_NAME = cliarea +TARGET_NAME = gradient -TARGET_SDKLIBS = kernel32.a gdi32.a +TARGET_SDKLIBS = gdi32.a TARGET_OBJECTS = $(TARGET_NAME).o