| 1 | /* $Id: win32wdesktop.cpp,v 1.5 1999-10-24 22:56:10 sandervl Exp $ */ | 
|---|
| 2 | /* | 
|---|
| 3 | * Win32 Desktop Window for OS/2 | 
|---|
| 4 | * | 
|---|
| 5 | * | 
|---|
| 6 | * Copyright 1999 Sander van Leeuwen (sandervl@xs4all.nl) | 
|---|
| 7 | * | 
|---|
| 8 | * | 
|---|
| 9 | * Project Odin Software License can be found in LICENSE.TXT | 
|---|
| 10 | * | 
|---|
| 11 | */ | 
|---|
| 12 | #include <os2win.h> | 
|---|
| 13 | #include <misc.h> | 
|---|
| 14 | #include <win32wbase.h> | 
|---|
| 15 | #include <win32wdesktop.h> | 
|---|
| 16 | #include "oslibwin.h" | 
|---|
| 17 | #include "win32wndhandle.h" | 
|---|
| 18 |  | 
|---|
| 19 | Win32Desktop *windowDesktop = 0; | 
|---|
| 20 |  | 
|---|
| 21 | //****************************************************************************** | 
|---|
| 22 | //****************************************************************************** | 
|---|
| 23 | BOOL CreateWin32Desktop() | 
|---|
| 24 | { | 
|---|
| 25 | windowDesktop = new Win32Desktop(); | 
|---|
| 26 | if(windowDesktop == NULL) { | 
|---|
| 27 | dprintf(("Unable to create desktop window!!!")); | 
|---|
| 28 | return FALSE; | 
|---|
| 29 | } | 
|---|
| 30 | return TRUE; | 
|---|
| 31 | } | 
|---|
| 32 | //****************************************************************************** | 
|---|
| 33 | //****************************************************************************** | 
|---|
| 34 | void DestroyDesktopWindow() | 
|---|
| 35 | { | 
|---|
| 36 | if(windowDesktop) { | 
|---|
| 37 | delete windowDesktop; | 
|---|
| 38 | windowDesktop = 0; | 
|---|
| 39 | } | 
|---|
| 40 | } | 
|---|
| 41 | //****************************************************************************** | 
|---|
| 42 | //****************************************************************************** | 
|---|
| 43 | Win32Desktop::Win32Desktop() : Win32BaseWindow(OBJTYPE_WINDOW) | 
|---|
| 44 | { | 
|---|
| 45 | OSLibWinQueryWindowRect(OSLIB_HWND_DESKTOP, &rectWindow, RELATIVE_TO_SCREEN); | 
|---|
| 46 | OS2Hwnd      = OSLIB_HWND_DESKTOP; | 
|---|
| 47 | OS2HwndFrame = OSLIB_HWND_DESKTOP; | 
|---|
| 48 | rectClient   = rectWindow; | 
|---|
| 49 | Win32Hwnd    = 0; | 
|---|
| 50 |  | 
|---|
| 51 | /* Find the window class */ | 
|---|
| 52 | windowClass = Win32WndClass::FindClass(0, (LPSTR)DESKTOP_CLASS_ATOM); | 
|---|
| 53 |  | 
|---|
| 54 | setWindowProc(windowClass->getWindowProc()); | 
|---|
| 55 | } | 
|---|
| 56 | //****************************************************************************** | 
|---|
| 57 | //****************************************************************************** | 
|---|
| 58 | Win32Desktop::~Win32Desktop() | 
|---|
| 59 | { | 
|---|
| 60 | } | 
|---|
| 61 | //****************************************************************************** | 
|---|
| 62 | //Disabling the desktop is not a good idea (mouse no longer responds) | 
|---|
| 63 | //****************************************************************************** | 
|---|
| 64 | BOOL Win32Desktop::EnableWindow(BOOL fEnable) | 
|---|
| 65 | { | 
|---|
| 66 | return TRUE; //of course we succeeded | 
|---|
| 67 | } | 
|---|
| 68 | //****************************************************************************** | 
|---|
| 69 | //Dummy window procedure. Does nothing. | 
|---|
| 70 | //****************************************************************************** | 
|---|
| 71 | LRESULT WIN32API DesktopWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam ) | 
|---|
| 72 | { | 
|---|
| 73 | return 0; | 
|---|
| 74 | } | 
|---|
| 75 | //****************************************************************************** | 
|---|
| 76 | //****************************************************************************** | 
|---|
| 77 | BOOL DESKTOP_Register() | 
|---|
| 78 | { | 
|---|
| 79 | WNDCLASSA wndClass; | 
|---|
| 80 |  | 
|---|
| 81 | ZeroMemory(&wndClass,sizeof(WNDCLASSA)); | 
|---|
| 82 | wndClass.style         = CS_GLOBALCLASS; | 
|---|
| 83 | wndClass.lpfnWndProc   = (WNDPROC)DesktopWndProc; | 
|---|
| 84 | wndClass.cbClsExtra    = 0; | 
|---|
| 85 | wndClass.cbWndExtra    = 0; | 
|---|
| 86 | wndClass.hCursor       = (HCURSOR)IDC_ARROWA; | 
|---|
| 87 | wndClass.hbrBackground = 0; | 
|---|
| 88 | wndClass.lpszClassName = DESKTOP_CLASS_NAMEA; | 
|---|
| 89 |  | 
|---|
| 90 | return RegisterClassA(&wndClass); | 
|---|
| 91 | } | 
|---|
| 92 | //****************************************************************************** | 
|---|
| 93 | //****************************************************************************** | 
|---|
| 94 | BOOL DESKTOP_Unregister() | 
|---|
| 95 | { | 
|---|
| 96 | if (GlobalFindAtomA(DESKTOP_CLASS_NAMEA)) | 
|---|
| 97 | return UnregisterClassA(DESKTOP_CLASS_NAMEA,(HINSTANCE)NULL); | 
|---|
| 98 | else    return FALSE; | 
|---|
| 99 | } | 
|---|
| 100 | //****************************************************************************** | 
|---|
| 101 | //****************************************************************************** | 
|---|