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.

143 lines
3.4 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;
  58. m_strRegExp.TrimLeft();
  59. m_strRegExp.TrimRight();
  60. EndDialog(wID);
  61. return 0;
  62. }
  63. LRESULT CMatchCondEditor::OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
  64. {
  65. TRACE_FUNCTION("CMatchCondEditor::OnCancel");
  66. EndDialog(wID);
  67. return 0;
  68. }
  69. //////////////////////////////////////////////////////////////////////////////
  70. /*++
  71. CMatchCondEditor::OnChange
  72. Called when the WM_COMMAND message is sent to our page with the
  73. EN_CHANGE notification.
  74. This is our chance to check to see what the user has touched
  75. and enable or disabled the OK button.
  76. --*/
  77. //////////////////////////////////////////////////////////////////////////////
  78. LRESULT CMatchCondEditor::OnChange(
  79. UINT uMsg
  80. , WPARAM wParam
  81. , HWND hwnd
  82. , BOOL& bHandled
  83. )
  84. {
  85. TRACE_FUNCTION("CMatchCondEditor::OnChange");
  86. // Check for preconditions:
  87. // None.
  88. // We don't want to prevent anyone else down the chain from receiving a message.
  89. bHandled = FALSE;
  90. CComBSTR bstr;
  91. GetDlgItemText(IDC_EDIT_COND_TEXT, (BSTR&) bstr);
  92. ATL::CString text(bstr);
  93. text.TrimLeft();
  94. text.TrimRight();
  95. // cancel if the user didn't type in anything
  96. if (text.IsEmpty())
  97. {
  98. // Disable the OK button.
  99. ::EnableWindow(GetDlgItem(IDOK), FALSE);
  100. }
  101. else
  102. {
  103. // Enable the OK button.
  104. ::EnableWindow(GetDlgItem(IDOK), TRUE);
  105. }
  106. return TRUE; // ISSUE: what do we need to be returning here?
  107. }