foreignwnd.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #ifndef __FOREIGNWND_H
  2. #define __FOREIGNWND_H
  3. #ifdef _WIN32
  4. #include <api/wnd/basewnd.h>
  5. class ForeignWnd;
  6. class ForeignWndProc
  7. {
  8. public:
  9. ForeignWnd *wnd;
  10. HWND hwnd;
  11. WNDPROC oldWindowProc;
  12. };
  13. class ForeignWndProcComparator
  14. {
  15. public:
  16. // comparator for sorting
  17. static int compareItem(ForeignWndProc *p1, ForeignWndProc* p2)
  18. {
  19. return CMP3(p1->hwnd, p2->hwnd);
  20. }
  21. // comparator for searching
  22. static int compareAttrib(const wchar_t *attrib, ForeignWndProc *item)
  23. {
  24. return CMP3((HWND)attrib, item->hwnd);
  25. }
  26. };
  27. class ForeignWnd : public BaseWnd
  28. {
  29. public:
  30. // takes over an existing OSWINDOWHANDLE and wraps a BaseWnd around it
  31. // but does not changes the windowproc, nor does it inserts the wnd
  32. // into the system list. It does not either (under windows anyway)
  33. // sets the userdata windowlong to the object pointer.
  34. // if subclass is true, we subclas the windowproc and process events
  35. // as if the window was a real rootwnd
  36. ForeignWnd(OSWINDOWHANDLE w, OSMODULEHANDLE m, int subclass = 0);
  37. virtual ~ForeignWnd();
  38. static PtrListQuickSorted<ForeignWndProc, ForeignWndProcComparator> foreignwndprocs;
  39. private:
  40. WNDPROC oldWindowProc;
  41. HWND thishwnd;
  42. ForeignWndProc *wndprocentry;
  43. };
  44. #else
  45. #warning port me
  46. #endif
  47. #endif