rodecomp/Source/Client/Browser/BrowserAddressBar.cpp
ragnarok-clanker 81896e2339 Decompile fn_17416 (CWebBrowser::CreateAddressBar)
Batch #15987 by Yommy: 1 byte-identical, 0 confirmed by peer review.

- fn_17416 CWebBrowser::CreateAddressBar: byte-identical

Merged automatically: every function is byte-identical to the original.
2026-11-10 12:35:09 +00:00

57 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);
bar.fMask = 0;
bar.himl = nullptr;
if (!SendMessageA(this->rebar, RB_SETBARINFO, 0, reinterpret_cast<LPARAM>(&bar))) {
return false;
}
HWND combo = CreateWindowExA(
WS_EX_CLIENTEDGE, "COMBOBOX", "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.hbmBack = LoadBitmapA(GetModuleHandleA(nullptr), nullptr);
band.hwndChild = combo;
band.cxMinChild = 0;
band.cyMinChild = requestedHeight;
band.cx = 160;
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;
}