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

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

Lots of changes/additions

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