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.

111 lines
2.7 KiB

  1. // BindsDlg.h : header file
  2. //
  3. /////////////////////////////////////////////////////////////////////////////
  4. class CBingingRemoval : public CObject
  5. {
  6. public:
  7. // constructor
  8. CBingingRemoval( CMDKey* pTargetKey, CString szTargetBinding ) :
  9. m_pTargetKey( pTargetKey )
  10. {
  11. m_szTargetBinding = szTargetBinding;
  12. }
  13. // remove the binding
  14. inline void RemoveBinding();
  15. CMDKey* m_pTargetKey;
  16. CString m_szTargetBinding;
  17. };
  18. //--------------------------------------------------------
  19. inline void CBingingRemoval::RemoveBinding()
  20. {
  21. // tell the key to remove the binding - easy!
  22. m_pTargetKey->RemoveBinding( m_szTargetBinding );
  23. // update the key's name
  24. m_pTargetKey->m_fUpdateBindings = TRUE;
  25. }
  26. /////////////////////////////////////////////////////////////////////////////
  27. // CBindingsDlg dialog
  28. class CBindingsDlg : public CDialog
  29. {
  30. // Construction
  31. public:
  32. CBindingsDlg(WCHAR* pszw, CWnd* pParent = NULL); // standard constructor
  33. virtual BOOL OnInitDialog();
  34. // the base key that is being worked on
  35. CMDKey* m_pKey;
  36. // target machine
  37. WCHAR* m_pszwMachineName;
  38. // is a binding string already a part of the list in this dialog?
  39. BOOL FContainsBinding( CString sz );
  40. // add a binding to the list
  41. void AddBinding( CString sz );
  42. // a queue of bindings to be removed if the user says OK
  43. CTypedPtrArray<CObArray, CBingingRemoval*> rgbRemovals;
  44. // Dialog Data
  45. //{{AFX_DATA(CBindingsDlg)
  46. enum { IDD = IDD_BINDINGS };
  47. CButton m_cbutton_delete;
  48. CButton m_cbutton_edit;
  49. CListSelRowCtrl m_clistctrl_list;
  50. //}}AFX_DATA
  51. // CListCtrl m_clistctrl_list;
  52. // Overrides
  53. // ClassWizard generated virtual function overrides
  54. //{{AFX_VIRTUAL(CBindingsDlg)
  55. protected:
  56. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  57. //}}AFX_VIRTUAL
  58. // Implementation
  59. protected:
  60. // Generated message map functions
  61. //{{AFX_MSG(CBindingsDlg)
  62. afx_msg void OnAdd();
  63. afx_msg void OnDelete();
  64. afx_msg void OnEdit();
  65. afx_msg void OnItemchangedList(NMHDR* pNMHDR, LRESULT* pResult);
  66. virtual void OnOK();
  67. afx_msg void OnDblclkList(NMHDR* pNMHDR, LRESULT* pResult);
  68. //}}AFX_MSG
  69. DECLARE_MESSAGE_MAP()
  70. // initialize the list
  71. void FillInBindings();
  72. BOOL FInitList();
  73. void UpdateBindingDisplay( DWORD iItem, CString szBinding );
  74. // enable the buttons as appropriate
  75. void EnableButtons();
  76. // edit the selected binding, return a flag for OK
  77. BOOL FEdit( CString &sz );
  78. // return the index of the selected item - only one selection allowed
  79. inline int GetSelectedIndex();
  80. };
  81. //--------------------------------------------------------
  82. // return the index of the selected item - only one selection allowed
  83. inline int CBindingsDlg::GetSelectedIndex()
  84. {
  85. return m_clistctrl_list.GetNextItem( -1, LVNI_SELECTED );
  86. }