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


C++ Panel::GetChildCount方法代码示例

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


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

示例1: OnChangeChild

void BuildModeDialog::OnChangeChild( int direction )
{
	Assert( direction == 1 || direction == -1 );
	if ( !m_pBuildGroup )
		return;

	Panel *current = m_pCurrentPanel;
	Panel *context = m_pBuildGroup->GetContextPanel();

	if ( !current || current == context )
	{
		current = NULL;
		if ( context->GetChildCount() > 0 )
		{
			current = context->GetChild( 0 );
		}
	}
	else
	{
		int i;
		// Move in direction requested
		int children = context->GetChildCount();
		for ( i = 0; i < children; ++i )
		{
			Panel *child = context->GetChild( i );
			if ( child == current )
			{
				break;
			}
		}

		if ( i < children )
		{
			for ( int offset = 1; offset < children; ++offset )
			{
				int test = ( i + ( direction * offset ) ) % children;
				if ( test < 0 )
					test += children;
				if ( test == i )
					continue;

				Panel *check = context->GetChild( test );
				BuildModeDialog *bm = dynamic_cast< BuildModeDialog * >( check );
				if ( bm )
					continue;

				current = check;
				break;
			}
		}
	}

	if ( !current )
	{
		return;
	}

	SetActiveControl( current );
}
开发者ID:hzqst,项目名称:CaptionMod,代码行数:59,代码来源:BuildModeDialog.cpp

示例2: if

//-----------------------------------------------------------------------------
// Purpose: Find the correct radio button to move to.
// Input  : direction - the direction we are moving, up or down. 
//-----------------------------------------------------------------------------
RadioButton *RadioButton::FindBestRadioButton(int direction)
{
	RadioButton *bestRadio = NULL;
	int highestRadio = 0;
	Panel *pr = GetParent();
	if (pr)
	{
		// find the radio button to go to next
		for (int i = 0; i < pr->GetChildCount(); i++)
		{
			RadioButton *child = dynamic_cast<RadioButton *>(pr->GetChild(i));
			if (child && child->GetRadioTabPosition() == _oldTabPosition)
			{
				if (child->GetSubTabPosition() == _subTabPosition + direction)
				{
					bestRadio = child;
					break;
				}
				if ( (child->GetSubTabPosition() == 0)  && (direction == DOWN) )
				{
					bestRadio = child;
					continue;
				}
				else if ( (child->GetSubTabPosition() > highestRadio) && (direction == UP) )
				{
					bestRadio = child;
					highestRadio = bestRadio->GetSubTabPosition();
					continue;
				}
				if (!bestRadio)
				{
					bestRadio = child;
				}
			}
		}
		
		if (bestRadio)
		{
			bestRadio->RequestFocus();
		}
		
		InvalidateLayout();
		Repaint();
	}

	return bestRadio;
}
开发者ID:oskarlh,项目名称:HLEnhanced,代码行数:51,代码来源:RadioButton.cpp


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