Administrative source import: native x86 compilation passed for 423 authored units. Source placement and submission states are migrated separately; this commit does not imply peer acceptance.
Previous head: 35d2a8cb36
Payload SHA256: 592f016d2730c5593bb653aa054c1e5f76a6df72c8f5a09e66f74876e2e33dee
59 lines
2 KiB
C++
59 lines
2 KiB
C++
#include "Client/Browser/BrowserAddressBar.h"
|
|
|
|
#include <commctrl.h>
|
|
|
|
// OFFSET: 0x00AB27A0
|
|
// FUNCTION: fn_17416
|
|
bool BrowserAddressBar::Create(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);
|
|
this->previous = reinterpret_cast<WNDPROC>(SetWindowLongPtrA(edit, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(this->procedure)));
|
|
|
|
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->height = 0;
|
|
if (this->rebar && this->visible != 0) {
|
|
GetClientRect(this->rebar, &rectangle);
|
|
this->height = rectangle.bottom - rectangle.top + 4;
|
|
}
|
|
|
|
return true;
|
|
}
|