source: trunk/src/user32/oslibgdi.h@ 5655

Last change on this file since 5655 was 4628, checked in by sandervl, 25 years ago

SetWindowPos fixes for SWP_FRAMECHANGED

File size: 3.4 KB
Line 
1/* $Id: oslibgdi.h,v 1.8 2000-11-19 11:52:39 sandervl Exp $ */
2/*
3 * Window GDI wrapper functions 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#ifndef __OSLIBGDI_H__
13#define __OSLIBGDI_H__
14
15#ifdef OS2_INCLUDED
16#include "win32type.h"
17#endif
18#include <win32wbase.h>
19
20typedef struct
21{
22 LONG xLeft;
23 LONG yBottom;
24 LONG xRight;
25 LONG yTop;
26} RECTLOS2, *PRECTLOS2;
27
28typedef struct
29{
30 LONG x;
31 LONG y;
32} OSLIBPOINT;
33
34//Mapping functions
35
36INT mapScreenY(INT screenPosY);
37INT mapScreenY(INT screenH,INT screenPosY);
38INT inline mapY(INT height, int y)
39{
40 return height - 1 - y;
41}
42
43INT inline mapY(Win32BaseWindow *win32wnd,INT y)
44{
45 return win32wnd->getWindowHeight() - 1 - y;
46}
47
48INT inline mapOS2ToWin32Y(Win32BaseWindow *win32wnd,INT y)
49{
50 return win32wnd->getWindowHeight() - 1 - (y + win32wnd->getClientRectPtr()->top);
51}
52
53INT inline mapOS2ToWin32X(Win32BaseWindow *win32wnd,INT x)
54{
55 return x - win32wnd->getClientRectPtr()->left;
56}
57
58INT inline mapWin32ToOS2Y(Win32BaseWindow *win32wnd,INT y)
59{
60 if(win32wnd->getParent()) {
61 return win32wnd->getWindowHeight() - 1 - (y - win32wnd->getParent()->getClientRectPtr()->top);
62 }
63 else return y;
64}
65
66INT inline mapWin32ToOS2X(Win32BaseWindow *win32wnd,INT x)
67{
68 if(win32wnd->getParent()) {
69 return x + win32wnd->getParent()->getClientRectPtr()->left;
70 }
71 else return x;
72}
73
74INT mapOS2ToWin32Y(Win32BaseWindow *wndFrom,Win32BaseWindow *wndTo,INT fromPosY);
75INT mapWin32Y(Win32BaseWindow *wndFrom,Win32BaseWindow *wndTo,INT fromPosY);
76BOOL mapScreenPoint(OSLIBPOINT *screenPt);
77BOOL mapScreenPoint(INT screenH,OSLIBPOINT *screenPt);
78
79BOOL mapOS2ToWin32Rect(int height, PRECTLOS2 rectOS2, PRECT rectWin32);
80BOOL mapWin32ToOS2Rect(int height, PRECT rectWin32,PRECTLOS2 rectOS2);
81
82BOOL mapWin32ToOS2RectClientToFrame(Win32BaseWindow *window, PRECT rectWin32,PRECTLOS2 rectOS2);
83BOOL mapOS2ToWin32RectFrameToClient(Win32BaseWindow *window, PRECTLOS2 rectOS2, PRECT rectWin32);
84
85#define mapWin32ToOS2RectFrame(window, rectWin32, rectOS2) \
86 if(window->getParent()) { \
87 mapWin32ToOS2Rect(window->getParent()->getWindowHeight(), rectWin32, rectOS2); \
88 } \
89 else mapWin32ToOS2Rect(OSLibQueryScreenHeight(), rectWin32, rectOS2);
90
91#define mapWin32ToOS2RectClient(window, rectWin32, rectOS2) \
92 mapWin32ToOS2Rect(window->getClientHeight(), rectWin32, rectOS2)
93
94#define mapWin32ToOS2ScreenRect(rectOS2, rectWin32) \
95 mapWin32ToOS2Rect(OSLibQueryScreenHeight(), rectOS2, rectWin32)
96
97#define mapOS2ToWin32RectFrame(window, rectOS2, rectWin32) \
98 if(window->getParent()) { \
99 mapOS2ToWin32Rect(window->getParent()->getWindowHeight(), rectOS2, rectWin32); \
100 } \
101 else mapOS2ToWin32Rect(OSLibQueryScreenHeight(), rectOS2, rectWin32);
102
103
104#define mapOS2ToWin32RectClient(window, rectOS2, rectWin32) \
105 mapOS2ToWin32Rect(window->getClientHeight(), rectOS2, rectWin32)
106
107#define mapOS2ToWin32ScreenRect(rectOS2, rectWin32) \
108 mapOS2ToWin32Rect(OSLibQueryScreenHeight(), rectOS2, rectWin32)
109
110BOOL copyOS2ToWin32Rect(PRECTLOS2 rectOS2,PRECT rectWin32);
111BOOL copyWin32ToOS2WindowRect(PRECT rectWin32,PRECTLOS2 rectOS2);
112INT mapOS2ToWin32ChildOrigin(INT parentH,INT parentPosY,INT childH);
113
114#define RECT_WIDTH(a) ((a).right - (a).left)
115#define RECT_HEIGHT(a) ((a).bottom - (a).top)
116
117#endif //__OSLIBGDI_H__
Note: See TracBrowser for help on using the repository browser.