Custom images for checkbox and radio buttons

The individual tool icons created by toolboxlayoutmanager.C are nothing more than customized radio buttons. Existing radio buttons have all the needed functionality to implement typical toolbox behavior: choosing a new icon automatically deselects the previous icon. This is stock radio button functionality: selecting one radio button deselects the previous one. All that's needed is to create a radio button with a custom appearance by using a custom appearance object for the radio button.

toolboxlayoutmanager.C shows two approaches for creating custom appearance objects. The first approach creates a custom appearance object directly:

x::w::const_image_button_appearance custom=
    x::w::image_button_appearance::base::radio_theme()->modify
        ([&]
         (const x::w::image_button_appearance &appearance)
         {
             appearance->focus_border=
                x::w::focus_border_appearance::base::visible_thin_theme();
             appearance->set_distinct_focusoff_border();
             appearance->images={icon_set[0], icon_set[1]};
         });

auto b=f->create_radio(rg,
                       [](const auto &f) {},
                       custom);

This is an example of customizing a radio button's appearance. A factory's create_radio() method takes an optional custom appearance object parameter that controls the radio button's visual look. Its images member is a vector of custom images for the radio button: typically two filenames, the normal and the selected radio button image.

All toolbox icon images should have the same width and height, for best results using the toolbox layout manager. Image files can be png, gif, and jpg images; in addition to the LibCXXW-specific SXG format. png, gif, and jpg images have a fixed size. SXG images are scalable. toolboxlayoutmanager.C loads a set of SXG images from LibCXXW's default theme, whose size gets automatically scaled in sync with the current display theme.

Custom application image filenames should include a path component. Use ./filename to load an image file from the current directory. This is because filenames without a path components are also searched in LibCXXW's theme directory.