source: trunk/src/user32/new/wingdi.cpp@ 724

Last change on this file since 724 was 724, checked in by sandervl, 26 years ago

Use shared memory for class & window objects

File size: 3.9 KB
Line 
1/* $Id: wingdi.cpp,v 1.10 1999-08-28 14:09:31 sandervl Exp $ */
2/*
3 * Win32 Window graphics apis for OS/2
4 *
5 *
6 * Copyright 1998 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
15#include <win32wnd.h>
16#include <oslibwin.h>
17#include <oslibgdi.h>
18
19#define OPEN32_GDI
20
21//******************************************************************************
22//TODO: Not complete
23//******************************************************************************
24HDC WIN32API BeginPaint(HWND hwnd, PPAINTSTRUCT lps)
25{
26 Win32Window *window;
27 HDC hdc;
28
29 window = Win32Window::GetWindowFromHandle(hwnd);
30 if(!window) {
31 dprintf(("GetDC, window %x not found", hwnd));
32 return 0;
33 }
34 window->MsgEraseBackGround(hdc);
35#ifdef OPEN32_GDI
36 hdc = O32_BeginPaint(window->getOS2WindowHandle(),lps);
37 //CB: conflict with Open32 mechanism
38#else
39 hdc = OSLibWinBeginPaint(window->getOS2WindowHandle(), &lps->rcPaint);
40 lps->hdc = hdc;
41#endif
42 dprintf(("BeginPaint %X returned %x\n", hwnd, hdc));
43
44 lps->fErase = !window->MsgEraseBackGround(hdc);
45 return hdc;
46
47// return lps->hdc;
48}
49//******************************************************************************
50//******************************************************************************
51BOOL WIN32API EndPaint(HWND hwnd, const PAINTSTRUCT *lps)
52{
53 dprintf(("EndPaint %x\n", hwnd));
54#ifdef OPEN32_GDI
55 return O32_EndPaint(hwnd,lps);
56 //CB: dito
57#else
58 return OSLibWinEndPaint(lps->hdc);
59#endif
60}
61//******************************************************************************
62//TODO: PARENT_DC flag
63//******************************************************************************
64HDC WIN32API GetDC(HWND hwnd)
65{
66 Win32Window *window;
67
68 window = Win32Window::GetWindowFromHandle(hwnd);
69 if(!window) {
70 dprintf(("GetDC, window %x not found", hwnd));
71#ifdef OPEN32_GDI
72 dprintf(("GetDC %x", hwnd));
73 return O32_GetDC(0);
74#else
75 //desktop window?
76 dprintf(("GetDC %x", hwnd));
77 return OSLibWinGetPS(OSLIB_HWND_DESKTOP);
78#endif
79 }
80 dprintf(("GetDC %x", hwnd));
81#ifdef OPEN32_GDI
82 return O32_GetDC(window->getOS2WindowHandle());
83#else
84 return OSLibWinGetPS(window->getOS2WindowHandle());
85#endif
86}
87//******************************************************************************
88//TODO
89//******************************************************************************
90HDC WIN32API GetDCEx(HWND hwnd, HRGN arg2, DWORD arg3)
91{
92#ifdef DEBUG
93 WriteLog("USER32: GetDCEx NOT CORRECT!\n");
94#endif
95 return GetDC(hwnd);
96}
97//******************************************************************************
98//******************************************************************************
99int WIN32API ReleaseDC(HWND hwnd, HDC hdc)
100{
101 dprintf(("ReleaseDC %x %x", hwnd, hdc));
102#ifdef OPEN32_GDI
103 return O32_ReleaseDC(hwnd,hdc);
104#else
105 return OSLibWinReleasePS(hdc);
106#endif
107}
108//******************************************************************************
109//******************************************************************************
110HDC WIN32API GetWindowDC(HWND hwnd)
111{
112 Win32Window *window;
113
114 window = Win32Window::GetWindowFromHandle(hwnd);
115 if(!window) {
116 dprintf(("GetWindowDC, window %x not found", hwnd));
117 return 0;
118 }
119 dprintf(("GetWindowDC %x", hwnd));
120#ifdef OPEN32_GDI
121 return O32_GetWindowDC(window->getOS2WindowHandle());
122#else
123 return OSLibWinGetPS(window->getOS2FrameWindowHandle());
124#endif
125}
126//******************************************************************************
127//******************************************************************************
128HWND WIN32API WindowFromDC(HDC hdc)
129{
130 dprintf(("USER32: WindowFromDC\n"));
131#ifdef OPEN32_GDI
132 return O32_WindowFromDC(hdc);
133#else
134 ?????
135#endif
136}
137//******************************************************************************
138//******************************************************************************
Note: See TracBrowser for help on using the repository browser.