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.

116 lines
2.3 KiB

  1. /*++
  2. Copyright (c) 2001, Microsoft Corporation
  3. Module Name:
  4. ui.cpp
  5. Abstract:
  6. This file implements the UI Class.
  7. Author:
  8. Revision History:
  9. Notes:
  10. --*/
  11. #include "private.h"
  12. #include "ui.h"
  13. //+---------------------------------------------------------------------------
  14. //
  15. // OnCreate
  16. //
  17. //+---------------------------------------------------------------------------
  18. /* static */
  19. VOID
  20. UI::OnCreate(
  21. HWND hUIWnd)
  22. {
  23. UI* pv = (UI*)GetWindowLongPtr(hUIWnd, IMMGWLP_PRIVATE);
  24. if (pv != NULL)
  25. {
  26. DebugMsg(TF_ERROR, TEXT("UI::OnCreate. pv!=NULL"));
  27. return;
  28. }
  29. pv = new UI(hUIWnd);
  30. if (pv == NULL)
  31. {
  32. DebugMsg(TF_ERROR, TEXT("UI::OnCreate. pv==NULL"));
  33. return;
  34. }
  35. pv->_Create();
  36. }
  37. //+---------------------------------------------------------------------------
  38. //
  39. // OnDestroy
  40. //
  41. //+---------------------------------------------------------------------------
  42. /* static */
  43. VOID
  44. UI::OnDestroy(
  45. HWND hUIWnd)
  46. {
  47. UI* pv = (UI*)GetWindowLongPtr(hUIWnd, IMMGWLP_PRIVATE);
  48. if (pv == NULL)
  49. {
  50. DebugMsg(TF_ERROR, TEXT("UI::OnDestroy. pv==NULL"));
  51. return;
  52. }
  53. pv->_Destroy();
  54. delete pv;
  55. }
  56. //+---------------------------------------------------------------------------
  57. //
  58. // _Create
  59. //
  60. //+---------------------------------------------------------------------------
  61. HRESULT
  62. UI::_Create()
  63. {
  64. m_UIComposition = (UIComposition*)new UIComposition(m_hUIWnd);
  65. if (m_UIComposition == NULL)
  66. {
  67. DebugMsg(TF_ERROR, TEXT("UI::Create. m_UIComposition==NULL"));
  68. return E_OUTOFMEMORY;
  69. }
  70. SetWindowLongPtr(m_hUIWnd, IMMGWLP_PRIVATE, (LONG_PTR)this);
  71. if (FAILED(m_UIComposition->OnCreate()))
  72. {
  73. DebugMsg(TF_ERROR, TEXT("UI::Create. m_UIComposition->Create==NULL"));
  74. delete m_UIComposition;
  75. return E_OUTOFMEMORY;
  76. }
  77. return S_OK;
  78. }
  79. //+---------------------------------------------------------------------------
  80. //
  81. // _Destroy
  82. //
  83. //+---------------------------------------------------------------------------
  84. HRESULT
  85. UI::_Destroy()
  86. {
  87. m_UIComposition->OnDestroy();
  88. SetWindowLongPtr(m_hUIWnd, IMMGWLP_PRIVATE, NULL);
  89. return S_OK;
  90. }