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


C++ Window::activate方法代码示例

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


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

示例1: OnEventKeyDown

bool TabNavigation::OnEventKeyDown(const CEGUI::EventArgs& e)
{
	const CEGUI::KeyEventArgs& args = static_cast<const CEGUI::KeyEventArgs&>(e);
	if (args.scancode == CEGUI::Key::Tab) // Tab or Shift+Tab
	{
		WidgetList::iterator itCurrent = Containers::find(mTabOrder.begin(), mTabOrder.end(), args.window);
		OC_ASSERT(itCurrent != mTabOrder.end());
		WidgetList::iterator itFocus = itCurrent;
		CEGUI::Window* newWidget = 0;
		do
		{
			if (args.sysKeys & CEGUI::Shift)
			{
				// Set previous
				if (itFocus == mTabOrder.begin())
					itFocus = mTabOrder.end();
				--itFocus;
			}
			else
			{
				// Set next
				++itFocus;
				if (itFocus == mTabOrder.end())
					itFocus = mTabOrder.begin();
			}
			newWidget = *itFocus;
		}
		while ((!newWidget->isVisible() || newWidget->isDisabled() || newWidget->getProperty("ReadOnly") == "True" ) && itFocus != itCurrent);
		newWidget->activate();

		// Make sure active widget will be visible
		if (mScrollablePane)
		{
			CEGUI::Window* w = newWidget;
			CEGUI::Vector2 widgetOffset(0, 0);
			do
			{
				widgetOffset += w->getPosition().asAbsolute(w->getParentPixelSize());
				w = w->getParent();
			}
			while (w != mScrollablePane && w != 0);

			float32 scrollViewTop = mScrollablePane->getContentPaneArea().getSize().d_height * mScrollablePane->getVerticalScrollPosition();
			float32 scrollViewBottom = scrollViewTop + mScrollablePane->getClipRect().getHeight();
			
			if (widgetOffset.d_y < scrollViewTop || widgetOffset.d_y + newWidget->getPixelSize().d_height > scrollViewBottom)
			{
				// We need to scroll
				mScrollablePane->setVerticalScrollPosition(widgetOffset.d_y / mScrollablePane->getContentPaneArea().getSize().d_height);
			}
		}

		return true;
	}
	return false;
}
开发者ID:Ocerus,项目名称:Ocerus,代码行数:56,代码来源:TabNavigation.cpp

示例2: onBattleEnd

void GameCoordinator::onBattleEnd(int winnerPlayer)
{
	CEGUI::System::getSingleton().getGUISheet()->deactivate();
	CEGUI::Window* menu = CEGUI::System::getSingleton().getGUISheet()->getChildRecursive("Game/Menu");
	CEGUI::Window* end_text = CEGUI::System::getSingleton().getGUISheet()->getChildRecursive("Game/End");
	menu->activate();
	end_text->setVisible(true);
	if (winnerPlayer == 0)
		end_text->setText(utf8ToCeguiString(GameSettingsSingleton.getLanguage().textForCode("game.won")));
	else if (winnerPlayer == 1)
		end_text->setText(utf8ToCeguiString(GameSettingsSingleton.getLanguage().textForCode("game.lost")));
	else
		end_text->setText(utf8ToCeguiString(GameSettingsSingleton.getLanguage().textForCode("game.quit")));
}
开发者ID:lbarnabas88,项目名称:3DBattleships,代码行数:14,代码来源:GameCoordinator.cpp

示例3: Open

bool GoodsViewerPage::Open()
{
	CEGUI::Window *pPage = GetPageWindow();
	if (pPage)
	{
		pPage->setVisible(true);
		pPage->activate();
		pPage->setAlwaysOnTop(true);
	}
	else
	{
		CEGUI::InvalidRequestException("GoodsViewerPage Open Failed!");
		return false;
	}
	return true;
}
开发者ID:xiongshaogang,项目名称:mmo-resourse,代码行数:16,代码来源:GoodsViewerPage.cpp


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