Skip to content

ui::NativeControlDesc

Header: winui/render/NativeHost.hpp.

The Win32 child window a NativeControl creates: a window class name, its initial text and style bits. Windows only. Without a native host (a headless window, another platform) nothing is created, and the control keeps its size and draws nothing. The style fields are plain integers so this header compiles on any platform. On Windows, pass WS_, WS_EX_ and control style values as they are.

Example:

auto stack = std::make_unique<ui::StackControl>(ui::Orientation::Vertical);
ui::NativeControlDesc desc{
    .class_name   = "EDIT",
    .initial_text = "hello",
    .style        = 0x0004 /*ES_MULTILINE*/ | 0x00200000 /*WS_VSCROLL*/,
};
stack->add(std::make_unique<ui::NativeControl>(std::move(desc), ui::Size{200.0f, 80.0f}));

Field Type Default
class_name std::string Registered window class, e.g. "RICHEDIT50W" or "EDIT".
initial_text std::string The window text at creation (initial content).
style std::uint32_t 0 Extra WS_* / control style bits (the host adds WS_CHILD).
ex_style std::uint32_t 0 WS_EX_* bits.