Esempio n. 1
0
void ToolBar_Impl::on_resized()
{
    Rect rect = toolbar->get_geometry();

    int rect_width = rect.get_width();
    int rect_height = rect.get_height();

    if ( (rect_width > 0) && (rect_height > 0) )	// Only update if the geometry is valid
    {
        bool old_horiz = toolbar->get_pseudo_class("horizontal");

        horizontal = (rect_width >= rect_height);

        if (old_horiz != horizontal)
        {
            if (horizontal)
                toolbar->set_pseudo_class("horizontal", true);
            else
                toolbar->set_pseudo_class("vertical", true);
        }

        need_layout_update = true;
    }
}
Esempio n. 2
0
void ToolBar_Impl::create_parts()
{
    toolbar->set_pseudo_class(CssStr::horizontal, true);
    part_item_normal = GUIThemePart(toolbar, CssStr::ToolBar::part_item);
    part_item_normal.set_pseudo_class(CssStr::normal, true);
    part_item_disabled = GUIThemePart(toolbar, CssStr::ToolBar::part_item);
    part_item_disabled.set_pseudo_class(CssStr::disabled, true);
    part_item_pressed = GUIThemePart(toolbar, CssStr::ToolBar::part_item);
    part_item_pressed.set_pseudo_class(CssStr::pressed, true);
    part_item_hot = GUIThemePart(toolbar, CssStr::ToolBar::part_item);
    part_item_hot.set_pseudo_class(CssStr::hover, true);
    part_item_on = GUIThemePart(toolbar, CssStr::ToolBar::part_item);
    part_item_on.set_pseudo_class(CssStr::on, true);

    size_icon.width = part_item_normal.get_property_int(CssStr::icon_width, "0");
    size_icon.height = part_item_normal.get_property_int(CssStr::icon_height, "0");
    std::string str_alignment = toolbar->get_property(CssStr::layout, "left");
    if (str_alignment == "center")
        layout = layout_center;
    else
        layout = layout_left;

    need_layout_update = true;
}