本文整理汇总了C++中cegui::Window::getActiveChild方法的典型用法代码示例。如果您正苦于以下问题:C++ Window::getActiveChild方法的具体用法?C++ Window::getActiveChild怎么用?C++ Window::getActiveChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cegui::Window
的用法示例。
在下文中一共展示了Window::getActiveChild方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Update
void EditorGUI::Update(float32 delta)
{
// Setting the active window
if (!gInputMgr.IsMouseButtonPressed(InputSystem::MBTN_LEFT) && !gInputMgr.IsMouseButtonPressed(InputSystem::MBTN_RIGHT))
{
CEGUI::Window* activeWindow = CEGUI::System::getSingleton().getGUISheet();
if (!activeWindow || !activeWindow->getActiveChild())
{
if (gEditorMgr.IsLockedToGame()) mGameViewport->Activate();
else mEditorViewport->Activate();
}
else
{
bool isEditbox = activeWindow->getActiveChild()->getType().compare("Editor/Editbox") == 0;
bool isPopupMenu = activeWindow->getActiveChild()->getType().compare("Editor/PopupMenu") == 0;
bool isButton = activeWindow->getActiveChild()->getType().compare("Editor/Button") == 0;
if (!isEditbox && !isPopupMenu && !isButton)
{
if (gEditorMgr.IsLockedToGame() && !mEditorViewport->isCapturedByThis()) mGameViewport->Activate();
else mEditorViewport->Activate();
}
}
}
mEntityWindow->Update(delta);
//gGUIMgr.GetWindow("UserGUI_GameLayout")->invalidate(true);
}
示例2: GUI_Paste_From_Clipboard
bool GUI_Paste_From_Clipboard( void )
{
CEGUI::Window *sheet = CEGUI::System::getSingleton().getGUISheet();
// no sheet
if( !sheet )
{
return 0;
}
CEGUI::Window *window_active = sheet->getActiveChild();
// no active window
if( !window_active )
{
return 0;
}
const CEGUI::String &type = window_active->getType();
// MultiLineEditbox
if( type.find( "/MultiLineEditbox" ) != CEGUI::String::npos )
{
CEGUI::MultiLineEditbox *editbox = static_cast<CEGUI::MultiLineEditbox*>(window_active);
if( editbox->isReadOnly() )
{
return 0;
}
CEGUI::String::size_type beg = editbox->getSelectionStartIndex();
CEGUI::String::size_type len = editbox->getSelectionLength();
CEGUI::String new_text = editbox->getText();
// erase selected text
new_text.erase( beg, len );
// get clipboard text
CEGUI::String clipboard_text = reinterpret_cast<const CEGUI::utf8*>(Get_Clipboard_Content().c_str());
// set new text
editbox->setText( new_text.insert( beg, clipboard_text ) );
// set new carat index
editbox->setCaratIndex( editbox->getCaratIndex() + clipboard_text.length() );
}
// Editbox
else if( type.find( "/Editbox" ) != CEGUI::String::npos )
{
CEGUI::Editbox *editbox = static_cast<CEGUI::Editbox*>(window_active);
if( editbox->isReadOnly() )
{
return 0;
}
CEGUI::String::size_type beg = editbox->getSelectionStartIndex();
CEGUI::String::size_type len = editbox->getSelectionLength();
CEGUI::String new_text = editbox->getText();
// erase selected text
new_text.erase( beg, len );
// get clipboard text
CEGUI::String clipboard_text = reinterpret_cast<const CEGUI::utf8*>(Get_Clipboard_Content().c_str());
// set new text
editbox->setText( new_text.insert( beg, clipboard_text ) );
// set new carat index
editbox->setCaratIndex( editbox->getCaratIndex() + clipboard_text.length() );
}
else
{
return 0;
}
return 1;
}
示例3: GUI_Copy_To_Clipboard
bool GUI_Copy_To_Clipboard( bool cut )
{
CEGUI::Window *sheet = CEGUI::System::getSingleton().getGUISheet();
// no sheet
if( !sheet )
{
return 0;
}
CEGUI::Window *window_active = sheet->getActiveChild();
// no active window
if( !window_active )
{
return 0;
}
CEGUI::String sel_text;
const CEGUI::String &type = window_active->getType();
// MultiLineEditbox
if( type.find( "/MultiLineEditbox" ) != CEGUI::String::npos )
{
CEGUI::MultiLineEditbox *editbox = static_cast<CEGUI::MultiLineEditbox*>(window_active);
CEGUI::String::size_type beg = editbox->getSelectionStartIndex();
CEGUI::String::size_type len = editbox->getSelectionLength();
sel_text = editbox->getText().substr( beg, len ).c_str();
// if cutting
if( cut )
{
if( editbox->isReadOnly() )
{
return 0;
}
CEGUI::String new_text = editbox->getText();
editbox->setText( new_text.erase( beg, len ) );
}
}
// Editbox
else if( type.find( "/Editbox" ) != CEGUI::String::npos )
{
CEGUI::Editbox *editbox = static_cast<CEGUI::Editbox*>(window_active);
CEGUI::String::size_type beg = editbox->getSelectionStartIndex();
CEGUI::String::size_type len = editbox->getSelectionLength();
sel_text = editbox->getText().substr( beg, len ).c_str();
// if cutting
if( cut )
{
if( editbox->isReadOnly() )
{
return 0;
}
CEGUI::String new_text = editbox->getText();
editbox->setText( new_text.erase( beg, len ) );
}
}
else
{
return 0;
}
Set_Clipboard_Content( sel_text.c_str() );
return 1;
}