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

Last change on this file since 650 was 650, checked in by dengert, 26 years ago

WM_ERASEBKGND sent from BeginPaint now

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