当前位置: 首页>>代码示例>>C++>>正文


C++ Base::Height方法代码示例

本文整理汇总了C++中Base::Height方法的典型用法代码示例。如果您正苦于以下问题:C++ Base::Height方法的具体用法?C++ Base::Height怎么用?C++ Base::Height使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Base的用法示例。


在下文中一共展示了Base::Height方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SetBounds

bool ResizableControl::SetBounds( int x, int y, int w, int h )
{
	gwen::Point minSize = GetMinimumSize();

	// Clamp Minimum Size
	if ( w < minSize.x ) { w = minSize.x; }

	if ( h < minSize.y ) { h = minSize.y; }

	// Clamp to parent's window
	Base* pParent = GetParent();

	if ( pParent && m_bClampMovement )
	{
		if ( x + w > pParent->Width() ) { x = pParent->Width() - w; }

		if ( x < 0 ) { x = 0; }

		if ( y + h > pParent->Height() ) { y = pParent->Height() - h; }

		if ( y < 0 ) { y = 0; }
	}

	return BaseClass::SetBounds( x, y, w, h );
}
开发者ID:MegaThorx,项目名称:GWEN,代码行数:25,代码来源:ResizableControl.cpp

示例2: MoveTo

void Base::MoveTo(int x, int y)
{
    if (m_bRestrictToParent && GetParent())
    {
        Base* pParent = GetParent();

        if (x-GetPadding().left < pParent->GetMargin().left)
            x = pParent->GetMargin().left+GetPadding().left;

        if (y-GetPadding().top < pParent->GetMargin().top)
            y = pParent->GetMargin().top+GetPadding().top;

        if (x+Width()+GetPadding().right > pParent->Width()-pParent->GetMargin().right)
            x = pParent->Width()-pParent->GetMargin().right-Width()-GetPadding().right;

        if (y+Height()+GetPadding().bottom > pParent->Height()-pParent->GetMargin().bottom)
            y = pParent->Height()-pParent->GetMargin().bottom-Height()-GetPadding().bottom;
    }

    SetBounds(x, y, Width(), Height());
}
开发者ID:craley,项目名称:Poky,代码行数:21,代码来源:Base.cpp

示例3: Layout

void Menu::Layout( Skin::Base* skin )
{
	int childrenHeight = 0;
	for ( Base::List::iterator it = m_InnerPanel->Children.begin(); it != m_InnerPanel->Children.end(); ++it )
	{
		Base* pChild = (*it);
		if ( !pChild )
			continue;

		childrenHeight += pChild->Height();
	}

	if ( Y() + childrenHeight > GetCanvas()->Height() )
		childrenHeight = GetCanvas()->Height() - Y();

	SetSize( Width(), childrenHeight );

	BaseClass::Layout( skin );
}
开发者ID:icebreaker,项目名称:Gwen,代码行数:19,代码来源:Menu.cpp

示例4: Layout

void Menu::Layout(Skin::Base* skin)
{
    // Call the base class.
    ScrollControl::Layout(skin);

    int children_height = 0;

    for (auto i = _inner_panel->GetChildren().begin(); i != _inner_panel->GetChildren().end(); ++i)
    {
        Base* child = (*i);
        assert(child != nullptr);
        if (child != nullptr)
        {
            children_height += child->Height();
        }
    }

    if (Y() + children_height > GetCanvas()->Height())
    {
        children_height = GetCanvas()->Height() - Y();
    }

    SetSize(Width(), children_height);
}
开发者ID:authenticate,项目名称:GWEN,代码行数:24,代码来源:Menu.cpp

示例5: RecurseLayout

void Base::RecurseLayout( Skin::Base* skin )
{
	if ( m_Skin ) { skin = m_Skin; }

	if ( Hidden() ) { return; }

	if ( NeedsLayout() )
	{
		m_bNeedsLayout = false;
		Layout( skin );
	}

	Gwen::Rect rBounds = GetRenderBounds();
	// Adjust bounds for padding
	rBounds.x += m_Padding.left;
	rBounds.w -= m_Padding.left + m_Padding.right;
	rBounds.y += m_Padding.top;
	rBounds.h -= m_Padding.top + m_Padding.bottom;

	for ( Base::List::iterator iter = Children.begin(); iter != Children.end(); ++iter )
	{
		Base* pChild = *iter;

		if ( pChild->Hidden() )
		{ continue; }

		int iDock = pChild->GetDock();

		if ( iDock & Pos::Fill )
		{ continue; }

		if ( iDock & Pos::Top )
		{
			const Margin & margin = pChild->GetMargin();
			pChild->SetBounds( rBounds.x + margin.left, rBounds.y + margin.top, rBounds.w - margin.left - margin.right, pChild->Height() );
			int iHeight = margin.top + margin.bottom + pChild->Height();
			rBounds.y += iHeight;
			rBounds.h -= iHeight;
		}

		if ( iDock & Pos::Left )
		{
			const Margin & margin = pChild->GetMargin();
			pChild->SetBounds( rBounds.x + margin.left, rBounds.y + margin.top, pChild->Width(), rBounds.h - margin.top - margin.bottom );
			int iWidth = margin.left + margin.right + pChild->Width();
			rBounds.x += iWidth;
			rBounds.w -= iWidth;
		}

		if ( iDock & Pos::Right )
		{
			// TODO: THIS MARGIN CODE MIGHT NOT BE FULLY FUNCTIONAL
			const Margin & margin = pChild->GetMargin();
			pChild->SetBounds( ( rBounds.x + rBounds.w ) - pChild->Width() - margin.right, rBounds.y + margin.top, pChild->Width(), rBounds.h - margin.top - margin.bottom );
			int iWidth = margin.left + margin.right + pChild->Width();
			rBounds.w -= iWidth;
		}

		if ( iDock & Pos::Bottom )
		{
			// TODO: THIS MARGIN CODE MIGHT NOT BE FULLY FUNCTIONAL
			const Margin & margin = pChild->GetMargin();
			pChild->SetBounds( rBounds.x + margin.left, ( rBounds.y + rBounds.h ) - pChild->Height() - margin.bottom, rBounds.w - margin.left - margin.right, pChild->Height() );
			rBounds.h -= pChild->Height() + margin.bottom + margin.top;
		}

		pChild->RecurseLayout( skin );
	}

	m_InnerBounds = rBounds;

	//
	// Fill uses the left over space, so do that now.
	//
	for ( Base::List::iterator iter = Children.begin(); iter != Children.end(); ++iter )
	{
		Base* pChild = *iter;
		int iDock = pChild->GetDock();

		if ( !( iDock & Pos::Fill ) )
		{ continue; }

		const Margin & margin = pChild->GetMargin();
		pChild->SetBounds( rBounds.x + margin.left, rBounds.y + margin.top, rBounds.w - margin.left - margin.right, rBounds.h - margin.top - margin.bottom );
		pChild->RecurseLayout( skin );
	}

	PostLayout( skin );

	if ( IsTabable() && !IsDisabled() )
	{
		if ( !GetCanvas()->FirstTab ) { GetCanvas()->FirstTab = this; }

		if ( !GetCanvas()->NextTab ) { GetCanvas()->NextTab = this; }
	}

	if ( Gwen::KeyboardFocus == this )
	{
		GetCanvas()->NextTab = NULL;
	}
//.........这里部分代码省略.........
开发者ID:darkf,项目名称:gwen,代码行数:101,代码来源:Base.cpp


注:本文中的Base::Height方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。