Esempio n. 1
0
bool PopupMenu::handleKeyPress(int key) {
	if (_activeSubmenu) {
		_activeSubmenu->handleKeyPress(key);
		return true;
	} else if (key == Qt::Key_Escape) {
		hideMenu(_parent ? true : false);
		return true;
	} else if (key == (rtl() ? Qt::Key_Right : Qt::Key_Left)) {
		if (_parent) {
			hideMenu(true);
			return true;
		}
	}
	return false;
}
Esempio n. 2
0
/////////////////////////////////////////////////////////////////////////////
// update main menu
/////////////////////////////////////////////////////////////////////////////
void CUndoDialog::OnOK()
{
	hideMenu();

	//normal handling
	CHelpDialog::OnOK();
}
Esempio n. 3
0
void PopupMenu::handleMouseRelease(QPoint globalPosition) {
	if (_parent) {
		_parent->forwardMouseRelease(globalPosition);
	} else {
		hideMenu();
	}
}
Esempio n. 4
0
	/* PROTECTED MEMBER FUNCTIONS */
	void VisualWavesControl::addToggleButton_ToggleChanged(bool toggled)
	{
		assert(visual != NULL);

		if(toggled)
		{
			std::vector<std::string> menuItems;
			const std::map<std::string, Parameter *> parameters = visual->getParameters();
		
			for(std::map<std::string, Parameter *>::const_iterator it = parameters.cbegin(); it != parameters.cend(); it++)
			{
				Parameter *p = (*it).second;
				assert(p != NULL);

				if(!p->isDisabled())
				{
					menuItems.push_back(p->getName());
				}
			}

			showMenu(menuItems);
		}
		else
		{
			hideMenu();
		}
	}
Esempio n. 5
0
	void VisualWavesControl::menu_ItemSelected(std::string item)
	{
		assert(visual != NULL);

		hideMenu();
		addTrack(visual->getParameter(item));
	}
