aboutsummaryrefslogtreecommitdiff
path: root/Src/Wasabi/api/wnd/wndclass/foreignwnd.h
blob: 023cb6b147c81ee93ae0daea715c54971ac00999 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef __FOREIGNWND_H
#define __FOREIGNWND_H

#ifdef _WIN32
#include <api/wnd/basewnd.h>

class ForeignWnd;

class ForeignWndProc
{
public:
	ForeignWnd *wnd;
	HWND hwnd;
	WNDPROC oldWindowProc;
};

class ForeignWndProcComparator
{
public:
	// comparator for sorting
	static int compareItem(ForeignWndProc *p1, ForeignWndProc* p2)
	{
		return CMP3(p1->hwnd, p2->hwnd);
	}
	// comparator for searching
	static int compareAttrib(const wchar_t *attrib, ForeignWndProc *item)
	{
		return CMP3((HWND)attrib, item->hwnd);
	}
};

class ForeignWnd : public BaseWnd
{
public:
	// takes over an existing OSWINDOWHANDLE and wraps a BaseWnd around it
	// but does not changes the windowproc, nor does it inserts the wnd
	// into the system list. It does not either (under windows anyway)
	// sets the userdata windowlong to the object pointer.
	// if subclass is true, we subclas the windowproc and process events
	// as if the window was a real rootwnd

	ForeignWnd(OSWINDOWHANDLE w, OSMODULEHANDLE m, int subclass = 0);

	virtual ~ForeignWnd();

	static PtrListQuickSorted<ForeignWndProc, ForeignWndProcComparator> foreignwndprocs;

private:
	WNDPROC oldWindowProc;
	HWND thishwnd;
	ForeignWndProc *wndprocentry;
};
#else
#warning port me
#endif
#endif