| 1 | /* $Id: win32wnd.h,v 1.2 1999-07-14 08:35:37 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 |
|
|---|
| 20 | class Win32Window;
|
|---|
| 21 |
|
|---|
| 22 | #define WIN2OS2HWND(a) (Win32Window*)(a^a)
|
|---|
| 23 | #define OS22WINHWND(a) (a^a)
|
|---|
| 24 |
|
|---|
| 25 | #define OFFSET_WIN32WNDPTR 0
|
|---|
| 26 | #define OFFSET_WIN32PM_MAGIC 4
|
|---|
| 27 |
|
|---|
| 28 | #define WIN32PM_MAGIC 0x12345678
|
|---|
| 29 |
|
|---|
| 30 | typedef struct {
|
|---|
| 31 | USHORT cb;
|
|---|
| 32 | Win32Window *win32wnd;
|
|---|
| 33 | ULONG win32CreateStruct; //or dialog create dword
|
|---|
| 34 | } CUSTOMWNDDATA;
|
|---|
| 35 |
|
|---|
| 36 | class Win32Window : public GenericObject
|
|---|
| 37 | {
|
|---|
| 38 | public:
|
|---|
| 39 | DWORD magic;
|
|---|
| 40 |
|
|---|
| 41 | Win32Window(DWORD objType);
|
|---|
| 42 | Win32Window(CREATESTRUCTA *lpCreateStructA, ATOM classAtom, BOOL isUnicode);
|
|---|
| 43 | virtual ~Win32Window();
|
|---|
| 44 |
|
|---|
| 45 | virtual ULONG MsgCreate(HWND hwndOS2, ULONG initParam);
|
|---|
| 46 | ULONG MsgQuit();
|
|---|
| 47 | ULONG MsgClose();
|
|---|
| 48 | ULONG MsgDestroy();
|
|---|
| 49 | ULONG MsgEnable(BOOL fEnable);
|
|---|
| 50 | ULONG MsgShow(BOOL fShow);
|
|---|
| 51 | ULONG MsgMove(ULONG xScreen, ULONG yScreen, ULONG xParent, ULONG yParent);
|
|---|
| 52 | ULONG MsgSize(ULONG width, ULONG height, BOOL fMinimize, BOOL fMaximize);
|
|---|
| 53 | ULONG MsgActivate(BOOL fActivate, HWND hwnd);
|
|---|
| 54 | ULONG MsgSetFocus(HWND hwnd);
|
|---|
| 55 | ULONG MsgKillFocus(HWND hwnd);
|
|---|
| 56 | ULONG MsgButton(ULONG msg, ULONG x, ULONG y);
|
|---|
| 57 | ULONG MsgPaint(ULONG tmp1, ULONG tmp2);
|
|---|
| 58 | ULONG MsgEraseBackGround(ULONG hps);
|
|---|
| 59 |
|
|---|
| 60 | virtual LONG SetWindowLongA(int index, ULONG value);
|
|---|
| 61 | virtual ULONG GetWindowLongA(int index);
|
|---|
| 62 | virtual WORD SetWindowWord(int index, WORD value);
|
|---|
| 63 | virtual WORD GetWindowWord(int index);
|
|---|
| 64 |
|
|---|
| 65 | DWORD getStyle() { return dwStyle; };
|
|---|
| 66 | DWORD getExStyle() { return dwExStyle; };
|
|---|
| 67 | HWND getWindowHandle() { return Win32Hwnd; };
|
|---|
| 68 | HWND getOS2WindowHandle() { return OS2Hwnd; };
|
|---|
| 69 | Win32Window *getParent() { return parent; };
|
|---|
| 70 | void setParent(Win32Window *pwindow) { parent = pwindow; };
|
|---|
| 71 | WNDPROC getWindowProc() { return win32wndproc; };
|
|---|
| 72 | void setWindowProc(WNDPROC newproc) { win32wndproc = newproc; };
|
|---|
| 73 | DWORD getWindowId() { return windowId; };
|
|---|
| 74 | void setWindowId(DWORD id) { windowId = id; };
|
|---|
| 75 |
|
|---|
| 76 | LRESULT SendMessageA(ULONG msg, WPARAM wParam, LPARAM lParam);
|
|---|
| 77 | LRESULT SendMessageW(ULONG msg, WPARAM wParam, LPARAM lParam);
|
|---|
| 78 | LRESULT DefWindowProcA(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
|---|
| 79 | LRESULT DefWindowProcW(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
|---|
| 80 |
|
|---|
| 81 | void NotifyParent(UINT Msg, WPARAM wParam, LPARAM lParam);
|
|---|
| 82 |
|
|---|
| 83 | Win32WndClass *getClass() { return windowClass; };
|
|---|
| 84 |
|
|---|
| 85 | protected:
|
|---|
| 86 | void Init();
|
|---|
| 87 |
|
|---|
| 88 |
|
|---|
| 89 | HWND OS2Hwnd;
|
|---|
| 90 | HWND Win32Hwnd;
|
|---|
| 91 | BOOL isUnicode;
|
|---|
| 92 |
|
|---|
| 93 | int posx, posy, width, height;
|
|---|
| 94 |
|
|---|
| 95 | // values normally contained in the standard window words
|
|---|
| 96 | ULONG dwExStyle; //GWL_EXSTYLE
|
|---|
| 97 | ULONG dwStyle; //GWL_STYLE
|
|---|
| 98 | WNDPROC win32wndproc; //GWL_WNDPROC
|
|---|
| 99 | ULONG hInstance; //GWL_HINSTANCE
|
|---|
| 100 | Win32Window *parent; //GWL_HWNDPARENT
|
|---|
| 101 | ULONG windowId; //GWL_ID
|
|---|
| 102 | ULONG userData; //GWL_USERDATA
|
|---|
| 103 |
|
|---|
| 104 | HWND hwndLinkAfter;
|
|---|
| 105 | DWORD flags;
|
|---|
| 106 |
|
|---|
| 107 | Win32Window *owner;
|
|---|
| 108 |
|
|---|
| 109 | char *windowName;
|
|---|
| 110 | ULONG wndNameLength;
|
|---|
| 111 |
|
|---|
| 112 | char *windowText;
|
|---|
| 113 | ULONG wndTextLength;
|
|---|
| 114 |
|
|---|
| 115 | ULONG *userWindowLong;
|
|---|
| 116 | ULONG nrUserWindowLong;
|
|---|
| 117 |
|
|---|
| 118 | Win32WndClass *windowClass;
|
|---|
| 119 |
|
|---|
| 120 | static GenericObject *windows;
|
|---|
| 121 |
|
|---|
| 122 | private:
|
|---|
| 123 | BOOL CreateWindowExA(CREATESTRUCTA *lpCreateStruct, ATOM classAtom);
|
|---|
| 124 |
|
|---|
| 125 | void GetMinMaxInfo(POINT *maxSize, POINT *maxPos, POINT *minTrack, POINT *maxTrack );
|
|---|
| 126 | };
|
|---|
| 127 |
|
|---|
| 128 |
|
|---|
| 129 | #define BUTTON_LEFTDOWN 0
|
|---|
| 130 | #define BUTTON_LEFTUP 1
|
|---|
| 131 | #define BUTTON_LEFTDBLCLICK 2
|
|---|
| 132 | #define BUTTON_RIGHTUP 3
|
|---|
| 133 | #define BUTTON_RIGHTDOWN 4
|
|---|
| 134 | #define BUTTON_RIGHTDBLCLICK 5
|
|---|
| 135 |
|
|---|
| 136 | #endif //__cplusplus
|
|---|
| 137 |
|
|---|
| 138 | #endif //__WIN32WND_H__
|
|---|