Esempio n. 6
0
void PopupMenu::keyPressEvent(QKeyEvent *e) {
    if (_childMenuIndex >= 0) {
        return _menus.at(_childMenuIndex)->keyPressEvent(e);
    }

    if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return) {
        itemPressed(PressSourceKeyboard);
        return;
    } else if (e->key() == Qt::Key_Escape) {
        hideMenu(_parent ? true : false);
        return;
    }
    if (e->key() == (rtl() ? Qt::Key_Left : Qt::Key_Right)) {
        if (_selected >= 0 && _menus.at(_selected)) {
            itemPressed(PressSourceKeyboard);
            return;
        } else if (_selected < 0 && _parent && !_actions.isEmpty()) {
            _mouseSelection = false;
            setSelected(0);
        }
    } else if (e->key() == (rtl() ? Qt::Key_Right : Qt::Key_Left)) {
        if (_parent) {
            hideMenu(true);
        }
    }
    if ((e->key() != Qt::Key_Up && e->key() != Qt::Key_Down) || _actions.size() < 1) return;

    int32 delta = (e->key() == Qt::Key_Down ? 1 : -1), start = _selected;
    if (start < 0 || start >= _actions.size()) {
        start = (delta > 0) ? (_actions.size() - 1) : 0;
    }
    int32 newSelected = start;
    do {
        newSelected += delta;
        if (newSelected < 0) {
            newSelected += _actions.size();
        } else if (newSelected >= _actions.size()) {
            newSelected -= _actions.size();
        }
    } while (newSelected != start && (!_actions.at(newSelected)->isEnabled() || _actions.at(newSelected)->isSeparator()));

    if (_actions.at(newSelected)->isEnabled() && !_actions.at(newSelected)->isSeparator()) {
        _mouseSelection = false;
        setSelected(newSelected);
    }
}
Esempio n. 7
0
void MainWindow::updateHideMenu(){
    if(hideMenu())
        ui.menuBar->hide();

    else
        ui.menuBar->show();

    updateResolution();
}
Esempio n. 8
0
void PopupMenuEditorItem::selfDestruct()
{
    hideMenu();
    int i = m->find( s );
    if ( i != -1 && i < m->count() )
	m->remove( i ); // remove this item
    a = 0; // the selfDestruct call was caused by the deletion of the action
    delete this;
}
Esempio n. 9
0
void TDDSubMenu::toggleMenu()
{
	log("TDDSubMenu.toggleMenu:");
	if(mShow) {
		hideMenu();
	} else {
		showMenu();
	}
}
Esempio n. 10
0
void 
Menu::setMenuVisible(bool b)
{
	if (m_bMenuVisible == b)
	{
		return;
	}
	m_bMenuVisible = b;
	m_bMenuVisible?showMenu():hideMenu();
}
Esempio n. 11
0
void
MenuItem::leaveEvent( QEvent* e )
{
	m_mouseOver = false;
	QButton::leaveEvent( e );
	repaint();
	
	if( m_sub )
		QTimer::singleShot( 400, this, SLOT( hideMenu() ) );
}
Esempio n. 12
0
CMenu::CMenu(CommandsDef *def)
        : KPopupMenu(NULL)
{
    m_def = def;
    m_param = NULL;
	m_bInit = false;
    setCheckable(true);
    connect(this, SIGNAL(aboutToShow()), this, SLOT(showMenu()));
    connect(this, SIGNAL(aboutToHide()), this, SLOT(hideMenu()));
    connect(this, SIGNAL(activated(int)), this, SLOT(menuActivated(int)));
}
Esempio n. 13
0
void MainWindow::updateResolution(){
    if(autoScale()){
        setWidth(ui.centralWidget->width());
        setHeight(ui.centralWidget->height());

        if(orientation() == eLandscapeLeft || orientation() == eLandscapeRight){
            setWidth(ui.centralWidget->height());
            setHeight(ui.centralWidget->width());

            if(hideMenu())
                setWidth(width() + ui.menuBar->height());

        }else if(hideMenu())
            setHeight(height() + ui.menuBar->height());
    }

    float canvasScaleFactor = 1;
    float widgetScaleFactor = 1;

    if (deviceScale() != 0) {
        const float hundredPercentScale = 100;
        canvasScaleFactor = hundredPercentScale / deviceScale();
        widgetScaleFactor = hundredPercentScale / scale();
    }

    ui.glCanvas->setScale(canvasScaleFactor);

    switch (orientation()){
        case ePortrait:
        case ePortraitUpsideDown:
            ui.glCanvas->setFixedSize(width() / widgetScaleFactor, height() / widgetScaleFactor);
            break;

        case eLandscapeLeft:
        case eLandscapeRight:
            ui.glCanvas->setFixedSize(height() / widgetScaleFactor, width() / widgetScaleFactor);
            break;
    }

    ui.glCanvas->setResolution(width(), height());
}
Esempio n. 14
0
void PopupMenu::mousePressEvent(QMouseEvent *e) {
    mouseMoveEvent(e);
    if (_inner.contains(mapFromGlobal(e->globalPos()))) {
        itemPressed(PressSourceMouse);
        return;
    }
    if (_parent) {
        _parent->mousePressEvent(e);
    } else {
        hideMenu();
    }
}
Esempio n. 15
0
void CCActionTest::testMove(Object *sender)
{
	log("testMove");
	
	LabelTTF *label = createTestLabel("Hello");

	MoveTo *move = MoveTo::create(3, Point(300, 300));
	
	label->runAction(move);
	
	hideMenu();
}
Esempio n. 16
0
void PopupMenu::handleTriggered(QAction *action, int actionTop, TriggeredSource source) {
	if (!popupSubmenuFromAction(action, actionTop, source)) {
		_triggering = true;
		hideMenu();
		emit action->trigger();
		_triggering = false;
		if (_deleteLater) {
			_deleteLater = false;
			deleteLater();
		}
	}
}
	void CMazeGameEngine::setupWorld()
	{
		isWinScreenShowing = false;
		_endGameImg->setVisible(false);
		_sceneManager->clear();
		_videoDriver->setFog(irr::video::SColor(0, 30, 20, 10), irr::video::EFT_FOG_LINEAR, 3, 10, .03f, true, false);
		buildMaze();
		addFinishPoint();
		loadAdditionalResources();
		setupCamera();
		setupPlayerViews();
		hideMenu();
		startOrientationScene();
	}
Esempio n. 18
0
void MainWindow::resizeWindow(int width, int height){
    setWidth(width);
    setHeight(height);
    if(orientation() == eLandscapeLeft || orientation() == eLandscapeRight){
        int temp = width;
        width = height;
        height = temp;
    }
    if(!hideMenu())
        height = height + ui.menuBar->height();

    resize(width, height);
    updateResolution();
}
Esempio n. 19
0
	bool GUIManager::loadClassic(const CEGUI::EventArgs &e)
	{	
		if(ifstart){
			hideMenu();
			ifstart = true;
			if(!ifLoadedClassic){
				mWorld->loadScene();
				ifLoadedClassic = true;
				mWorld->showShadows();
			}else{
				load_classic->setText("Already loaded");
			}
			
		}
		
		return true;
	}
