rodecomp/Source/Client/Browser/BrowserSiteAttachment.cpp
ragnarok-clanker d842cee831 Maintenance: [forced, user-approved] Collapse the Browser port's adapter structs into the original code (follow-up to 30cdd441). Evid
Batch #10110 by ragnarok-clanker: forced by an admin (0 lower score(s), 40 changed function(s)); checked with 495 compiled unit(s), including every includer of Source/Client/Application/ApplicationActivation.h, Source/Client/Application/Launcher.h, Source/Client/Browser/BrowserClientSite.h, Source/Client/Browser/BrowserPopupDispatch.h, Source/Client/Browser/WebBrowser.h, Source/Client/Browser/WebEventReceiver.h, Source/Client/Mode/CLoginMode.h, Source/Client/Mode/CMode.h, Source/Client/Mode/ModeTooltip.h, Source/UI/Window/UIWindowMgr.h, Source/Client/Browser/BrowserAddressBar.h, Source/Client/Browser/BrowserAddressEdit.h, Source/Client/Browser/BrowserClose.h, Source/Client/Browser/BrowserCreation.h, Source/Client/Browser/BrowserCursor.h, Source/Client/Browser/BrowserFactory.h, Source/Client/Browser/BrowserFrame.h, Source/Client/Browser/BrowserHostWindow.h, Source/Client/Browser/BrowserInputHandoff.h, Source/Client/Browser/BrowserInterface.h, Source/Client/Browser/BrowserMessages.h, Source/Client/Browser/BrowserRegistry.h, Source/Client/Browser/BrowserSiteAttachment.h, Source/Client/Browser/BrowserWindowSizing.h, Source/UI/Window/WindowFrameUpdate.h.
Deletes: Source/Client/Browser/BrowserAddressBar.h, Source/Client/Browser/BrowserAddressEdit.h, Source/Client/Browser/BrowserClose.h, Source/Client/Browser/BrowserCreation.h, Source/Client/Browser/BrowserCursor.h, Source/Client/Browser/BrowserFactory.h, Source/Client/Browser/BrowserFrame.h, Source/Client/Browser/BrowserHostWindow.h, Source/Client/Browser/BrowserInputHandoff.h, Source/Client/Browser/BrowserInterface.h, Source/Client/Browser/BrowserMessages.h, Source/Client/Browser/BrowserRegistry.h, Source/Client/Browser/BrowserSiteAttachment.h, Source/Client/Browser/BrowserWindowSizing.h, Source/UI/Window/WindowFrameUpdate.h
2026-11-02 16:41:37 +00:00

45 lines
1.4 KiB
C++

#include "Client/Browser/BrowserClientSite.h"
#include "Client/Browser/WebBrowser.h"
#include <new>
// OFFSET: 0x00AB2AB0
// FUNCTION: fn_17417
bool CWebBrowser::AttachSite() {
this->site = new (std::nothrow) BrowserClientSite(this->host, this->browser);
IOleObject* object;
HRESULT result = this->browser->QueryInterface(IID_IOleObject, reinterpret_cast<void**>(&object));
if (FAILED(result)) {
return false;
}
result = object->SetClientSite(this->site);
if (SUCCEEDED(result)) {
OleSetContainedObject(object, TRUE);
RECT rectangle;
GetClientRect(this->host, &rectangle);
result = object->DoVerb(OLEIVERB_INPLACEACTIVATE, nullptr, this->site, 0, this->host, &rectangle);
if (SUCCEEDED(result)) {
const int width = rectangle.right - rectangle.left;
const int height = rectangle.bottom - rectangle.top;
this->Resize(width, height);
result = AdviseBrowserEvents(object, this->site, DIID_DWebBrowserEvents2, &this->cookie);
}
}
object->Release();
return SUCCEEDED(result);
}
// OFFSET: 0x00AB2430
// FUNCTION: fn_45431
void CWebBrowser::DetachSite() {
IOleObject* object;
if (SUCCEEDED(this->browser->QueryInterface(IID_IOleObject, reinterpret_cast<void**>(&object)))) {
UnadviseBrowserEvents(object, DIID_DWebBrowserEvents2, this->cookie);
object->Release();
}
delete this->site;
this->site = nullptr;
}