win32_window.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * Copyright 2004 The WebRTC Project Authors. All rights reserved.
  3. *
  4. * Use of this source code is governed by a BSD-style license
  5. * that can be found in the LICENSE file in the root of the source
  6. * tree. An additional intellectual property rights grant can be found
  7. * in the file PATENTS. All contributing project authors may
  8. * be found in the AUTHORS file in the root of the source tree.
  9. */
  10. #ifndef RTC_BASE_WIN32_WINDOW_H_
  11. #define RTC_BASE_WIN32_WINDOW_H_
  12. #if defined(WEBRTC_WIN)
  13. #include "rtc_base/win32.h"
  14. namespace rtc {
  15. ///////////////////////////////////////////////////////////////////////////////
  16. // Win32Window
  17. ///////////////////////////////////////////////////////////////////////////////
  18. class Win32Window {
  19. public:
  20. Win32Window();
  21. virtual ~Win32Window();
  22. HWND handle() const { return wnd_; }
  23. bool Create(HWND parent,
  24. const wchar_t* title,
  25. DWORD style,
  26. DWORD exstyle,
  27. int x,
  28. int y,
  29. int cx,
  30. int cy);
  31. void Destroy();
  32. // Call this when your DLL unloads.
  33. static void Shutdown();
  34. protected:
  35. virtual bool OnMessage(UINT uMsg,
  36. WPARAM wParam,
  37. LPARAM lParam,
  38. LRESULT& result);
  39. virtual bool OnClose();
  40. virtual void OnNcDestroy();
  41. private:
  42. static LRESULT CALLBACK WndProc(HWND hwnd,
  43. UINT uMsg,
  44. WPARAM wParam,
  45. LPARAM lParam);
  46. HWND wnd_;
  47. static HINSTANCE instance_;
  48. static ATOM window_class_;
  49. };
  50. ///////////////////////////////////////////////////////////////////////////////
  51. } // namespace rtc
  52. #endif // WEBRTC_WIN
  53. #endif // RTC_BASE_WIN32_WINDOW_H_