Example #1
0
void TreeViewItem::OnCollapsed()
{
    //
    // 取得树对象指针
    //
    TreeView* pTree = GetParentTreeView(this);


    WriteFlag(CoreFlags::IsCollapsed, true);

    TreeViewItemPtr selPtr(pTree->SelectedItem());

    //
    // 如果自己的子孙选择了,取消,选中本节点
    //
    if (selPtr && selPtr.get() != this)
    {
        selPtr->Unselect();
        Select();
    }

    if (pTree)
    {
        pTree->UpdateLayout();
    }
}
ErrVal
MVCScalableModifyCode::WriteTrailingBits()
{
	RNOK( WriteFlag( 1 ) );
	RNOK( WriteAlignZero() );
	return Err::m_nOK;
}
Example #3
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;
}
Example #4
0
TreeViewItem::TreeViewItem()
    : _showDotLine(false)
    , _internalIndent(0)
{
    SetClassName(_T("TreeViewItem"));

    WriteFlag(CoreFlags::IsSupportMouseOver, true);

    SetHorizontalContentAlignment(HoriContentAlignment::Left);
    SetVerticalContentAlignment(VertContentAlignment::Center);

    SetPadding(suic::Rect(2,0,0,0));

    _check.SetAutoDelete(false);
    _icon.SetAutoDelete(false);

    _expand = new TreeButton();

    _check.SetVerticalAlignment(VertAlignment::Center);
    _icon.SetVerticalAlignment(VertAlignment::Center);    
    _expand->SetVerticalAlignment(VertAlignment::Center);

    _headerHost->AddChild(_expand.get());
    _headerHost->AddChild(&_check);
    _headerHost->AddChild(&_icon);

    SetHeader(new ui::Label());
    _header->SetMinHeight(16);
}
Example #5
0
void TreeViewItem::OnExpanded()
{
    WriteFlag(CoreFlags::IsCollapsed, false);

    TreeView* pTree = GetParentTreeView(this);

    pTree->UpdateLayout();
}
Example #6
0
void TreeViewItem::Collapse()
{
    WriteFlag(CoreFlags::IsCollapsed, true);

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

    for (int i = 0; i < count; ++i)
    {
        TreeViewItemPtr item = TreeViewItemPtr::cast(GetItems()->GetItem(i));

        if (item)
        {
            item->Collapse();
        }
    }
}
Example #7
0
void TabControl::OnItemsChanged(NotifyContainerChangedArg& e)
{
    WriteFlag(CoreFlags::IsMeasureDirty, true);

    if (e.GetNewItems()->GetCount() > 0)
    {        
        TabItemPtr itemPtr = TabItemPtr::cast(e.GetNewItems()->GetAt(0));
        suic::ElementPtr focused;

        //
        // 使当前拥有焦点的元素总是在最上(设置zIndex)
        //
        if (focused)
        {
            //suic::Panel::SetZIndex(focused, _itemLayout->GetLogicalChildrenCount());
        }
    }
}
Example #8
0
//////////////////////////////////////////////////////////
// ComboBox
//
ComboBox::ComboBox()
    : _bReadOnly(false)
    , _downHeight(16)
{
    SetClassName(_T("ComboBox"));
    _popup = new suic::UIPopup();
    _list = new ComboBoxListBox();

    _textBox = new TextBox();
    _items = _list->GetItems();

    AddLogicalChild(_textBox.get());
    AddLogicalChild(_popup.get());
    _popup->AddLogicalChild(_list.get());

    _textBox->SetPadding(suic::Rect(2));

    // 支持鼠标传递绘制
    WriteFlag(CoreFlags::IsSupportMouseOver, true);
}
Example #9
0
void ItemsControl::OnItemsChanged(suic::NotifyCollectionChangedArg& e)
{
    WriteFlag(CoreFlags::IsMeasureDirty, true);

    if (e.NewItems()->GetCount() > 0)
    {
        suic::Size availableSize;

        if (e.GetAction() == suic::NotifyCollectionChangedAction::Add)
        {
        }
    }

    if (e.OldItems()->GetCount() > 0)
    {
        if (e.GetAction() == suic::NotifyCollectionChangedAction::Remove)
        {
        }
    }
}
Example #10
0
void cUIControl::FillBackground( bool enabled ) {
	WriteFlag( UI_FILL_BACKGROUND, enabled ? 1 : 0 );

	if ( enabled && NULL == mBackground ) {
		mBackground = eeNew( cUIBackground, () );
	}