W3DWebBrowser.cpp 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. ** Command & Conquer Generals Zero Hour(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. ////// W3DWebBrowser.cpp ///////////////
  24. // July 2002 Bryan Cleveland
  25. #include "W3DDevice/GameClient/W3DWebBrowser.h"
  26. #include "WW3D2/Texture.h"
  27. #include "WW3D2/TextureLoader.h"
  28. #include "WW3D2/SurfaceClass.h"
  29. #include "GameClient/Image.h"
  30. #include "GameClient/GameWindow.h"
  31. #include "vector2i.h"
  32. #include <d3dx8.h>
  33. #include "WW3D2/dx8wrapper.h"
  34. #include "WW3D2/dx8WebBrowser.h"
  35. W3DWebBrowser::W3DWebBrowser() : WebBrowser() {
  36. }
  37. Bool W3DWebBrowser::createBrowserWindow(char *tag, GameWindow *win)
  38. {
  39. WinInstanceData *winData = win->winGetInstanceData();
  40. AsciiString windowName = winData->m_decoratedNameString;
  41. Int x, y, w, h;
  42. win->winGetSize(&w, &h);
  43. win->winGetScreenPosition(&x, &y);
  44. WebBrowserURL *url = findURL( AsciiString(tag) );
  45. if (url == NULL) {
  46. DEBUG_LOG(("W3DWebBrowser::createBrowserWindow - couldn't find URL for page %s\n", tag));
  47. return FALSE;
  48. }
  49. CComQIPtr<IDispatch> idisp(m_dispatch);
  50. if (m_dispatch == NULL)
  51. {
  52. return FALSE;
  53. }
  54. DX8WebBrowser::CreateBrowser(windowName.str(), url->m_url.str(), x, y, w, h, 0, BROWSEROPTION_SCROLLBARS | BROWSEROPTION_3DBORDER, (LPDISPATCH)this);
  55. return TRUE;
  56. }
  57. void W3DWebBrowser::closeBrowserWindow(GameWindow *win)
  58. {
  59. DX8WebBrowser::DestroyBrowser(win->winGetInstanceData()->m_decoratedNameString.str());
  60. }