rodecomp/Source/Client/Browser/BrowserAddressBar.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

55 lines
1.9 KiB
C++

#include "Client/Browser/WebBrowser.h"
#include <commctrl.h>
// OFFSET: 0x00AB27A0
// FUNCTION: fn_17416
bool CWebBrowser::CreateAddressBar(int width, int requestedHeight) {
this->rebar = CreateWindowExA(
WS_EX_TOOLWINDOW, REBARCLASSNAMEA, "rebar",
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_BORDER | RBS_VARHEIGHT | RBS_BANDBORDERS | RBS_REGISTERDROP | RBS_DBLCLKTOGGLE |
CCS_NOPARENTALIGN | CCS_NODIVIDER,
0, 0, width, 0, this->host, nullptr, GetModuleHandleA(nullptr), nullptr
);
if (!this->rebar) {
return false;
}
REBARINFO bar{};
bar.cbSize = sizeof(bar);
if (!SendMessageA(this->rebar, RB_SETBARINFO, 0, reinterpret_cast<LPARAM>(&bar))) {
return false;
}
HWND combo = CreateWindowExA(
WS_EX_CLIENTEDGE, WC_COMBOBOXA, "addressbar", WS_CHILD | WS_VISIBLE | CBS_DROPDOWN, 10, 10, 160, 22, this->rebar, nullptr, GetModuleHandleA(nullptr),
nullptr
);
REBARBANDINFOA band{};
band.cbSize = sizeof(band);
band.fMask = RBBIM_STYLE | RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_SIZE | RBBIM_BACKGROUND;
band.fStyle = RBBS_CHILDEDGE | RBBS_FIXEDBMP;
band.hwndChild = combo;
band.cxMinChild = 0;
band.cyMinChild = requestedHeight;
band.cx = 160;
band.hbmBack = LoadBitmapA(GetModuleHandleA(nullptr), nullptr);
if (!SendMessageA(this->rebar, RB_INSERTBANDA, static_cast<WPARAM>(-1), reinterpret_cast<LPARAM>(&band))) {
return false;
}
this->combo = combo;
HWND edit = GetWindow(combo, GW_CHILD);
lpPrevWndFunc = reinterpret_cast<WNDPROC>(SetWindowLongPtrA(edit, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(BrowserAddressEditProc)));
RECT rectangle;
GetClientRect(this->host, &rectangle);
SetWindowPos(this->rebar, nullptr, 0, 0, rectangle.right - rectangle.left, rectangle.bottom - rectangle.top, SWP_NOMOVE);
ShowWindow(this->rebar, SW_HIDE);
this->barHeight = this->AddressBarHeight();
return true;
}