Initial rodecomp source snapshot
This commit is contained in:
commit
d456e8f64a
916 changed files with 156023 additions and 0 deletions
48
Source/Client/BrowserSiteAttachment.cpp
Normal file
48
Source/Client/BrowserSiteAttachment.cpp
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
#include "Client/BrowserInterface.h"
|
||||
#include "Client/BrowserSiteAttachment.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <new>
|
||||
|
||||
// OFFSET: 0x00AB2AB0
|
||||
// FUNCTION: fn_17417
|
||||
bool BrowserSiteAttachment::Attach() {
|
||||
this->site = new (std::nothrow)
|
||||
BrowserClientSite(this->host, *this->sizing.browser, this->factory, this->renderWidth, this->renderHeight);
|
||||
|
||||
IOleObject* object;
|
||||
HRESULT result = this->sizing.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->sizing.Resize(width, height);
|
||||
result = AdviseBrowserEvents(object, this->site, DIID_DWebBrowserEvents2, &this->cookie);
|
||||
}
|
||||
}
|
||||
|
||||
object->Release();
|
||||
return SUCCEEDED(result);
|
||||
}
|
||||
|
||||
// OFFSET: 0x00AB2430
|
||||
// FUNCTION: fn_45431
|
||||
void BrowserSiteAttachment::Detach() {
|
||||
IOleObject* object;
|
||||
if (SUCCEEDED(this->sizing.browser->QueryInterface(IID_IOleObject, reinterpret_cast<void**>(&object)))) {
|
||||
UnadviseBrowserEvents(object, DIID_DWebBrowserEvents2, this->cookie);
|
||||
object->Release();
|
||||
}
|
||||
|
||||
delete this->site;
|
||||
this->site = nullptr;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue