예제 #1
0
void AppFileExplorer::show()
{
	mOldMouseListener = AppDemo::getSingleton().mMouse->getEventCallback();
	AppDemo::getSingleton().mMouse->setEventCallback(this);
	OgreBites::SelectMenu* diskM = (OgreBites::SelectMenu*)mTrayMgr->getWidget(mExplorerName + "DiskMenu");
 	updateItems(mCurrentFilePath[diskM->getSelectionIndex()]);

	mTrayMgr->showAll();

}
예제 #2
0
bool RenderState::keyPressed(const OIS::KeyEvent &keyEventRef)
{
        OgreFramework* framework = OgreFramework::getSingletonPtr();
        OIS::Keyboard* keyboard =  framework->_keyboard;
        OgreBites::SdkTrayManager* trayMgr = framework->_trayMgr;
        OgreBites::SelectMenu* pMenu = 
                (OgreBites::SelectMenu*)trayMgr->getWidget("DisplayModeSelMenu");

        if(_settingsMode == true)
        {
                if(keyboard->isKeyDown(OIS::KC_S))
                {
                        if(pMenu->getSelectionIndex() + 1 < (int)pMenu->getNumItems())
                                pMenu->selectItem(pMenu->getSelectionIndex() + 1);
                }

                if(keyboard->isKeyDown(OIS::KC_W))
                {
                        if(pMenu->getSelectionIndex() - 1 >= 0)
                                pMenu->selectItem(pMenu->getSelectionIndex() - 1);
                }

                if(keyboard->isKeyDown(OIS::KC_R))
                {
                        steps = 20;
                }
        }

        if(keyboard->isKeyDown(OIS::KC_ESCAPE))
        {
                // pushAppState(findByName("PauseState"));
                exit();
                return true;
        }

        if(keyboard->isKeyDown(OIS::KC_I))
        {
                if(_detailsPanel->getTrayLocation() == OgreBites::TL_NONE)
                {
                        framework->_trayMgr->moveWidgetToTray(_detailsPanel, 
                                                              OgreBites::TL_BOTTOMRIGHT, 
                                                              0);
                        _detailsPanel->show();
                }
                else
                {
                        framework->_trayMgr->removeWidgetFromTray(_detailsPanel);
                        _detailsPanel->hide();
                }
        }

        if(keyboard->isKeyDown(OIS::KC_TAB))
        {
                _settingsMode = !_settingsMode;
                return true;
        }

        if(_settingsMode && keyboard->isKeyDown(OIS::KC_RETURN) ||
           keyboard->isKeyDown(OIS::KC_NUMPADENTER))
        {
        }

        if(!_settingsMode || (_settingsMode && !keyboard->isKeyDown(OIS::KC_O)))
                framework->keyPressed(keyEventRef);

        return true;
}
예제 #3
0
void AppFileExplorer::itemSelected(OgreBites::SelectMenu* selMenu)
{
	OgreBites::SelectMenu* diskM = (OgreBites::SelectMenu*)mTrayMgr->getWidget(mExplorerName + "DiskMenu");
 	if(selMenu->getName() == mExplorerName + "PathMenu")
	{
		if(mAttriVec[selMenu->getSelectionIndex()])
		{
			std::string selItem = selMenu->getSelectedItem();
		
			if(selItem == "..")
			{
				int loc = mCurrentFilePath[diskM->getSelectionIndex()].find_last_of('\\');
				mCurrentFilePath[diskM->getSelectionIndex()] = mCurrentFilePath[diskM->getSelectionIndex()].substr(0,loc);
			}
			else 
			{
				if(mCurrentFilePath[diskM->getSelectionIndex()][mCurrentFilePath[diskM->getSelectionIndex()].length()-1] != '\\' 
					&& mCurrentFilePath[diskM->getSelectionIndex()][mCurrentFilePath[diskM->getSelectionIndex()].length()-1] != '/')
					mCurrentFilePath[diskM->getSelectionIndex()] += "\\";
				mCurrentFilePath[diskM->getSelectionIndex()] += selMenu->getSelectedItem();
			}
			int index = diskM->getSelectionIndex();
			diskM->setItems(mCurrentFilePath);
			diskM->selectItem(index,false);
			updateItems(mCurrentFilePath[diskM->getSelectionIndex()]);
		}
 	}
	if(selMenu->getName() == mExplorerName + "DiskMenu")
	{
		int index = diskM->getSelectionIndex();
		diskM->setItems(mCurrentFilePath);
		diskM->selectItem(index,false);
		updateItems(mCurrentFilePath[diskM->getSelectionIndex()]);
	}
}
예제 #4
0
void AppFileExplorer::buttonHit(OgreBites::Button* button)
{
	OgreBites::SelectMenu* diskM = (OgreBites::SelectMenu*)mTrayMgr->getWidget(mExplorerName + "DiskMenu");
	
	if(button->getCaption() == "ok")
	{
		OgreBites::SelectMenu *selMenu = (OgreBites::SelectMenu*)mTrayMgr->getWidget(mExplorerName + "PathMenu");
		
		std::string selItem = selMenu->getSelectedItem();
		
		int index = selMenu->getSelectionIndex();
		
		if(mAttriVec[index])
		{
			if(selItem == "..")
			{
				int loc = mCurrentFilePath[diskM->getSelectionIndex()].find_last_of('\\');
				mCurrentFilePath[diskM->getSelectionIndex()] = mCurrentFilePath[diskM->getSelectionIndex()].substr(0,loc);
			}
			else 
			{
				if(mCurrentFilePath[diskM->getSelectionIndex()][mCurrentFilePath[diskM->getSelectionIndex()].length()-1] != '\\' 
					&& mCurrentFilePath[diskM->getSelectionIndex()][mCurrentFilePath[diskM->getSelectionIndex()].length()-1] != '/')
					mCurrentFilePath[diskM->getSelectionIndex()] += "\\";
				mCurrentFilePath[diskM->getSelectionIndex()] += selMenu->getSelectedItem();
			}
			int index = diskM->getSelectionIndex();
			diskM->setItems(mCurrentFilePath);
			diskM->selectItem(index,false);
			updateItems(mCurrentFilePath[diskM->getSelectionIndex()]);
 		 	return;
		}
		else 
		{
 			if(mCurrentFilePath[diskM->getSelectionIndex()][mCurrentFilePath[diskM->getSelectionIndex()].length()-1] != '\\' 
				&& mCurrentFilePath[diskM->getSelectionIndex()][mCurrentFilePath[diskM->getSelectionIndex()].length()-1] != '/')
					mCurrentFilePath[diskM->getSelectionIndex()] += "\\";
			if(mExplorerListener != NULL)
				mExplorerListener->notifyFileOpen(mCurrentFilePath[diskM->getSelectionIndex()] + selMenu->getSelectedItem());
  		}
   	}
	else if(button->getCaption() == "cancel")
	{
		mExplorerListener->notifyFileOpen("");
	}
	AppDemo::getSingleton().mMouse->setEventCallback(mOldMouseListener);
	mTrayMgr->hideAll();
 	
}