Skip to content

ui::WindowIcon

Header: winui/ui/WindowShell.hpp.

A small picture for the OS to show: the caption and taskbar icon, a taskbar overlay badge, or a thumbnail-toolbar button. It is one of three kinds, and the first one set wins: - an image (straight-alpha RGBA), scaled to each size the OS needs - a glyph drawn over an optional background, the same IconGlyph controls draw symbols with - an icon from the app's own resources

Example:

// A glyph on the accent color as the caption/taskbar icon...
window.set_icon(ui::WindowIcon{.glyph      = ui::IconGlyph{0xE80F},
                            .foreground = ui::colors::White,
                            .background = ui::Color::from_argb(0xFF0F6CBD)});
// ...and a red badge over the taskbar button.
window.set_taskbar_overlay(
    ui::WindowIcon{.glyph = ui::IconGlyph{0xE7E7}, .foreground = ui::Color::from_argb(0xFFC42B1C)}, "3 unread");

image

Bitmap image {}

The picture, straight-alpha RGBA; takes precedence over glyph when not empty.

glyph

IconGlyph glyph {0}

A Segoe Fluent Icons glyph, used when image is empty; codepoint 0 is none.

foreground

std::optional<Color> foreground {}

The glyph's color. Unset draws it black on a light taskbar and white on a dark one, since the taskbar shows the icon, its overlay and the thumbnail buttons. It is redrawn when the user switches the taskbar's theme.

background

Color background = colors::Transparent

Filled behind the glyph; transparent leaves just the glyph.

resource

std::string resource {}

An icon the app ships with, used when image and glyph are both empty. It names an icon resource in the executable: "APPICON" by name, "#101" by number. It is loaded at each size the OS needs.

empty

bool empty() const

No image, glyph or resource: nothing to show.