WebBrowser.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /*
  2. ** Command & Conquer Generals(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. ////////////////////////////////////////////////////////////////////////////////
  19. // //
  20. // (c) 2001-2003 Electronic Arts Inc. //
  21. // //
  22. ////////////////////////////////////////////////////////////////////////////////
  23. /******************************************************************************
  24. *
  25. * NAME
  26. * $Archive: $
  27. *
  28. * DESCRIPTION
  29. * Web Browser
  30. *
  31. * PROGRAMMER
  32. * Bryan Cleveland
  33. * $Author: $
  34. *
  35. * VERSION INFO
  36. * $Revision: $
  37. * $Modtime: $
  38. *
  39. ******************************************************************************/
  40. #pragma once
  41. #ifndef __WEBBROWSER_H__
  42. #define __WEBBROWSER_H__
  43. #include "Common/SubsystemInterface.h"
  44. #include <atlbase.h>
  45. #include <windows.h>
  46. #include <Common/GameMemory.h>
  47. #include "EABrowserDispatch/BrowserDispatch.h"
  48. #include "FEBDispatch.h"
  49. class GameWindow;
  50. class WebBrowserURL : public MemoryPoolObject
  51. {
  52. MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( WebBrowserURL, "WebBrowserURL" )
  53. public:
  54. WebBrowserURL();
  55. // virtual destructor prototype defined by memory pool object
  56. const FieldParse *getFieldParse( void ) const { return m_URLFieldParseTable; }
  57. AsciiString m_tag;
  58. AsciiString m_url;
  59. WebBrowserURL *m_next;
  60. static const FieldParse m_URLFieldParseTable[]; ///< the parse table for INI definition
  61. };
  62. class WebBrowser :
  63. public FEBDispatch<WebBrowser, IBrowserDispatch, &IID_IBrowserDispatch>,
  64. public SubsystemInterface
  65. {
  66. public:
  67. void init( void );
  68. void reset( void );
  69. void update( void );
  70. // Create an instance of the embedded browser for Dune Emperor.
  71. virtual Bool createBrowserWindow(char *tag, GameWindow *win) = 0;
  72. virtual void closeBrowserWindow(GameWindow *win) = 0;
  73. WebBrowserURL *makeNewURL(AsciiString tag);
  74. WebBrowserURL *findURL(AsciiString tag);
  75. protected:
  76. // Protected to prevent direct construction via new, use CreateInstance() instead.
  77. WebBrowser();
  78. virtual ~WebBrowser();
  79. // Protected to prevent copy and assignment
  80. WebBrowser(const WebBrowser&);
  81. const WebBrowser& operator=(const WebBrowser&);
  82. // Bool RetrievePageURL(const char* page, char* url, int size);
  83. // Bool RetrieveHTMLPath(char* path, int size);
  84. protected:
  85. ULONG mRefCount;
  86. WebBrowserURL *m_urlList;
  87. //---------------------------------------------------------------------------
  88. // IUnknown methods
  89. //---------------------------------------------------------------------------
  90. protected:
  91. HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
  92. ULONG STDMETHODCALLTYPE AddRef(void);
  93. ULONG STDMETHODCALLTYPE Release(void);
  94. //---------------------------------------------------------------------------
  95. // IBrowserDispatch methods
  96. //---------------------------------------------------------------------------
  97. public:
  98. STDMETHOD(TestMethod)(Int num1);
  99. };
  100. extern CComObject<WebBrowser> *TheWebBrowser;
  101. #endif // __WEBBROWSER_H__