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.

105 lines
2.4 KiB

  1. //Copyright (c) 1997-2000 Microsoft Corporation
  2. #include "pch.hxx" // pch
  3. #pragma hdrstop
  4. #include "resource.h"
  5. #include "pgMseBut.h"
  6. CMouseButtonPg::CMouseButtonPg(
  7. LPPROPSHEETPAGE ppsp
  8. ) : WizardPage(ppsp, IDS_MSEWIZBUTTONCONFIGTITLE, IDS_MSEWIZBUTTONCONFIGSUBTITLE)
  9. {
  10. m_dwPageId = IDD_MSEWIZBUTTONCONFIG;
  11. ppsp->pszTemplate = MAKEINTRESOURCE(m_dwPageId);
  12. }
  13. CMouseButtonPg::~CMouseButtonPg(
  14. VOID
  15. )
  16. {
  17. }
  18. LRESULT
  19. CMouseButtonPg::OnInitDialog(
  20. HWND hwnd,
  21. WPARAM wParam,
  22. LPARAM lParam
  23. )
  24. {
  25. if(g_Options.m_schemePreview.m_bSwapMouseButtons)
  26. Button_SetCheck(GetDlgItem(m_hwnd, MOUSE_LEFTHAND), TRUE);
  27. else
  28. Button_SetCheck(GetDlgItem(m_hwnd, MOUSE_RIGHTHAND), TRUE);
  29. RECT rc;
  30. GetWindowRect(GetDlgItem(m_hwnd, IDC_OBJECTMENU), &rc);
  31. MapWindowPoints(HWND_DESKTOP, m_hwnd, (LPPOINT)&rc, 2);
  32. m_ptRight.x = rc.left;
  33. m_ptRight.y = rc.top;
  34. GetWindowRect(GetDlgItem(m_hwnd, IDC_SELECTDRAG), &rc);
  35. MapWindowPoints(HWND_DESKTOP, m_hwnd, (LPPOINT)&rc, 2);
  36. m_ptLeft.x = rc.left;
  37. m_ptLeft.y = rc.top;
  38. UpdateControls();
  39. return 1;
  40. }
  41. void CMouseButtonPg::UpdateControls()
  42. {
  43. if(Button_GetCheck(GetDlgItem(m_hwnd, MOUSE_RIGHTHAND)))
  44. {
  45. SetWindowPos(GetDlgItem(m_hwnd, IDC_OBJECTMENU), NULL, m_ptRight.x, m_ptRight.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
  46. SetWindowPos(GetDlgItem(m_hwnd, IDC_SELECTDRAG), NULL, m_ptLeft.x, m_ptLeft.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
  47. ShowWindow(GetDlgItem(m_hwnd, IDC_MOUSEPIC1), TRUE);
  48. ShowWindow(GetDlgItem(m_hwnd, IDC_MOUSEPIC2), FALSE);
  49. }
  50. else
  51. {
  52. SetWindowPos(GetDlgItem(m_hwnd, IDC_OBJECTMENU), NULL, m_ptLeft.x, m_ptLeft.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
  53. SetWindowPos(GetDlgItem(m_hwnd, IDC_SELECTDRAG), NULL, m_ptRight.x, m_ptRight.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
  54. ShowWindow(GetDlgItem(m_hwnd, IDC_MOUSEPIC1), FALSE);
  55. ShowWindow(GetDlgItem(m_hwnd, IDC_MOUSEPIC2), TRUE);
  56. }
  57. }
  58. LRESULT
  59. CMouseButtonPg::OnCommand(
  60. HWND hwnd,
  61. WPARAM wParam,
  62. LPARAM lParam
  63. )
  64. {
  65. LRESULT lResult = 1;
  66. WORD wNotifyCode = HIWORD(wParam);
  67. WORD wCtlID = LOWORD(wParam);
  68. HWND hwndCtl = (HWND)lParam;
  69. switch(wCtlID)
  70. {
  71. case MOUSE_LEFTHAND:
  72. case MOUSE_RIGHTHAND:
  73. UpdateControls();
  74. break;
  75. }
  76. g_Options.m_schemePreview.m_bSwapMouseButtons = Button_GetCheck(GetDlgItem(m_hwnd, MOUSE_LEFTHAND));
  77. g_Options.ApplyPreview();
  78. return lResult;
  79. }
  80. LRESULT
  81. CMouseButtonPg::OnPSN_WizNext(
  82. HWND hwnd,
  83. INT idCtl,
  84. LPPSHNOTIFY pnmh
  85. )
  86. {
  87. return WizardPage::OnPSN_WizNext(hwnd, idCtl, pnmh);
  88. }