1
0

view_mb.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. #ifndef _VIEW_MB_H_
  2. #define _VIEW_MB_H_
  3. #include "main.h"
  4. #include "contnr.h"
  5. #include "evntsink.h"
  6. #include "childwnd.h"
  7. #include "resource.h"
  8. #include "..\winamp\wa_dlg.h"
  9. #include <shlobj.h>
  10. #include "mbutil.h"
  11. #include "config.h"
  12. extern void gracenoteCancelRequest();
  13. // ---------------------------------------------------------------
  14. // class viewMBHandler is a singleton class -
  15. // All public members are static, including
  16. // viewMBHandler :: DialogProc.
  17. // CTOR and DTOR are public (and not static)
  18. // the only instance of viewMBHandler is private,
  19. // theVmb;
  20. // ---------------------------------------------------------
  21. // ---------------------------------------------------------
  22. // this class has the basic responsibiliity of creating (and
  23. // handling the messages for) an IEControl window.
  24. // It is a prototype for the Advertising window,
  25. // which will be a similar class, but without the extraneous
  26. // stuff. ie There are currently navigation buttons for which
  27. // messages must be handled. These should disappear
  28. // in the final class, along with the gracenote stuff.
  29. //
  30. // Ben Pontius
  31. // ---------------------------------------------------------------
  32. class viewMBHandler
  33. {
  34. public:
  35. // ---------------------------------------------------------------
  36. friend BOOL view_mbDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  37. private:
  38. // ---------------------------------------------------------------
  39. // CTOR
  40. // ---------------------------------------------------------------
  41. viewMBHandler ()
  42. : m_hwnd (0),
  43. m_pweb (0),
  44. m_contnr (0),
  45. m_event (0),
  46. m_eventCookie (0),
  47. m_defurl (1),
  48. m_tmpurl (0),
  49. loc_oldWndProc (0)
  50. {
  51. }
  52. // ---------------------------------------------------------------
  53. // DTOR - public (because the compiler demanded it.)
  54. // ---------------------------------------------------------------
  55. ~viewMBHandler ()
  56. {
  57. // ---------------------------------------------------------------
  58. gracenoteCancelRequest ();
  59. // ---------------------------------------------------------------
  60. if (m_contnr != 0)
  61. {
  62. destroyIEControl ();
  63. }
  64. if (m_tmpurl)
  65. {
  66. free (m_tmpurl);
  67. m_tmpurl = 0;
  68. }
  69. m_hwnd = 0;
  70. }
  71. public:
  72. // ---------------------------------------------------------------
  73. static void Refresh (int defurl);
  74. // ---------------------------------------------------------------
  75. static void SetDesc (char *desc);
  76. // ---------------------------------------------------------------
  77. static void Navigate (char *s);
  78. // ---------------------------------------------------------------
  79. static void navigateGracenoteTuid ();
  80. // ---------------------------------------------------------------
  81. // the central (CALLBACK) function
  82. // ---------------------------------------------------------------
  83. static BOOL CALLBACK DialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  84. // ---------------------------------------------------------------
  85. static BOOL CALLBACK newWndProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  86. // ---------------------------------------------------------------
  87. static void ContextMenu (HWND parent);
  88. // ---------------------------------------------------------------
  89. static viewMBHandler &getInstance ()
  90. {
  91. if (0 == pVmb)
  92. {
  93. pVmb = new viewMBHandler;
  94. }
  95. return *pVmb;
  96. }
  97. protected:
  98. // ---------------------------------------------------------------
  99. IConnectionPoint *GetConnectionPoint(REFIID riid);
  100. // ---------------------------------------------------------------
  101. void ConnectEvents ();
  102. // ---------------------------------------------------------------
  103. // bp IEControl creation:
  104. // ---------------------------------------------------------------
  105. void createIEControl ();
  106. // ---------------------------------------------------------------
  107. // BP - IEControl destruction
  108. // ---------------------------------------------------------------
  109. void destroyIEControl ();
  110. // ---------------------------------------------------------------
  111. void NavigateToName (LPCTSTR pszUrl);
  112. private:
  113. IWebBrowser2 *m_pweb;
  114. HWND m_hwnd;
  115. CContainer *m_contnr;
  116. CEventSink *m_event;
  117. DWORD m_eventCookie;
  118. int m_defurl;
  119. char *m_tmpurl;
  120. WNDPROC loc_oldWndProc;
  121. static viewMBHandler *pVmb;
  122. };
  123. #endif // _VIEW_MB_H_