Пример #1
0
suic::Size TabControl::MeasureOverride(const suic::Size& size)
{
    suic::Size availableSize;

    if (ReadFlag(CoreFlags::IsMeasureDirty))
    {
        _headerHeight = 0;

        int iItems = GetItems()->GetCount();

        for (int i = 0; i < iItems; ++i)
        {
            TabItemPtr tabItem(GetItems()->GetItem(i));

            tabItem->Measure(size);

            if (tabItem->GetDesiredSize().cy > _headerHeight)
            {
                _headerHeight = tabItem->GetDesiredSize().cy;
            }
        }

        TabItemPtr focusTab(_focusItem);

        if (focusTab && focusTab->GetTabContent())
        {
            focusTab->GetTabContent()->Measure(size);
        }

        WriteFlag(CoreFlags::IsMeasureDirty, false);
    }

    return size;
}
Пример #2
0
void TreeViewItem::OnRender(suic::DrawingContext * drawing)
{
    suic::Rect rect(0, 0, RenderSize().cx, _headerHost->RenderSize().cy);
    suic::BrushPtr bkgnd;

    if (IsFocused() || ReadFlag(CoreFlags::IsSelected))
    {
        if (GetStyle()->GetTrigger(_T("IsFocused")))
        {
            bkgnd = GetStyle()->GetTrigger(_T("IsFocused"))->GetValue(_T("Background"));
        }
    }
    else if (_headerHost->IsMouseOver() && GetStyle()->GetTrigger(_T("IsMouseOver")))
    {
        bkgnd = GetStyle()->GetTrigger(_T("IsMouseOver"))->GetValue(_T("Background"));
    }

    if (bkgnd)
    {
        bkgnd->Draw(drawing, &rect);
    }
}