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

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

* empty log message *

File size: 5.4 KB
Line 
1/* $Id: win32wnd.h,v 1.6 1999-07-17 11:52:23 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 xScreen, ULONG yScreen, ULONG xParent, ULONG yParent);
61 ULONG MsgSize(ULONG width, ULONG height, BOOL fMinimize, BOOL fMaximize);
62 ULONG MsgActivate(BOOL fActivate, HWND hwnd);
63 ULONG MsgSetFocus(HWND hwnd);
64 ULONG MsgKillFocus(HWND hwnd);
65 ULONG MsgButton(ULONG msg, ULONG x, ULONG y);
66 ULONG MsgPaint(ULONG tmp1, ULONG tmp2);
67 ULONG MsgEraseBackGround(ULONG hps);
68
69virtual LONG SetWindowLongA(int index, ULONG value);
70virtual ULONG GetWindowLongA(int index);
71virtual WORD SetWindowWord(int index, WORD value);
72virtual WORD GetWindowWord(int index);
73
74 DWORD getStyle() { return dwStyle; };
75 DWORD getExStyle() { return dwExStyle; };
76 HWND getWindowHandle() { return Win32Hwnd; };
77 HWND getOS2WindowHandle() { return OS2Hwnd; };
78 Win32Window *getParent() { return (Win32Window *)ChildWindow::GetParent(); };
79 void setParent(Win32Window *pwindow) { ChildWindow::SetParent((ChildWindow *)pwindow); };
80 WNDPROC getWindowProc() { return win32wndproc; };
81 void setWindowProc(WNDPROC newproc) { win32wndproc = newproc; };
82 DWORD getWindowId() { return windowId; };
83 void setWindowId(DWORD id) { windowId = id; };
84
85 DWORD getFlags() { return flags; };
86 void setFlags(DWORD newflags) { flags = newflags; };
87
88 BOOL SetMenu(ULONG hMenu);
89 BOOL ShowWindow(ULONG nCmdShow);
90 BOOL SetWindowPos(HWND hwndInsertAfter, int x, int y, int cx, int cy, UINT fuFlags);
91 BOOL DestroyWindow();
92 HWND SetActiveWindow();
93 HWND GetParent();
94 HWND SetParent(HWND hwndNewParent);
95 BOOL IsChild(HWND hwndParent);
96 HWND GetTopWindow();
97 BOOL UpdateWindow();
98 BOOL IsIconic();
99 HWND GetWindow(UINT uCmd);
100 BOOL EnableWindow(BOOL fEnable);
101 BOOL BringWindowToTop();
102 static HWND GetActiveWindow();
103 BOOL IsWindow();
104 BOOL IsWindowEnabled();
105 BOOL IsWindowVisible();
106
107 LRESULT SendMessageA(ULONG msg, WPARAM wParam, LPARAM lParam);
108 LRESULT SendMessageW(ULONG msg, WPARAM wParam, LPARAM lParam);
109 BOOL PostMessageA(ULONG msg, WPARAM wParam, LPARAM lParam);
110 BOOL PostMessageW(ULONG msg, WPARAM wParam, LPARAM lParam);
111 LRESULT DefWindowProcA(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
112 LRESULT DefWindowProcW(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
113
114 void NotifyParent(UINT Msg, WPARAM wParam, LPARAM lParam);
115
116Win32WndClass *getClass() { return windowClass; };
117
118static Win32Window *GetWindowFromHandle(HWND hwnd);
119
120protected:
121 void Init();
122
123 HWND OS2Hwnd;
124 HWND OS2HwndFrame;
125 HWND OS2HwndMenu;
126 HWND Win32Hwnd;
127 BOOL isUnicode;
128
129 int posx, posy, width, height;
130
131 // values normally contained in the standard window words
132 ULONG dwExStyle; //GWL_EXSTYLE
133 ULONG dwStyle; //GWL_STYLE
134 WNDPROC win32wndproc; //GWL_WNDPROC
135 ULONG hInstance; //GWL_HINSTANCE
136//Moved in ChildWindow class
137///// Win32Window *parent; //GWL_HWNDPARENT
138 ULONG windowId; //GWL_ID
139 ULONG userData; //GWL_USERDATA
140
141 HWND hwndLinkAfter;
142 DWORD flags;
143
144 BOOL isIcon;
145
146 Win32Window *owner;
147
148 char *windowName;
149 ULONG wndNameLength;
150
151 char *windowText;
152 ULONG wndTextLength;
153
154 ULONG *userWindowLong;
155 ULONG nrUserWindowLong;
156
157 RECT rectWindow;
158 RECT rectClient;
159
160Win32WndClass *windowClass;
161
162static GenericObject *windows;
163
164private:
165#ifndef OS2_INCLUDED
166 BOOL CreateWindowExA(CREATESTRUCTA *lpCreateStruct, ATOM classAtom);
167
168 void GetMinMaxInfo(POINT *maxSize, POINT *maxPos, POINT *minTrack, POINT *maxTrack );
169
170 LONG SendNCCalcSize(BOOL calcValidRect,
171 RECT *newWindowRect, RECT *oldWindowRect,
172 RECT *oldClientRect, WINDOWPOS *winpos,
173 RECT *newClientRect );
174
175 LRESULT sendMessage(ULONG msg, WPARAM wParam, LPARAM lParam)
176 {
177 if(isUnicode)
178 return SendMessageW(msg, wParam, lParam);
179 else return SendMessageA(msg, wParam, lParam);
180 }
181#endif
182};
183
184
185#define BUTTON_LEFTDOWN 0
186#define BUTTON_LEFTUP 1
187#define BUTTON_LEFTDBLCLICK 2
188#define BUTTON_RIGHTUP 3
189#define BUTTON_RIGHTDOWN 4
190#define BUTTON_RIGHTDBLCLICK 5
191
192#endif //__cplusplus
193
194#endif //__WIN32WND_H__
Note: See TracBrowser for help on using the repository browser.