Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.7 KiB

  1. /*
  2. * Native
  3. */
  4. #ifndef DUI_CONTROL_NATIVE_H_INCLUDED
  5. #define DUI_CONTROL_NATIVE_H_INCLUDED
  6. #pragma once
  7. namespace DirectUI
  8. {
  9. ////////////////////////////////////////////////////////
  10. // Top-level native HWND host of HWNDElement
  11. #define NHHO_IgnoreClose 1 // Ignore WM_CLOSE (i.e. Alt-F4, 'X' button), must be closed via DestroyWindow
  12. #define NHHO_NoSendQuitMessage 2
  13. #define NHHO_HostControlsSize 4
  14. #define NHHO_ScreenCenter 8
  15. #define NHHO_DeleteOnHWNDDestroy 16 // If the HWND is destroyed, destroy NativeHWNDHost instance
  16. #define NHHM_ASYNCDESTROY WM_USER
  17. class NativeHWNDHost
  18. {
  19. public:
  20. static HRESULT Create(LPCWSTR pszTitle, HWND hWndParent, HICON hIcon, int dX, int dY, int dWidth, int dHeight, int iExStyle, int iStyle, UINT nOptions, OUT NativeHWNDHost** ppHost);
  21. void Destroy() { HDelete<NativeHWNDHost>(this); }
  22. HWND GetHWND() { return _hWnd; }
  23. Element* GetElement() { return _pe; }
  24. void Host(Element* pe);
  25. void ShowWindow(int iShow = SW_SHOWNORMAL) { DUIAssertNoMsg(_hWnd); ::ShowWindow(_hWnd, iShow); }
  26. void HideWindow() { DUIAssertNoMsg(_hWnd); ::ShowWindow(_hWnd, SW_HIDE); }
  27. void DestroyWindow() { DUIAssertNoMsg(_hWnd); PostMessage(_hWnd, NHHM_ASYNCDESTROY, 0, 0); }
  28. static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  29. NativeHWNDHost() { }
  30. HRESULT Initialize(LPCWSTR pszTitle, HWND hWndParent, HICON hIcon, int dX, int dY, int dWidth, int dHeight, int iExStyle, int iStyle, UINT nOptions);
  31. virtual ~NativeHWNDHost() { }
  32. private:
  33. HWND _hWnd;
  34. Element* _pe;
  35. UINT _nOptions;
  36. };
  37. } // namespace DirectUI
  38. #endif // DUI_CONTROL_NATIVE_H_INCLUDED