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

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

new DC related code

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