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.

138 lines
3.0 KiB

  1. /****************************************************************************************
  2. * NAME: MatchCondEdit.cpp
  3. *
  4. * CLASS: CMatchCondEditor
  5. *
  6. * OVERVIEW
  7. *
  8. * Internet Authentication Server:
  9. * This dialog box is used to edit regular-expression
  10. * typed Condition
  11. *
  12. * ex. attr Match <a..z*>
  13. *
  14. * Copyright (C) Microsoft Corporation, 1998 - 1999 . All Rights Reserved.
  15. *
  16. * History:
  17. * 1/28/98 Created by Byao (using ATL wizard)
  18. *
  19. *****************************************************************************************/
  20. #include "Precompiled.h"
  21. #include "MatchCondEdit.h"
  22. //+---------------------------------------------------------------------------
  23. //
  24. // Function: CMatchCondEditor
  25. //
  26. // Class: CMatchCondEditor
  27. //
  28. // Synopsis: constructor for CMatchCondEditor
  29. //
  30. // Arguments: LPTSTR pszAttrName - name of the attribute to be edited
  31. //
  32. // Returns: Nothing
  33. //
  34. // History: Created byao 1/30/98 6:20:06 PM
  35. //
  36. //+---------------------------------------------------------------------------
  37. CMatchCondEditor::CMatchCondEditor()
  38. {
  39. }
  40. CMatchCondEditor::~CMatchCondEditor()
  41. {
  42. }
  43. LRESULT CMatchCondEditor::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
  44. {
  45. TRACE_FUNCTION("CMatchCondEditor::OnInitDialog");
  46. // get the regular expression for this condition
  47. SetDlgItemText(IDC_EDIT_COND_TEXT, m_strRegExp);
  48. //todo: change the title to the name of the attribute
  49. SetWindowText(m_strAttrName);
  50. return 1; // Let the system set the focus
  51. }
  52. LRESULT CMatchCondEditor::OnOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
  53. {
  54. TRACE_FUNCTION("CMatchCondEditor::OnOK");
  55. CComBSTR bstr;
  56. GetDlgItemText(IDC_EDIT_COND_TEXT, (BSTR&) bstr);
  57. m_strRegExp = (BSTR&) bstr;
  58. EndDialog(wID);
  59. return 0;
  60. }
  61. LRESULT CMatchCondEditor::OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
  62. {
  63. TRACE_FUNCTION("CMatchCondEditor::OnCancel");
  64. EndDialog(wID);
  65. return 0;
  66. }
  67. //////////////////////////////////////////////////////////////////////////////
  68. /*++
  69. CMatchCondEditor::OnChange
  70. Called when the WM_COMMAND message is sent to our page with the
  71. EN_CHANGE notification.
  72. This is our chance to check to see what the user has touched
  73. and enable or disabled the OK button.
  74. --*/
  75. //////////////////////////////////////////////////////////////////////////////
  76. LRESULT CMatchCondEditor::OnChange(
  77. UINT uMsg
  78. , WPARAM wParam
  79. , HWND hwnd
  80. , BOOL& bHandled
  81. )
  82. {
  83. TRACE_FUNCTION("CMatchCondEditor::OnChange");
  84. // Check for preconditions:
  85. // None.
  86. // We don't want to prevent anyone else down the chain from receiving a message.
  87. bHandled = FALSE;
  88. CComBSTR bstr;
  89. GetDlgItemText(IDC_EDIT_COND_TEXT, (BSTR&) bstr);
  90. // cancel if the user didn't type in anything
  91. if ( SysStringLen(bstr) == 0 )
  92. {
  93. // Disable the OK button.
  94. ::EnableWindow(GetDlgItem(IDOK), FALSE);
  95. }
  96. else
  97. {
  98. // Enable the OK button.
  99. ::EnableWindow(GetDlgItem(IDOK), TRUE);
  100. }
  101. return TRUE; // ISSUE: what do we need to be returning here?
  102. }