Esempio n. 20
0
StandaloneMenu::StandaloneMenu (QWidget *parent)
  :QWidget(parent),
   menuView (0),
   mainButton (0),
   menuFile ("/etc/xdg/menus/razor-applications.menu")
{
  setObjectName ("StandaloneMenu");
  setWindowIcon (QIcon(":/geuzenmenu.png"));
  mainButton = new QPushButton (QIcon(":/geuzenmenu.png"),
                                tr("Applications"),
                                this);
  mainButton->resize (180,48);
  powerManager = new PowerManager(this);
  buildMenu ();
  connect (mainButton,SIGNAL (clicked()), this, SLOT(showMenu()));
  QTimer::singleShot (2, this, SLOT(hideMenu ()));
}
Esempio n. 21
0
	bool GUIManager::newGame(const CEGUI::EventArgs &e)
	{
		hideMenu();
		ifstart = true;
		
		if(!ifNewGame){
			mWorld->SetupDefaultGame();
			ifNewGame = true;
		}else{
			mWorld->clearAll();
			mWorld->createTanks();
			range = 2;
			level = 1;
			mCollisionManager->playerScore = 0;
		}
		
		return true;
	}
Esempio n. 22
0
	bool
	GUIManager::keyPressed(const OIS::KeyEvent& evt){	
		//if(godMode == true){
		//	mTankWarCamera->mCameraMan->injectKeyDown(evt);
		//}

		CEGUI::System &sys = CEGUI::System::getSingleton();
		sys.injectKeyDown(evt.key);
		sys.injectChar(evt.text);



		if(evt.key == OIS::KC_ESCAPE){
			if(!pause)
				showMenu(); //true now
			else{
				if(ifstart)
					hideMenu(); //false now
			}
				
		}

		//switch mode
		if(evt.key == (OIS::KC_H)){
			if(tankFactory->playerTank->mode == TANK_ATTACK){
				tankFactory->playerTank->switchMode();
				attackMode->setDimensions(0.04, 0.04);
				defenceMode->setDimensions(0.08, 0.08);
				
			}else{
				tankFactory->playerTank->switchMode();
				attackMode->setDimensions(0.08, 0.08);
				defenceMode->setDimensions(0.04, 0.04);
			}

					
		}
		
		return true;
	}
Esempio n. 23
0
void PopupMenu::itemPressed(PressSource source) {
    if (source == PressSourceMouse && !_mouseSelection) {
        return;
    }
    if (_selected >= 0 && _selected < _actions.size() && _actions[_selected]->isEnabled()) {
        if (_menus.at(_selected)) {
            if (_childMenuIndex == _selected) {
                _menus.at(_childMenuIndex)->hideMenu(true);
            } else {
                popupChildMenu(source);
            }
        } else {
            hideMenu();
            _triggering = true;
            emit _actions[_selected]->trigger();
            _triggering = false;
            if (_deleteLater) {
                _deleteLater = false;
                deleteLater();
            }
        }
    }
}
Esempio n. 24
0
void PopupMenu::focusOutEvent(QFocusEvent *e) {
    hideMenu();
}
Esempio n. 25
0
BookmarkToolBar::BookmarkToolBar(QWidget *parent)
    : KToolBar(parent, false, false)
    , m_currentMenu(0)
    , m_dragAction(0)
    , m_dropAction(0)
    , m_checkedAction(0)
    , m_filled(false)
{
    setContextMenuPolicy(Qt::CustomContextMenu);

    connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenu(QPoint)));
    connect(BookmarkManager::self()->manager(), SIGNAL(changed(QString,QString)), this, SLOT(hideMenu()));

    setAcceptDrops(true);
    installEventFilter(this);
    setShortcutEnabled(false);

    if (isVisible())
    {
        BookmarkManager::self()->fillBookmarkBar(this);
        m_filled = true;
    }
}
Esempio n. 26
0
BookmarkToolBar::BookmarkToolBar(KToolBar *toolBar, QObject *parent)
    : QObject(parent)
    , m_toolBar(toolBar)
    , m_currentMenu(0)
    , m_dragAction(0)
    , m_dropAction(0)
    , m_checkedAction(0)
    , m_filled(false)
{
    toolBar->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(toolBar, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenu(QPoint)));
    connect(rApp->bookmarkManager()->manager(), SIGNAL(changed(QString, QString)), this, SLOT(hideMenu()));
    toolBar->setAcceptDrops(true);
    toolBar->installEventFilter(this);
    toolBar->setShortcutEnabled(false);

    if (toolBar->isVisible())
    {
        rApp->bookmarkManager()->fillBookmarkBar(this);
        m_filled = true;
    }
}
Esempio n. 27
0
void ContextMenuGraphicsComponent::hideSelectMenu() {
    closeTimer_.stop();
    hideMenu();
}