source: trunk/src/user32/new/win32wnd.h@ 332

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

* empty log message *

File size: 6.6 KB
Line 
1/* $Id: win32wnd.h,v 1.13 1999-07-18 18:04:30 sandervl Exp $ */
2/*
3 * Win32 Window Code for OS/2
4 *
5 *
6 * Copyright 1998-1999 Sander van Leeuwen (sandervl@xs4all.nl)
7 *
8 *
9 * Project Odin Software License can be found in LICENSE.TXT
10 *
11 */
12#ifndef __WIN32WND_H__
13#define __WIN32WND_H__
14
15#ifdef __cplusplus
16
17#include <win32class.h>
18#include <gen_object.h>
19#include <win32wndchild.h>
20
21class Win32Window;
22
23#define OFFSET_WIN32WNDPTR 0
24#define OFFSET_WIN32PM_MAGIC 4
25
26#define WIN32PM_MAGIC 0x12345678
27#define CheckMagicDword(a) (a==WIN32PM_MAGIC)
28
29typedef struct {
30 USHORT cb;
31 Win32Window *win32wnd;
32 ULONG win32CreateStruct; //or dialog create dword
33} CUSTOMWNDDATA;
34
35typedef struct
36{
37 ULONG Msg;
38 ULONG wParam;
39 ULONG lParam;
40} POSTMSG_PACKET;
41
42#define WM_WIN32_POSTMESSAGEA 0x4000
43#define WM_WIN32_POSTMESSAGEW 0x4001
44
45class Win32Window : private GenericObject, private ChildWindow
46{
47public:
48 DWORD magic;
49
50 Win32Window(DWORD objType);
51 Win32Window(CREATESTRUCTA *lpCreateStructA, ATOM classAtom, BOOL isUnicode);
52virtual ~Win32Window();
53
54virtual ULONG MsgCreate(HWND hwndOS2, ULONG initParam);
55 ULONG MsgQuit();
56 ULONG MsgClose();
57 ULONG MsgDestroy();
58 ULONG MsgEnable(BOOL fEnable);
59 ULONG MsgShow(BOOL fShow);
60 ULONG MsgMove(ULONG x, ULONG y);
61 ULONG MsgHitTest(ULONG x, ULONG y);
62 ULONG MsgSize(ULONG width, ULONG height, BOOL fMinimize, BOOL fMaximize);
63 ULONG MsgActivate(BOOL fActivate, HWND hwnd);
64 ULONG MsgSetFocus(HWND hwnd);
65 ULONG MsgKillFocus(HWND hwnd);
66 ULONG MsgButton(ULONG msg, ULONG x, ULONG y);
67 ULONG MsgMouseMove(ULONG keystate, ULONG x, ULONG y);
68 ULONG MsgPaint(ULONG tmp1, ULONG tmp2);
69 ULONG MsgEraseBackGround(ULONG hps);
70 ULONG MsgSetText(LPSTR lpsz, LONG cch);
71
72virtual LONG SetWindowLongA(int index, ULONG value);
73virtual ULONG GetWindowLongA(int index);
74virtual WORD SetWindowWord(int index, WORD value);
75virtual WORD GetWindowWord(int index);
76
77 DWORD getStyle() { return dwStyle; };
78 DWORD getExStyle() { return dwExStyle; };
79 HWND getWindowHandle() { return Win32Hwnd; };
80 HWND getOS2WindowHandle() { return OS2Hwnd; };
81 Win32Window *getParent() { return (Win32Window *)ChildWindow::GetParent(); };
82 void setParent(Win32Window *pwindow) { ChildWindow::SetParent((ChildWindow *)pwindow); };
83 WNDPROC getWindowProc() { return win32wndproc; };
84 void setWindowProc(WNDPROC newproc) { win32wndproc = newproc; };
85 DWORD getWindowId() { return windowId; };
86 void setWindowId(DWORD id) { windowId = id; };
87
88 DWORD getFlags() { return flags; };
89 void setFlags(DWORD newflags) { flags = newflags; };
90
91 BOOL SetMenu(ULONG hMenu);
92 BOOL ShowWindow(ULONG nCmdShow);
93 BOOL SetWindowPos(HWND hwndInsertAfter, int x, int y, int cx, int cy, UINT fuFlags);
94 BOOL DestroyWindow();
95 HWND SetActiveWindow();
96 HWND GetParent();
97 HWND SetParent(HWND hwndNewParent);
98 BOOL IsChild(HWND hwndParent);
99 HWND GetTopWindow();
100 BOOL UpdateWindow();
101 BOOL IsIconic();
102 HWND GetWindow(UINT uCmd);
103 BOOL EnableWindow(BOOL fEnable);
104 BOOL CloseWindow();
105 BOOL BringWindowToTop();
106 static HWND GetActiveWindow();
107 BOOL IsWindow();
108 BOOL IsWindowEnabled();
109 BOOL IsWindowVisible();
110 BOOL IsUnicode() { return isUnicode; };
111
112 BOOL GetWindowRect(PRECT pRect);
113 int GetWindowTextLengthA();
114 int GetWindowTextA(LPSTR lpsz, int cch);
115 BOOL SetWindowTextA(LPCSTR lpsz);
116
117 LRESULT SendMessageA(ULONG msg, WPARAM wParam, LPARAM lParam);
118 LRESULT SendMessageW(ULONG msg, WPARAM wParam, LPARAM lParam);
119 BOOL PostMessageA(ULONG msg, WPARAM wParam, LPARAM lParam);
120 BOOL PostMessageW(ULONG msg, WPARAM wParam, LPARAM lParam);
121 LRESULT DefWindowProcA(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
122 LRESULT DefWindowProcW(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
123
124 void NotifyParent(UINT Msg, WPARAM wParam, LPARAM lParam);
125
126Win32WndClass *getClass() { return windowClass; };
127
128static HWND Win32ToOS2Handle(HWND hwnd)
129{
130 Win32Window *window = GetWindowFromHandle(hwnd);
131
132 if(window) {
133 return window->getOS2WindowHandle();
134 }
135 else return hwnd; //OS/2 window handle
136}
137
138static HWND OS2ToWin32Handle(HWND hwnd)
139{
140 Win32Window *window = GetWindowFromOS2Handle(hwnd);
141
142 if(window) {
143 return window->getWindowHandle();
144 }
145 else return hwnd; //OS/2 window handle
146}
147
148static Win32Window *GetWindowFromHandle(HWND hwnd);
149static Win32Window *GetWindowFromOS2Handle(HWND hwnd);
150
151protected:
152 LRESULT SendInternalMessageA(ULONG msg, WPARAM wParam, LPARAM lParam);
153 LRESULT SendInternalMessageW(ULONG msg, WPARAM wParam, LPARAM lParam);
154 void Init();
155
156 HWND OS2Hwnd;
157 HWND OS2HwndFrame;
158 HWND OS2HwndMenu;
159 HWND Win32Hwnd;
160 BOOL isUnicode;
161
162 int posx, posy, width, height;
163
164 // values normally contained in the standard window words
165 ULONG dwExStyle; //GWL_EXSTYLE
166 ULONG dwStyle; //GWL_STYLE
167 WNDPROC win32wndproc; //GWL_WNDPROC
168 ULONG hInstance; //GWL_HINSTANCE
169//Moved in ChildWindow class
170///// Win32Window *parent; //GWL_HWNDPARENT
171 ULONG windowId; //GWL_ID
172 ULONG userData; //GWL_USERDATA
173
174 HWND hwndLinkAfter;
175 DWORD flags;
176 DWORD lastHitTestVal; //Last value returned by WM_NCHITTEST handler
177
178 BOOL isIcon;
179
180 Win32Window *owner;
181
182 char *windowName;
183 ULONG wndNameLength;
184
185 char *windowText;
186 ULONG wndTextLength;
187
188 ULONG *userWindowLong;
189 ULONG nrUserWindowLong;
190
191 RECT rectWindow;
192 RECT rectClient;
193
194Win32WndClass *windowClass;
195
196static GenericObject *windows;
197
198private:
199#ifndef OS2_INCLUDED
200 BOOL CreateWindowExA(CREATESTRUCTA *lpCreateStruct, ATOM classAtom);
201
202 void GetMinMaxInfo(POINT *maxSize, POINT *maxPos, POINT *minTrack, POINT *maxTrack );
203
204 LONG SendNCCalcSize(BOOL calcValidRect,
205 RECT *newWindowRect, RECT *oldWindowRect,
206 RECT *oldClientRect, WINDOWPOS *winpos,
207 RECT *newClientRect );
208
209 LRESULT SendInternalMessage(ULONG msg, WPARAM wParam, LPARAM lParam)
210 {
211 if(isUnicode)
212 return SendInternalMessageW(msg, wParam, lParam);
213 else return SendInternalMessageA(msg, wParam, lParam);
214 }
215#endif
216};
217
218
219#define BUTTON_LEFTDOWN 0
220#define BUTTON_LEFTUP 1
221#define BUTTON_LEFTDBLCLICK 2
222#define BUTTON_RIGHTUP 3
223#define BUTTON_RIGHTDOWN 4
224#define BUTTON_RIGHTDBLCLICK 5
225#define BUTTON_MIDDLEUP 6
226#define BUTTON_MIDDLEDOWN 7
227#define BUTTON_MIDDLEDBLCLICK 8
228
229#define WMMOVE_LBUTTON 1
230#define WMMOVE_MBUTTON 2
231#define WMMOVE_RBUTTON 4
232#define WMMOVE_CTRL 8
233#define WMMOVE_SHIFT 16
234
235
236#endif //__cplusplus
237
238#endif //__WIN32WND_H__
Note: See TracBrowser for help on using the repository browser.