本文整理汇总了C++中cegui::Window::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ Window::getName方法的具体用法?C++ Window::getName怎么用?C++ Window::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cegui::Window
的用法示例。
在下文中一共展示了Window::getName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: enableFloatingPointExceptions
//------------------------------------------------------------------------------
GUITeamSelect::GUITeamSelect(PuppetMasterClient * puppet_master) :
puppet_master_(puppet_master)
{
enableFloatingPointExceptions(false);
CEGUI::WindowManager& wm = CEGUI::WindowManager::getSingleton();
/// XXX hack because root window is stored inside metatask, no easy way to retrieve it
CEGUI::Window * parent = wm.getWindow("TankApp_root/");
// Use parent window name as prefix to avoid name clashes
root_ = wm.loadWindowLayout("teamselectmenu.layout", parent->getName());
menu_window_ = (CEGUI::Window*) wm.getWindow(parent->getName() + "teamselectmenu/menu");
menu_btn_[0] = (CEGUI::ButtonBase*) wm.getWindow(parent->getName() + "teamselectmenu/btn1");
menu_btn_[1] = (CEGUI::ButtonBase*) wm.getWindow(parent->getName() + "teamselectmenu/btn2");
menu_btn_spec_ = (CEGUI::ButtonBase*) wm.getWindow(parent->getName() + "teamselectmenu/btn3");
menu_btn_text_[0] = (CEGUI::ButtonBase*) wm.getWindow(parent->getName() + "teamselectmenu/btn1/text");
menu_btn_text_[1] = (CEGUI::ButtonBase*) wm.getWindow(parent->getName() + "teamselectmenu/btn2/text");
// add score to widget tree
parent->addChildWindow(menu_window_);
menu_window_->setVisible(false);
registerCallbacks();
enableFloatingPointExceptions();
s_input_handler.registerInputCallback("Change Team",
input_handler::SingleInputHandler(this, &GUITeamSelect::toggleShow),
&fp_group_);
}
示例2: mousePressed
bool CEGUIInputHandler::mousePressed(
const ApplicationMouseCode::MouseButton button) {
//BOOST_LOG_SEV(mBoostLogger, boost::log::trivial::debug)<< "MOUSE BUTTON PRESSED" << button;
CEGUI::GUIContext& context =
CEGUI::System::getSingleton().getDefaultGUIContext();
// Saving a mathgl graph to a file on right click
CEGUI::Window* window = context.getWindowContainingMouse();
if (window != NULL
&& (window->getName() == "MathGLWindow"
|| window->getName() == "MathGLRTTWindow")
&& button == ApplicationMouseCode::RightButton) {
std::vector<MathGLPanel*>::iterator it =
SimulationManager::getSingleton()->getViewController().getGraphWindows().begin();
for (;
it
!= SimulationManager::getSingleton()->getViewController().getGraphWindows().end();
it++) {
if ((*it)->getMathGlWindow() == window
|| (*it)->getMathGlWindow()->getChild("MathGLRTTWindow")
== window) {
(*it)->makePrint();
}
}
}
context.injectMouseButtonDown(InputUtils::convertToCEGUI(button));
return OgreInputHandler::mousePressed(button);
}
示例3: UpdateFolderList
void GUISystem::FolderSelector::Show(const CEGUI::String& windowTitle, bool showEditbox, const CEGUI::String& editboxLabel)
{
bool success = false;
OC_CEGUI_TRY;
{
CEGUI::Window* root = gGUIMgr.GetGUISheet();
mWindow = gGUIMgr.LoadSystemLayout("FolderSelector.layout", root->getName() + "/");
mWindow->setAlwaysOnTop(true);
mWindow->setModalState(true);
root->addChildWindow(mWindow);
CEGUI::Window* frame = mWindow->getChild(root->getName() + "/FolderSelector/Frame");
frame->setText(windowTitle);
mButtonOK = frame->getChild(root->getName() + "/FolderSelector/ButtonOK");
mButtonCancel = frame->getChild(root->getName() + "/FolderSelector/ButtonCancel");
mPathBox = frame->getChild(root->getName() + "/FolderSelector/PathBox");
mFolderList = static_cast<CEGUI::Listbox*>(frame->getChild(root->getName() + "/FolderSelector/FolderList"));
mFolderList->setWantsMultiClickEvents(true);
mEditbox = frame->getChild(root->getName() + "/FolderSelector/Editbox");
mEditbox->subscribeEvent(CEGUI::Editbox::EventKeyDown,
CEGUI::Event::Subscriber(&GUISystem::FolderSelector::OnEditboxKeyDown, this));
mButtonOK->subscribeEvent(CEGUI::PushButton::EventClicked,
CEGUI::Event::Subscriber(&GUISystem::FolderSelector::OnButtonClicked, this));
mButtonCancel->subscribeEvent(CEGUI::PushButton::EventClicked,
CEGUI::Event::Subscriber(&GUISystem::FolderSelector::OnButtonClicked, this));
mFolderList->subscribeEvent(CEGUI::Listbox::EventMouseDoubleClick,
CEGUI::Event::Subscriber(&GUISystem::FolderSelector::OnFolderListDoubleClicked, this));
CEGUI::Window* buttonCreateDirectory = frame->getChild(root->getName() + "/FolderSelector/ButtonCreateDirectory");
buttonCreateDirectory->subscribeEvent(CEGUI::PushButton::EventClicked,
CEGUI::Event::Subscriber(&GUISystem::FolderSelector::OnCreateDirectoryClicked, this));
if (!showEditbox)
{
mEditbox->hide();
frame->getChild(root->getName() + "/FolderSelector/EditboxLabel")->hide();
}
else
{
frame->getChild(root->getName() + "/FolderSelector/EditboxLabel")->setText(editboxLabel);
mEditbox->activate();
}
UpdateFolderList();
success = true;
}
OC_CEGUI_CATCH;
if (!success)
{
ocError << "Cannot show FolderSelector.";
delete this;
}
}
示例4: OnCreateNewWindow
//通知创建一个新窗口
BOOL CDataPool::OnCreateNewWindow(CEGUI::Window* pWinParent)
{
CEGUI::Window* pWindow = NULL;
if (m_szCreateWindowType.IsEmpty())
{
g_pEditorView->setCreateWindowFlag(false);
g_pEditorView->setCreateWindow(NULL);
return FALSE;
}
////显示名字对话框
//CCreateWindowDlg dlg(pWinParent == NULL);
//if (dlg.DoModal() == IDCANCEL)
//{
// return FALSE;
//}
//CString name ;
//name = dlg.m_szDefaultName;
//if (name.IsEmpty())
//{
// g_pEditorView->setCreateWindowFlag(false);
// g_pEditorView->setCreateWindow(NULL);
// return FALSE;
//}
//创建窗口
try
{
pWindow = WindowManager::getSingleton().createWindow(m_szCreateWindowType.GetString()/*, name.GetString()*/);
pWindow->setClippedByParent(true);
//pWindow->setPosition(CEGUI::Absolute, Point(0,0));
pWindow->setSize(CEGUI::Absolute, Size(100,100));
if (pWinParent == NULL)
{
System::getSingleton().getGUISheet()->addChildWindow(pWindow);
g_leftTreeWindow->InsertItemToTree(pWindow->getName().c_str(), NULL);
}
else
{
pWinParent->addChildWindow(pWindow);
CString szParentPath = GetParentTreePath(pWindow);
g_leftTreeWindow->InsertItemToTree(pWindow->getName().c_str(), szParentPath);
}
g_pEditorView->setCreateWindow(pWindow);
return TRUE;
}
catch (...)
{
MessageBox(AfxGetMainWnd()->GetSafeHwnd(), "创建窗口出现未知错误", "提示", MB_OK);
}
return FALSE;
}
示例5: SelectChildren
//------------------------------------------------------------------------
void Selection::SelectChildren(const CEGUI::Window* aWindow)
{
for (size_t i=0; i<aWindow->getChildCount(); i++)
{
CEGUI::Window* child = aWindow->getChildAtIdx(i);
// Skip __auto windows
if (child->getName().find("__auto_") == String::npos && child->getName().find("__TabPane__"))
{ // Add as an non-resizable box
m_allBoxes.push_back (WindowBox(child, false));
// Recurse!
SelectChildren(child);
}
}
}
示例6: OnRButtonDown
void CUIEditorView::OnRButtonDown(UINT nFlags, CPoint point)
{
g_CoreSystem.getCEGUISystem()->injectMousePosition(point.x, point.y);
g_CoreSystem.getCEGUISystem()->injectMouseButtonDown(CEGUI::RightButton);
if( getShowMode() == false ) return;
CMenu menu;
menu.CreatePopupMenu();
CEGUI::Window* mouseWindow = g_CoreSystem.getCEGUISystem()->getWindowContainingMouse();
bool showMenu = false;
INT menuId = ID_RIGHT_WINDOW_SELECT;
for ( ; mouseWindow ; mouseWindow = mouseWindow->getParent(),++menuId )
{
if (mouseWindow != CEGUI::System::getSingleton().getGUISheet() && !mouseWindow->isAutoWindow())
{
menu.AppendMenu(MF_STRING, menuId,mouseWindow->getName().c_str());
showMenu = true;
}
}
if (showMenu)
{
POINT pos;
GetCursorPos(&pos);
menu.TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON,pos.x, pos.y, this);
g_DataPool.OnSelectWindowChanged(NULL, m_pSelectedWindow);
}
CView::OnRButtonDown(nFlags, point);
}
示例7: OnLButtonDblClk
void CUIEditorView::OnLButtonDblClk(UINT nFlags, CPoint point)
{
g_CoreSystem.getCEGUISystem()->injectMouseButtonDown(CEGUI::LeftButton);
//找到鼠标点击的窗口
CEGUI::Window* pWin = CEGUI::System::getSingleton().getWindowContainingMouse();
if(pWin)
{
//检测窗口是否可以显示函数对话框
BOOL bShow = g_DataPool.m_scriptModule.DoFunction("canShowFunctionDlg",pWin->getWidgetType().c_str(),NULL);
//显示对话框
if(bShow)
{
CFunctionDlg dlg;
CString szString,szName;
szName = pWin->getName().c_str();
szString = szName;
szString += "_OnClicked";
dlg.SetLeftFunction(szString);
szString = szName;
szString += "_OnRClicked";
dlg.SetRightFunction(szString);
dlg.SetWindowName(szName);
dlg.DoModal();
}
}
CView::OnLButtonDblClk(nFlags, point);
}
示例8: setWindowSelected
void CUIEditorView::setWindowSelected(const CEGUI::String& name,bool addEvent /*= true*/)
{
try
{
if( name.length()> 0 && name != m_nSelectWindowName)
{
if(name == "___Shower_Window____") return;
CEGUI::Window* pWindow = CEGUI::WindowManager::getSingleton().getWindow(name);
CEGUI::Window* pOldSel = NULL;
if (pWindow && !pWindow->isAutoWindow())
{
if(m_nSelectWindowName.length() > 0)
{
pOldSel = CEGUI::WindowManager::getSingleton().getWindow(m_nSelectWindowName);
if (pOldSel)
{
for(;pOldSel && pOldSel != CEGUI::System::getSingleton().getGUISheet(); pOldSel = pOldSel->getParent())
{
pOldSel->unsubscribeEvent(CEGUI::Window::EventMoved, CEGUI::Event::Subscriber(&CUIEditorView::handleSelectedWindowMoved, this));
}
}
}
//pWindow->moveToFront();
m_nSelectWindowName = pWindow->getName();
CEGUI::Window* pSet = pWindow;
for (; pSet&& pSet !=CEGUI::System::getSingleton().getGUISheet(); pSet = pSet->getParent() )
{
pSet->subscribeEvent(CEGUI::Window::EventMoved, CEGUI::Event::Subscriber(&CUIEditorView::handleSelectedWindowMoved, this));
}
CEGUI::Rect rect = pWindow->getPixelRect();
setSelectWindowPos(CRect(rect.d_left, rect.d_top, rect.getWidth(), rect.getHeight()));
m_ptMouseMovePos = CPoint(0,0);
}
m_pSelectedWindow = pWindow;
updateCurrentWindowStatusText();
if (addEvent)
{
g_DataPool.OnSelectWindowChanged(pOldSel,pWindow);
}
}
else if (name.length() == 0)
{
if (addEvent)
{
g_DataPool.OnSelectWindowChanged(m_pSelectedWindow,NULL);
}
m_nSelectWindowName = "";
setSelectWindowPos(CRect(), true);
m_pSelectedWindow = NULL;
}
}
catch(CEGUI::UnknownObjectException& e)
{
}
}
示例9: OnPropertyChange
void CDataPool::OnPropertyChange(const CString &szName, const CString& szValue, CEGUI::Window* pSpecialWindow/* = NULL*/)
{
try
{
CEGUI::Window* pWin = pSpecialWindow ? pSpecialWindow : m_pCurrentSelectWindow;
if (pWin)
{
//需要转化成utf8
if(szName == "Text" || szName == "Tooltip" || szName == "Name")
{
if (szName == "Name")
{
CString szPath = GetParentTreePath(pWin);
if (szPath.IsEmpty())
{
szPath = pWin->getName().c_str();
}
g_leftTreeWindow->onRenameSelectWindow(szValue,pWin->getName().c_str(), szPath);
pWin->setName((CEGUI::utf8*)mbcs_to_utf8(szValue.GetString()));
g_pEditorView->onRenameSelectedWindow(szValue,pWin);
}
else
{
pWin->setProperty(szName.GetString(), (CEGUI::utf8*)mbcs_to_utf8(szValue.GetString()));
}
}
else
{
pWin->setProperty(szName.GetString(), szValue.GetString());
}
}
}
catch (CEGUI::Exception& e)
{
MessageBox(AfxGetMainWnd()->GetSafeHwnd(), e.what(), "改变属性出错信息", MB_OK);
}
}
示例10: OnCheckboxCheckStateChanged
// event checkBoxCheckedChanged(checkBoxName)
bool OnCheckboxCheckStateChanged(const CEGUI::EventArgs &eventArgs)
{
CEvents * pEvents = g_pClient->GetEvents();
String eventName("checkBoxCheckedChanged");
if(!pEvents->IsEventRegistered(eventName))
return false;
CEGUI::Window * pWindow = static_cast<const CEGUI::WindowEventArgs&>(eventArgs).window;
CSquirrel * pScript = g_pClient->GetClientScriptManager()->GetGUIManager()->GetScript(pWindow);
CSquirrelArguments pArguments;
pArguments.push(pWindow->getName().c_str());
pEvents->Call(eventName, &pArguments, pScript);
return true;
}
示例11: OnMouseLeaves
// event guiMouseLeave(guiName)
bool OnMouseLeaves(const CEGUI::EventArgs &eventArgs)
{
CEvents * pEvents = g_pClient->GetEvents();
String eventName("guiMouseLeave");
if(!pEvents->IsEventRegistered(eventName))
return false;
const CEGUI::MouseEventArgs eArgs = static_cast<const CEGUI::MouseEventArgs&>(eventArgs);
CEGUI::Window * pWindow = eArgs.window;
CSquirrel * pScript = g_pClient->GetClientScriptManager()->GetGUIManager()->GetScript(pWindow);
CSquirrelArguments pArguments;
pArguments.push(pWindow->getName().c_str());
pEvents->Call(eventName, &pArguments, pScript);
return true;
}
示例12: OnButtonClick
// event buttonClick(buttonName, bState)
// TODO: remove it. We have better alternative guiClick (OnClick) for any gui element
bool OnButtonClick(const CEGUI::EventArgs &eventArgs)
{
CEvents * pEvents = g_pClient->GetEvents();
String eventName("buttonClick");
if(!pEvents->IsEventRegistered(eventName))
return false;
CEGUI::Window * pWindow = static_cast<const CEGUI::WindowEventArgs&>(eventArgs).window;
CSquirrel * pScript = g_pClient->GetClientScriptManager()->GetGUIManager()->GetScript(pWindow);
CSquirrelArguments pArguments;
pArguments.push(pWindow->getName().c_str());
pArguments.push(0); // FIXME or what?
pEvents->Call(eventName, &pArguments, pScript);
return true;
}
示例13: OnWindowClose
// event windowClose(windowName)
bool OnWindowClose(const CEGUI::EventArgs &eventArgs)
{
CEvents * pEvents = g_pClient->GetEvents();
String eventName("windowClose");
if(!pEvents->IsEventRegistered(eventName))
return false;
CEGUI::Window * pWindow = static_cast<const CEGUI::WindowEventArgs&>(eventArgs).window;
CSquirrel * pScript = g_pClient->GetClientScriptManager()->GetGUIManager()->GetScript(pWindow);
CSquirrelArguments pArguments;
pArguments.push(pWindow->getName().c_str());
// Event handler must return 1 to close window, otherwise, 0.
CSquirrelArgument pReturn = pEvents->Call(eventName, &pArguments, pScript);
if(pReturn.GetInteger())
pWindow->hide();
return true;
}
示例14: OnPlayerShopSubBuyNum
bool OnPlayerShopSubBuyNum(const CEGUI::EventArgs& e)
{
CEGUI::Window* wnd = WEArgs(e).window;
if(!wnd) return false;
CEGUI::Window* goodsWnd = wnd->getParent();
if (goodsWnd)
{
CGoods* goods = static_cast<CGoods*>(goodsWnd->getUserData());
if (!goods) return false;
PlayerShop::tagGoodsItem* pGoodsItem = GetPlayerShop().FindtagGoods(goods);
if (pGoodsItem!=NULL)
{
char str[32];
// 取得输入框控件名
CEGUI::String name = wnd->getName();
name.assign(name, 0, name.find_last_of("/"));
name += "/BuyNum";
CEGUI::Window* buyNumWnd = GetWndMgr().getWindow(name);
int num = atoi(buyNumWnd->getText().c_str());
if (num<=0)
{
sprintf(str,"%d",0);
wnd->disable();
}
else
sprintf(str,"%d",num--);
buyNumWnd->setText(ToCEGUIString(str));
pGoodsItem->readyTradeNum = num;
}
}
return true;
}
示例15: HandleEnterKey
/***********************************************************
handle send button event
***********************************************************/
bool ChatBox::HandleEnterKey (const CEGUI::EventArgs& e)
{
const CEGUI::KeyEventArgs& we =
static_cast<const CEGUI::KeyEventArgs&>(e);
const CEGUI::WindowEventArgs& wine =
static_cast<const CEGUI::WindowEventArgs&>(e);
if(we.scancode == CEGUI::Key::LeftControl || we.scancode == CEGUI::Key::RightControl)
{
_control_key_on = true;
return true;
}
if(we.scancode == CEGUI::Key::LeftShift || we.scancode == CEGUI::Key::RightShift)
{
_shift_key_on = true;
return true;
}
if(wine.window->getName() == "Chat/edit")
{
if(we.scancode == CEGUI::Key::Return)
{
HandleSend (e);
CEGUI::Editbox * bed = static_cast<CEGUI::Editbox *>
(CEGUI::WindowManager::getSingleton().getWindow("Chat/edit"));
bed->deactivate();
return true;
}
if(we.scancode == CEGUI::Key::ArrowUp)
{
if(_itltext == _lasttexts.end())
_itltext = _lasttexts.begin();
else
{
std::list<std::string>::iterator ittmp = _itltext;
++ittmp;
if(ittmp != _lasttexts.end())
++_itltext;
}
try
{
if(_itltext != _lasttexts.end())
{
CEGUI::WindowManager::getSingleton().getWindow("Chat/edit")->setText(
(const unsigned char *)_itltext->c_str());
}
else
{
CEGUI::WindowManager::getSingleton().getWindow("Chat/edit")->setText("");
}
}
catch(...){}
return true;
}
if(we.scancode == CEGUI::Key::ArrowDown)
{
if(_itltext != _lasttexts.end())
{
if(_itltext != _lasttexts.begin())
--_itltext;
else
_itltext = _lasttexts.end();
}
if(_itltext != _lasttexts.end())
{
CEGUI::WindowManager::getSingleton().getWindow("Chat/edit")->setText(
(const unsigned char *)_itltext->c_str());
}
else
{
CEGUI::WindowManager::getSingleton().getWindow("Chat/edit")->setText("");
}
return true;
}
if(we.scancode == CEGUI::Key::ArrowUp || we.scancode == CEGUI::Key::ArrowDown)
return true;
// paste text
if(we.scancode == CEGUI::Key::V && _control_key_on)
{
CEGUI::Editbox * bed = static_cast<CEGUI::Editbox *>
(CEGUI::WindowManager::getSingleton().getWindow("Chat/edit"));
if(bed->isActive())
//.........这里部分代码省略.........