1 | /* $Id: wingdi.cpp,v 1.7 1999-07-25 09:19:22 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 | //******************************************************************************
|
---|
24 | HDC 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 | return hdc;
|
---|
43 |
|
---|
44 | // return lps->hdc;
|
---|
45 | }
|
---|
46 | //******************************************************************************
|
---|
47 | //******************************************************************************
|
---|
48 | BOOL WIN32API EndPaint(HWND hwnd, const PAINTSTRUCT *lps)
|
---|
49 | {
|
---|
50 | dprintf(("EndPaint %x\n", hwnd));
|
---|
51 | #ifdef OPEN32_GDI
|
---|
52 | return O32_EndPaint(hwnd,lps);
|
---|
53 | //CB: dito
|
---|
54 | #else
|
---|
55 | return OSLibWinEndPaint(lps->hdc);
|
---|
56 | #endif
|
---|
57 | }
|
---|
58 | //******************************************************************************
|
---|
59 | //TODO: PARENT_DC flag
|
---|
60 | //******************************************************************************
|
---|
61 | HDC WIN32API GetDC(HWND hwnd)
|
---|
62 | {
|
---|
63 | Win32Window *window;
|
---|
64 |
|
---|
65 | window = Win32Window::GetWindowFromHandle(hwnd);
|
---|
66 | if(!window) {
|
---|
67 | dprintf(("GetDC, window %x not found", hwnd));
|
---|
68 | return 0;
|
---|
69 | }
|
---|
70 | dprintf(("GetDC %x", hwnd));
|
---|
71 | #ifdef OPEN32_GDI
|
---|
72 | return O32_GetDC(window->getOS2WindowHandle());
|
---|
73 | #else
|
---|
74 | return OSLibWinGetPS(window->getOS2WindowHandle());
|
---|
75 | #endif
|
---|
76 | }
|
---|
77 | //******************************************************************************
|
---|
78 | //TODO
|
---|
79 | //******************************************************************************
|
---|
80 | HDC WIN32API GetDCEx(HWND hwnd, HRGN arg2, DWORD arg3)
|
---|
81 | {
|
---|
82 | #ifdef DEBUG
|
---|
83 | WriteLog("USER32: GetDCEx NOT CORRECT!\n");
|
---|
84 | #endif
|
---|
85 | return GetDC(hwnd);
|
---|
86 | }
|
---|
87 | //******************************************************************************
|
---|
88 | //******************************************************************************
|
---|
89 | int WIN32API ReleaseDC(HWND hwnd, HDC hdc)
|
---|
90 | {
|
---|
91 | #ifdef OPEN32_GDI
|
---|
92 | return O32_ReleaseDC(hwnd,hdc);
|
---|
93 | #else
|
---|
94 | return OSLibWinReleasePS(hdc);
|
---|
95 | #endif
|
---|
96 | }
|
---|
97 | //******************************************************************************
|
---|
98 | //******************************************************************************
|
---|
99 | HDC WIN32API GetWindowDC(HWND hwnd)
|
---|
100 | {
|
---|
101 | Win32Window *window;
|
---|
102 |
|
---|
103 | window = Win32Window::GetWindowFromHandle(hwnd);
|
---|
104 | if(!window) {
|
---|
105 | dprintf(("GetWindowDC, window %x not found", hwnd));
|
---|
106 | return 0;
|
---|
107 | }
|
---|
108 | dprintf(("GetWindowDC %x", hwnd));
|
---|
109 | #ifdef OPEN32_GDI
|
---|
110 | return O32_GetWindowDC(window->getOS2WindowHandle());
|
---|
111 | #else
|
---|
112 | return OSLibWinGetPS(window->getOS2FrameWindowHandle());
|
---|
113 | #endif
|
---|
114 | }
|
---|
115 | //******************************************************************************
|
---|
116 | //******************************************************************************
|
---|