iebrowser.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. #ifndef __BROWSER_H
  2. #define __BROWSER_H
  3. class BrowserWnd;
  4. #define BROWSER_PARENT OSWnd
  5. #define IDC_SINKOBJ 0x9871 // arbitrary unique id
  6. #define MB_TIMERID1 0x1927
  7. #define MB_TIMERID2 0x1928
  8. class String;
  9. #include <nu/HTMLContainer2.h>
  10. #include <api/wnd/wndclass/oswnd.h>
  11. #include <api/wnd/minibrowser.h>
  12. class BrowserWnd : public BROWSER_PARENT, public HTMLContainer2, public MiniBrowserI {
  13. public:
  14. BrowserWnd();
  15. virtual ~BrowserWnd();
  16. public:
  17. static bool InitializeLibrary();
  18. static void UninitializeLibrary();
  19. public:
  20. // ifc_window
  21. virtual int onInit();
  22. virtual void onSetVisible(int show);
  23. virtual int handleDesktopAlpha() { return 0; }
  24. DWORD OnGetDownlodFlags(void);
  25. virtual int onMouseWheelUp(int click, int lines){return 1;}
  26. virtual int onMouseWheelDown(int click, int lines){return 1;}
  27. // OSWnd
  28. virtual HWND getOSHandle();
  29. // MiniBrowser
  30. virtual int minibrowser_navigateUrl(const wchar_t *url);
  31. virtual void minibrowser_setHome(const wchar_t *url) { homepage = url; }
  32. virtual int minibrowser_back();
  33. virtual int minibrowser_forward();
  34. virtual int minibrowser_home();
  35. virtual int minibrowser_refresh();
  36. virtual int minibrowser_stop();
  37. virtual void minibrowser_setTargetName(const wchar_t *name);
  38. const wchar_t *minibrowser_getTargetName();
  39. const wchar_t *minibrowser_getCurrentUrl();
  40. virtual void minibrowser_addCB(MiniBrowserCallback *cb) { callbacks.addItem(cb); }
  41. virtual ifc_window *minibrowser_getRootWnd() { return this; }
  42. virtual void minibrowser_setScrollbarsFlag(int a); //BROWSER_SCROLLBARS_ALWAYS, BROWSER_SCROLLBARS_AUTO, BROWSER_SCROLLBARS_NEVER
  43. virtual void minibrowser_scrape();
  44. virtual void minibrowser_setCancelIEErrorPage(bool cancel);
  45. void minibrowser_getDocumentTitle(wchar_t *str, size_t len);
  46. virtual const wchar_t* minibrowser_messageToJS(const wchar_t* str1, const wchar_t* str2, int i1, int i2, int i3);
  47. //
  48. virtual void timerCallback(int id);
  49. void onTargetNameTimer();
  50. bool ProcessMessage(MSG *msg); // return true to 'eat' the message
  51. bool cancelIEErrorPage;
  52. const wchar_t* messageToMaki(wchar_t* str1, wchar_t* str2, int i1, int i2, int i3);
  53. protected:
  54. virtual void OnBeforeNavigate(IDispatch *pDispatch, VARIANT *URL, VARIANT *Flags, VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers, VARIANT_BOOL *Cancel);
  55. virtual void OnDocumentComplete(IDispatch *pDispatch, VARIANT *URL);
  56. virtual void OnDocumentReady(IDispatch *pDispatch, VARIANT *URL); // So we can get rid of all iFrame completes
  57. virtual void OnNavigateError(IDispatch *pDispatch, VARIANT *URL, VARIANT *TargetFrameName, VARIANT *StatusCode, VARIANT_BOOL *Cancel);
  58. virtual STDMETHODIMP GetExternal(IDispatch __RPC_FAR *__RPC_FAR *ppDispatch);
  59. virtual int initBrowserStuff();
  60. virtual void freeBrowserStuff();
  61. virtual void onScrollbarsFlagTimer();
  62. virtual int wantFocus() { return 1; }
  63. private:
  64. virtual int doSetTargetName(const wchar_t *name);
  65. virtual int doSetScrollbars();
  66. virtual void updateTargetName();
  67. virtual void updateScrollbars();
  68. BOOL oleOk;
  69. StringW homepage;
  70. StringW deferednavigate;
  71. StringW targetname;
  72. StringW curpage;
  73. int timerset1;
  74. int timerset2;
  75. PtrList<MiniBrowserCallback> callbacks;
  76. int scrollbarsflag;
  77. ifc_messageprocessor *processor;
  78. };
  79. #endif