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.

108 lines
3.9 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997.
  5. //
  6. // File: O R D E R . H
  7. //
  8. // Contents: Header file for Advanced Options->Provider Order
  9. //
  10. // Notes:
  11. //
  12. // Author: sumitc 1 Dec 1997
  13. //
  14. //----------------------------------------------------------------------------
  15. #pragma once
  16. #include "nsbase.h" // must be first to include atl
  17. #include "nsres.h"
  18. #include "resource.h"
  19. typedef list<tstring *>::iterator ListIter;
  20. static HTREEITEM AppendItem(HWND hwndTV, HTREEITEM hroot, PCWSTR szText, void * lParam, INT iImage);
  21. static void AppendItemList(HWND hwndTV, HTREEITEM hroot, ListStrings lstr, ListStrings lstr2, INT iImage);
  22. bool AreThereMultipleProviders(void);
  23. static HRESULT ReadNetworkProviders(ListStrings& m_lstr, ListStrings& m_lstrDisp);
  24. static HRESULT ReadPrintProviders(ListStrings& m_lstr, ListStrings& m_lstrDisp);
  25. //
  26. // CProviderOrderDlg
  27. //
  28. class CProviderOrderDlg :
  29. public CPropSheetPage
  30. {
  31. BEGIN_MSG_MAP(CProviderOrderDlg)
  32. MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
  33. MESSAGE_HANDLER(WM_CONTEXTMENU, OnContextMenu);
  34. MESSAGE_HANDLER(WM_HELP, OnHelp);
  35. COMMAND_ID_HANDLER(IDC_MOVEUP, OnMoveUp)
  36. COMMAND_ID_HANDLER(IDC_MOVEDOWN, OnMoveDown)
  37. NOTIFY_CODE_HANDLER(TVN_SELCHANGED, OnTreeItemChanged)
  38. NOTIFY_CODE_HANDLER(PSN_APPLY, OnOk)
  39. END_MSG_MAP()
  40. enum { IDD = IDD_PROVIDER};
  41. CProviderOrderDlg();
  42. ~CProviderOrderDlg();
  43. BOOL FShowPage()
  44. {
  45. return AreThereMultipleProviders();
  46. }
  47. LRESULT OnInitDialog(UINT uMsg, WPARAM wParam,
  48. LPARAM lParam, BOOL& bHandled);
  49. LRESULT OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& Handled);
  50. LRESULT OnHelp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  51. LRESULT OnOk(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
  52. LRESULT OnMoveUp(WORD wNotifyCode, WORD wID, HWND hWndCtl,
  53. BOOL& bHandled);
  54. LRESULT OnMoveDown(WORD wNotifyCode, WORD wID, HWND hWndCtl,
  55. BOOL& bHandled);
  56. LRESULT OnTreeItemChanged(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
  57. #if 0
  58. LRESULT OnProperties(WORD wNotifyCode, WORD wID, HWND hWndCtl,
  59. BOOL& bHandled);
  60. LRESULT OnApply(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
  61. LRESULT OnCancel(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
  62. LRESULT OnDeleteItem(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
  63. LRESULT OnItemChanged(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
  64. #endif
  65. private:
  66. HCURSOR m_hcurAfter; // cursor after drag has started
  67. HCURSOR m_hcurNoDrop; // cursor indicating can't drop here
  68. HICON m_hiconUpArrow; // icon for up arrow
  69. HICON m_hiconDownArrow; // icon for down arrow
  70. HTREEITEM m_htiNetwork; // treeitem root for Network (one below actual root)
  71. HTREEITEM m_htiPrint; // treeitem root for Print (one below actual root)
  72. ListStrings m_lstrNetwork; // list of strings with (ordered) Network providers
  73. ListStrings m_lstrNetworkDisp; // list of display names for Network providers (same order)
  74. ListStrings m_lstrPrint; // list of strings with (ordered) Print providers
  75. ListStrings m_lstrPrintDisp; // list of display names for Print providers (same order)
  76. bool m_fNoNetworkProv:1; // flag to indicate that we failed to get any network providers
  77. bool m_fNoPrintProv:1; // flag to indicate that we failed to get any print providers
  78. // the following functions fill up lstrDisplayNames with the list of net/print providers
  79. HRESULT WriteProviders(HWND hwndTV, bool fPrint);
  80. HRESULT MoveItem(bool fMoveUp);
  81. HRESULT UpdateUpDownButtons(HWND hwndTV);
  82. };
  83. #if DBG
  84. static void DumpItemList(ListStrings& lstr, PSTR szInfoAboutList);
  85. #endif