Source code of Windows XP (NT5)
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.

77 lines
1.9 KiB

  1. // Copyright (C) 1996-1997 Microsoft Corporation. All rights reserved.
  2. /*
  3. REVIEW: WHAT IS THE PURPOSE OF THIS CLASS?
  4. WHO ARE THE CONSUMERS OF THIS CLASS?
  5. */
  6. #include "header.h"
  7. #include "cnotes.h"
  8. #include "secwin.h"
  9. CNotes::CNotes(CHHWinType* phh)
  10. {
  11. m_phh = phh;
  12. m_hwndNotes = NULL;
  13. m_fModified = FALSE;
  14. }
  15. CNotes::~CNotes(void)
  16. {
  17. }
  18. void CNotes::HideWindow(void)
  19. {
  20. ::ShowWindow(m_hwndNotes, SW_HIDE);
  21. m_phh->m_fNotesWindow = FALSE;
  22. // Force everything to resize
  23. SendMessage(m_phh->hwndHelp, WM_SIZE, SIZE_RESTORED, 0);
  24. }
  25. const int NOTES_BORDER = 3;
  26. void CNotes::ShowWindow(void)
  27. {
  28. m_phh->m_fNotesWindow = TRUE;
  29. if (!m_hwndNotes) {
  30. m_phh->CalcHtmlPaneRect();
  31. m_hwndNotes = CreateWindow(txtHtmlHelpChildWindowClass, NULL,
  32. WS_CHILD | WS_CLIPCHILDREN, m_phh->rcNotes.left, m_phh->rcNotes.top,
  33. RECT_WIDTH(m_phh->rcNotes), RECT_HEIGHT(m_phh->rcNotes), *m_phh, NULL,
  34. _Module.GetModuleInstance(), NULL);
  35. RECT rcClient;
  36. GetClientRect(m_hwndNotes, &rcClient);
  37. InflateRect(&rcClient, -NOTES_BORDER, -NOTES_BORDER);
  38. m_hwndEditBox = CreateWindowEx(WS_EX_CLIENTEDGE, "edit", NULL,
  39. WS_CHILD | ES_MULTILINE, rcClient.left, rcClient.top,
  40. RECT_WIDTH(rcClient), RECT_HEIGHT(rcClient),
  41. m_hwndNotes, NULL, _Module.GetModuleInstance(), NULL);
  42. }
  43. ::ShowWindow(m_hwndNotes, SW_SHOW);
  44. ::ShowWindow(m_hwndEditBox, SW_SHOW);
  45. // Force everything to resize
  46. SendMessage(m_phh->hwndHelp, WM_SIZE, SIZE_RESTORED, 0);
  47. }
  48. void CNotes::ResizeWindow(BOOL fClientOnly)
  49. {
  50. ASSERT(m_phh->m_fNotesWindow);
  51. if (!fClientOnly) {
  52. m_phh->CalcHtmlPaneRect();
  53. MoveWindow(m_hwndNotes, m_phh->rcNotes.left,
  54. m_phh->rcNotes.top, RECT_WIDTH(m_phh->rcNotes),
  55. RECT_HEIGHT(m_phh->rcNotes), TRUE);
  56. }
  57. RECT rcClient;
  58. GetClientRect(m_hwndNotes, &rcClient);
  59. InflateRect(&rcClient, -NOTES_BORDER, -NOTES_BORDER);
  60. MoveWindow(m_hwndEditBox, rcClient.left,
  61. rcClient.top, RECT_WIDTH(rcClient),
  62. RECT_HEIGHT(rcClient), TRUE);
  63. }