navigation.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #ifndef NULLOSFT_ONLINEMEDIA_PLUGIN_NAVIGATION_HEADER
  2. #define NULLOSFT_ONLINEMEDIA_PLUGIN_NAVIGATION_HEADER
  3. #if defined(_MSC_VER) && (_MSC_VER >= 1020)
  4. #pragma once
  5. #endif
  6. #include <wtypes.h>
  7. #include <ifc_mlnavigationcallback.h>
  8. #include "./forceUrl.h"
  9. #include <vector>
  10. class ifc_omservice;
  11. class forceUrl;
  12. typedef LPVOID HNAVITEM;
  13. #define ROOTSERVICE_ID 777
  14. typedef void (CALLBACK *NavigationCallback)(Navigation* /*instance*/, ULONG_PTR /*param*/);
  15. class Navigation : public ifc_mlnavigationcallback
  16. {
  17. protected:
  18. Navigation();
  19. ~Navigation();
  20. public:
  21. static HRESULT CreateInstance(Navigation **instance);
  22. public:
  23. /* Dispatchable */
  24. size_t AddRef();
  25. size_t Release();
  26. int QueryInterface(GUID interface_guid, void **object);
  27. /* ifc_mlnavigationcallback */
  28. void ImageChanged(LPCWSTR pszName, INT index);
  29. public:
  30. HRESULT Finish();
  31. BOOL ProcessMessage(INT msg, INT_PTR param1, INT_PTR param2, INT_PTR param3, INT_PTR *result);
  32. HNAVITEM GetActive(ifc_omservice **serviceOut);
  33. HWND GetActiveView(ifc_omservice **serviceOut);
  34. HRESULT SelectItem(HNAVITEM hItem, LPCWSTR pszUrl);
  35. HRESULT DeleteItem(HNAVITEM hItem);
  36. HRESULT DeleteAll();
  37. HRESULT GenerateServiceName(LPWSTR pszBuffer, INT cchBufferMax);
  38. HRESULT CreatePopup(HNAVITEM hItem, HWND *hwnd);
  39. HRESULT GetService(HNAVITEM hItem, ifc_omservice **service);
  40. HRESULT UpdateService(ifc_omservice *service, UINT modifiedFlags);
  41. HNAVITEM FindService(UINT serviceId, ifc_omservice **serviceOut);
  42. HRESULT ShowService(UINT serviceId, LPCWSTR pszUrl);
  43. HNAVITEM CreateItem(ifc_omservice *service, int altMode = 0);
  44. HRESULT CreateItemAsync(ifc_omservice *service);
  45. HRESULT CreateUserService(HNAVITEM *itemOut);
  46. protected:
  47. HRESULT Initialize();
  48. HRESULT InitializeBrowser();
  49. HRESULT SaveOrder();
  50. HRESULT Order(std::vector<ifc_omservice *> &list);
  51. HNAVITEM GetMessageItem(INT msg, INT_PTR param1);
  52. HNAVITEM CreateItemInt(HNAVITEM hParent, ifc_omservice *service, int altMode = 0);
  53. HRESULT SelectItemInt(HNAVITEM hItem, UINT serviceId, LPCWSTR pszUrl);
  54. HRESULT PatchIconName(LPWSTR pszIcon, UINT cchMaxIconLen, ifc_omservice *service);
  55. HRESULT OnCreateView(HNAVITEM hItem, HWND hParent, HWND *hView);
  56. HRESULT OnContextMenu(HNAVITEM hItem, HWND hHost, POINTS pts);
  57. HRESULT OnEndTitleEdit(HNAVITEM hItem, LPCWSTR pszNewTitle);
  58. HRESULT OnDeleteItem(HNAVITEM hItem);
  59. HRESULT OnKeyDown(HNAVITEM hItem, NMTVKEYDOWN *pnmkd);
  60. HRESULT OnControlDestroy();
  61. HRESULT PostMainThreadCallback(NavigationCallback callback, ULONG_PTR param);
  62. protected:
  63. size_t ref;
  64. HNAVITEM hRoot;
  65. HWND hLibrary;
  66. UINT cookie;
  67. ForceUrl forceUrl;
  68. protected:
  69. RECVS_DISPATCH;
  70. };
  71. #endif // NULLOSFT_ONLINEMEDIA_PLUGIN_NAVIGATION_HEADER