ifc_omservicecommand.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #ifndef NULLSOFT_WINAMP_OMSERVICE_COMMAND_INTERFACE_HEADER
  2. #define NULLSOFT_WINAMP_OMSERVICE_COMMAND_INTERFACE_HEADER
  3. #if defined(_MSC_VER) && (_MSC_VER >= 1020)
  4. #pragma once
  5. #endif
  6. #include <bfc/dispatch.h>
  7. // {CA77030B-DF0F-4610-B01E-4A406A2FCD67}
  8. static const GUID IFC_OmServiceCommand =
  9. { 0xca77030b, 0xdf0f, 0x4610, { 0xb0, 0x1e, 0x4a, 0x40, 0x6a, 0x2f, 0xcd, 0x67 } };
  10. // {8E4F3281-37CA-4cbe-8753-BA7531690D07}
  11. static const GUID CMDGROUP_SERVICE =
  12. { 0x8e4f3281, 0x37ca, 0x4cbe, { 0x87, 0x53, 0xba, 0x75, 0x31, 0x69, 0xd, 0x7 } };
  13. #define SVCCOMMAND_SHOWINFO 1
  14. #define SVCCOMMAND_REPORT 2
  15. #define SVCCOMMAND_UNSUBSCRIBE 3
  16. #define SVCCOMMAND_RATE 4 // commandArg = (UINT)ratingValue
  17. #define SVCCOMMAND_BLOCKNAV 5 //used with query state
  18. // {FA32FE7D-848D-4813-8BDE-27E19CC835B5}
  19. static const GUID CMDGROUP_NAVIGATION =
  20. { 0xfa32fe7d, 0x848d, 0x4813, { 0x8b, 0xde, 0x27, 0xe1, 0x9c, 0xc8, 0x35, 0xb5 } };
  21. #define NAVCOMMAND_BACKFORWARD 1 // arg = FALSE - backward, arg = TRUE - rofward
  22. #define NAVCOMMAND_HISTORY 2
  23. #define NAVCOMMAND_HOME 3
  24. #define NAVCOMMAND_REFRESH 4 // arg = TRUE - full refresh
  25. #define NAVCOMMAND_STOP 5
  26. // {C04A2400-8D0D-4b3c-9271-0E042AF8C363}
  27. static const GUID CMDGROUP_WINDOW =
  28. { 0xc04a2400, 0x8d0d, 0x4b3c, { 0x92, 0x71, 0xe, 0x4, 0x2a, 0xf8, 0xc3, 0x63 } };
  29. #define WNDCOMMAND_FULLSCREEN 1 //
  30. #define WNDCOMMAND_CLOSE 2 //
  31. // {6A730612-A7CE-4a45-9898-2F0A807A3BB4}
  32. static const GUID CMDGROUP_ADDRESSBAR =
  33. { 0x6a730612, 0xa7ce, 0x4a45, { 0x98, 0x98, 0x2f, 0xa, 0x80, 0x7a, 0x3b, 0xb4 } };
  34. #define ADDRESSCOMMAND_EXECUTE 1 // arg = address string
  35. #define ADDRESSCOMMAND_VISIBLE 2 // used to check state
  36. #define ADDRESSCOMMAND_READONLY 3 // used to check state
  37. // QueryStatus() return values
  38. #define CMDSTATE_ENABLED S_OK
  39. #define CMDSTATE_DISABLED S_FALSE
  40. #define CMDSTATE_UNKNOWN E_NOINTERFACE
  41. class __declspec(novtable) ifc_omservicecommand : public Dispatchable
  42. {
  43. protected:
  44. ifc_omservicecommand() {}
  45. ~ifc_omservicecommand() {}
  46. public:
  47. HRESULT QueryState(HWND hBrowser, const GUID *commandGroup, unsigned int commandId); // return CMDSTATE_XXX or E_NOTIMPL if you ok with default
  48. HRESULT Exec(HWND hBrowser, const GUID *commandGroup, unsigned int commandId, ULONG_PTR commandArg); // return SUCCEEDED() if command handled
  49. public:
  50. DISPATCH_CODES
  51. {
  52. API_QUERYSTATE = 10,
  53. API_EXEC = 20,
  54. };
  55. };
  56. inline HRESULT ifc_omservicecommand::QueryState(HWND hBrowser, const GUID *commandGroup, unsigned int commandId)
  57. {
  58. return _call(API_QUERYSTATE, (HRESULT)E_NOTIMPL, hBrowser, commandGroup, commandId);
  59. }
  60. inline HRESULT ifc_omservicecommand::Exec(HWND hBrowser, const GUID *commandGroup, unsigned int commandId, ULONG_PTR commandArg)
  61. {
  62. return _call(API_EXEC, (HRESULT)E_NOTIMPL, hBrowser, commandGroup, commandId, commandArg);
  63. }
  64. #endif //NULLSOFT_WINAMP_OMSERVICE_COMMAND_INTERFACE_HEADER