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

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

Misc window class changes/bugfixes

File size: 5.1 KB
Line 
1/* $Id: win32wnd.h,v 1.4 1999-07-16 11:32:09 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 OS2HwndMenu;
117 HWND Win32Hwnd;
118 BOOL isUnicode;
119
120 int posx, posy, width, height;
121
122 // values normally contained in the standard window words
123 ULONG dwExStyle; //GWL_EXSTYLE
124 ULONG dwStyle; //GWL_STYLE
125 WNDPROC win32wndproc; //GWL_WNDPROC
126 ULONG hInstance; //GWL_HINSTANCE
127//Moved in ChildWindow class
128///// Win32Window *parent; //GWL_HWNDPARENT
129 ULONG windowId; //GWL_ID
130 ULONG userData; //GWL_USERDATA
131
132 HWND hwndLinkAfter;
133 DWORD flags;
134
135 Win32Window *owner;
136
137 char *windowName;
138 ULONG wndNameLength;
139
140 char *windowText;
141 ULONG wndTextLength;
142
143 ULONG *userWindowLong;
144 ULONG nrUserWindowLong;
145
146 RECT rectWindow;
147 RECT rectClient;
148
149Win32WndClass *windowClass;
150
151static GenericObject *windows;
152
153private:
154#ifndef OS2_INCLUDED
155 BOOL CreateWindowExA(CREATESTRUCTA *lpCreateStruct, ATOM classAtom);
156
157 void GetMinMaxInfo(POINT *maxSize, POINT *maxPos, POINT *minTrack, POINT *maxTrack );
158
159 LONG SendNCCalcSize(BOOL calcValidRect,
160 RECT *newWindowRect, RECT *oldWindowRect,
161 RECT *oldClientRect, WINDOWPOS *winpos,
162 RECT *newClientRect );
163
164 LRESULT sendMessage(ULONG msg, WPARAM wParam, LPARAM lParam)
165 {
166 if(isUnicode)
167 return SendMessageW(msg, wParam, lParam);
168 else return SendMessageA(msg, wParam, lParam);
169 }
170#endif
171};
172
173
174#define BUTTON_LEFTDOWN 0
175#define BUTTON_LEFTUP 1
176#define BUTTON_LEFTDBLCLICK 2
177#define BUTTON_RIGHTUP 3
178#define BUTTON_RIGHTDOWN 4
179#define BUTTON_RIGHTDBLCLICK 5
180
181#endif //__cplusplus
182
183#endif //__WIN32WND_H__
Note: See TracBrowser for help on using the repository browser.