Example #1
0
bool ScoreState::handleEvent(const sf::Event& evt)
{
    if (evt.type == sf::Event::KeyReleased)
    {
        switch (evt.key.code)
        {
        case sf::Keyboard::Space:
        case sf::Keyboard::Escape:
        case sf::Keyboard::Return:
            closeMenu();
            return false;
        default: break;
        }
    }
    else if (evt.type == sf::Event::JoystickButtonReleased)
    {
        switch (evt.joystickButton.button)
        {
        case 7:
            closeMenu();
            return false;
        default: break;
        }
    }


    //pass remaining events to menu
    const auto& rw = getContext().renderWindow;
    auto mousePos = rw.mapPixelToCoords(sf::Mouse::getPosition(rw));

    m_uiContainer.handleEvent(evt, mousePos);
    m_cursorSprite.setPosition(mousePos);
    return false;
}
Example #2
0
/// returns true if command is processed
bool CRRecentBooksMenu::onCommand( int command, int params )
{
    if ( command==MCMD_SCROLL_FORWARD ) {
        setCurPage( getCurPage()+1 );
        return true;
    }
    if ( command==MCMD_SCROLL_BACK ) {
        setCurPage( getCurPage()-1 );
        return true;
    }
    if ( command>=MCMD_SELECT_1 && command<=MCMD_SELECT_9 ) {
        int index = command - MCMD_SELECT_1 + getTopItem();
        if ( index < 0 || index >= getItems().length() ) {
            closeMenu( 0 );
            return true;
        }
        CRMenuItem * item = getItems()[index];
        int n = item->getId();
        highlightCommandItem( n );
        closeMenu( MCMD_OPEN_RECENT_BOOK, n );
        return true;
    } else if ( command>=MCMD_SELECT_1_LONG && command<=MCMD_SELECT_9_LONG ) {
        int index = command - MCMD_SELECT_1_LONG + getTopItem();
        if ( index >=0 && index < _pageItems ) {
            //TODO: allow removing book from history
            //closeMenu( MCMD_REMOVE_RECENT_BOOK, index );
            removeItem( index );
            setDirty();
            return true;
        }
    }
    closeMenu( 0 );
    return true;
}
Example #3
0
void CRCitesMenu::goToCitePage(int selecteditem)
{
    if (selecteditem >= 0 && selecteditem < _items.length()) {
        CRBookmarkMenuItem *item = static_cast<CRBookmarkMenuItem *>(_items[_selectedItem]);
        if (item->getBookmark() == NULL)
            closeMenu(MCMD_CITE);
        else
            closeMenu( DCMD_GO_PAGE, item->getPage() );
    }
}
Example #4
0
/// returns true if command is processed
bool CRCitesMenu::onCommand( int command, int params )
{
    if ( command>=MCMD_SELECT_1 && command<=MCMD_SELECT_9 ) {
        int index = command - MCMD_SELECT_1 + 1;
        if ( index >=1 && index <= _pageItems ) {
            index += _topItem;
            goToCitePage( index - 1);
            return true;
        }
    } else if (command == MCMD_SELECT) {
        if (_selectedItem >= 0)
            goToCitePage(_selectedItem );
        return true;
    } else if (command == MCMD_SELECT_LONG) {
#ifdef CR_POCKETBOOK
        if (_selectedItem >= 0)
            showContextMenu();
#endif
        return true;
    } else if (command == MCMD_PREV_PAGE) {
        if (_topItem == 0) {
            closeMenu(0);
            return true;
        }
    }
#ifdef CR_POCKETBOOK
    else if (command == DCMD_BOOKMARK_GO_N) {
        goToCitePage( _selectedItem );
        return true;
    } else if (command == PB_CMD_BOOKMARK_REMOVE && _selectedItem >= 0) {
        CRBookmarkMenuItem *item = static_cast<CRBookmarkMenuItem *>(_items[_selectedItem]);
        CRBookmark *bm = item->getBookmark();
        if (bm && _docview->removeBookmark(bm)) {
            item = static_cast<CRBookmarkMenuItem *>(_items.remove(_selectedItem));
            delete item;
            if (_selectedItem >= _items.length()) {
                _selectedItem = _items.length() -1;
                if (_selectedItem < 0) {
                    createDefaultItem();
                    _selectedItem = 0;
                }
            }
            setDirty();
            _pageUpdate = true;
        }
        return true;
    }
#endif
    else if ((DCMD_BUTTON_PRESSED == command || DCMD_BUTTON_PRESSED_LONG == command) &&
        BTN_CLOSE == params) {
        closeMenu( 0 );
        return true;
    }
    return CRMenu::onCommand(command, params);
}
bool GUIConfirmRegistration::OnEvent(const SEvent &event)
{
	if (event.EventType == EET_KEY_INPUT_EVENT) {
		// clang-format off
		if ((event.KeyInput.Key == KEY_ESCAPE ||
				event.KeyInput.Key == KEY_CANCEL) &&
				event.KeyInput.PressedDown) {
			closeMenu(false);
			return true;
		}
		// clang-format on
		if (event.KeyInput.Key == KEY_RETURN && event.KeyInput.PressedDown) {
			acceptInput();
			if (processInput())
				closeMenu(true);
			return true;
		}
	}

	if (event.EventType != EET_GUI_EVENT)
		return Parent ? Parent->OnEvent(event) : false;

	if (event.GUIEvent.EventType == gui::EGET_ELEMENT_FOCUS_LOST && isVisible()) {
		if (!canTakeFocus(event.GUIEvent.Element)) {
			dstream << "GUIConfirmRegistration: Not allowing focus "
				   "change."
				<< std::endl;
			// Returning true disables focus change
			return true;
		}
	} else if (event.GUIEvent.EventType == gui::EGET_BUTTON_CLICKED) {
		switch (event.GUIEvent.Caller->getID()) {
		case ID_confirm:
			acceptInput();
			if (processInput())
				closeMenu(true);
			return true;
		case ID_cancel:
			closeMenu(false);
			return true;
		}
	} else if (event.GUIEvent.EventType == gui::EGET_EDITBOX_ENTER) {
		switch (event.GUIEvent.Caller->getID()) {
		case ID_confirmPassword:
			acceptInput();
			if (processInput())
				closeMenu(true);
			return true;
		}
	}

	return false;
}
Example #6
0
LUserButtonPlugin::LUserButtonPlugin(QWidget *parent, QString id, bool horizontal) : LPPlugin(parent, id, horizontal){
  button = new QToolButton(this);
    button->setAutoRaise(true);
    button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    button->setPopupMode(QToolButton::DelayedPopup); //make sure it runs the update routine first
    connect(button, SIGNAL(clicked()), this, SLOT(openMenu()));
    this->layout()->setContentsMargins(0,0,0,0);
    this->layout()->addWidget(button);
  menu = new QMenu(this);
    menu->setContentsMargins(1,1,1,1);
    connect(menu, SIGNAL(aboutToHide()), this, SIGNAL(MenuClosed()));
  usermenu = new UserWidget(this);
    connect(usermenu, SIGNAL(CloseMenu()), this, SLOT(closeMenu()) );
  mact = new QWidgetAction(this);
    mact->setDefaultWidget(usermenu);
    menu->addAction(mact);
	
  button->setMenu(menu);
  connect(menu, SIGNAL(aboutToHide()), this, SLOT(updateButtonVisuals()) );
  //Setup the global shortcut handling for opening the start menu
  connect(QApplication::instance(), SIGNAL(StartButtonActivated()), this, SLOT(shortcutActivated()) );
  LSession::handle()->registerStartButton(this->type());

  QTimer::singleShot(0,this, SLOT(OrientationChange())); //Update icons/sizes
}
	void Menu::onMouseButtonDown(const EventArgs& args)
	{
		const MouseEventArgs& mea = dynamic_cast<const MouseEventArgs&>(args);

		if(mea.button == MB_Left)
		{
			if(mParentWidget == NULL)
				throw Exception(Exception::ERR_INVALID_STATE,"Menu is not attached to any widget! (Parent is NULL)","Menu::onLeftMouseDown");

			if(mParentWidget->getClass() == "ToolBar")
			{
				if(mMenuPanel->getVisible())
					mDesc->toolBar->closeMenus();
				else
					mDesc->toolBar->openMenu(this);
			}
			else
			{
				if(mMenuPanel->getVisible())
					closeMenu();
				else
				{
					if(mDesc->toolBar != NULL)
						mDesc->toolBar->openMenu(this);
					else if(mDesc->contextMenu != NULL)
						mDesc->contextMenu->openSubMenu(this);
				}
			}
		}
	}
Example #8
0
void stateLoadFunc(int value) {
    printMenuMessage("Loading state...");
    muteSND();
    if (loadState(stateNum) == 0) {
        closeMenu();
        updateScreens();
        printMessage[0] = '\0';
    }
}
Example #9
0
void exitFunc(int value) {
    muteSND();
    if (!autoSavingEnabled && numRamBanks && !gbsMode) {
        printMenuMessage("Saving SRAM...");
        saveGame();
    }
    printMessage[0] = '\0';
    closeMenu();
    selectRom();
}
Example #10
0
void suspendFunc(int value) {
    muteSND();
    if (!autoSavingEnabled) {
        printMenuMessage("Saving SRAM...");
        saveGame();
    }
    printMenuMessage("Saving state...");
    saveState(-1);
    printMessage[0] = '\0';
    closeMenu();
    selectRom();
}
void CreditsMenu::CursorEvent( OguiButtonEvent* eve )
{
	MenuBaseImpl::CursorEvent( eve );
	
	if( eve->eventType == OGUI_EMASK_CLICK )
	{
		switch( eve->triggerButton->GetId() )
		{
		case COMMANDS_CLOSEME:
			closeMenu();
			break;
		};
	}
	
}
Example #12
0
void CursesAction::feedback() {
    if(isMenuOpen())
        closeMenu();
    else
        openMenu();


    CursesMenu* parentMenu = qobject_cast<CursesMenu*>(parent());
    if(parentMenu) {
        parentMenu->showChain();
        if(!isMenuOpen())
            QTimer::singleShot(5, this, SLOT(focus()));
    }

    blinkTimer.start();
    activateTimer.start(300);
}
Example #13
0
MenuWindowManager::MenuWindowManager(int maxWidth, int maxHeight)
	: WindowManagerBase(maxWidth, maxHeight)
	, m_statusBar(0)
	, m_penDownState(PenDownInvalid)
	, m_cornerContainer(0)
	, m_sysMenu(0)
	, m_systemMenuOpened(false)
{
	setObjectName("MenuWindowManager");

	connect(SystemUiController::instance(), SIGNAL(signalPositiveSpaceChanged(const QRect&)), 
			this, SLOT(slotPositiveSpaceChanged(const QRect&)));
	connect(SystemUiController::instance(), SIGNAL(signalHideMenu()), this, SLOT(closeMenu()));
	connect(SystemUiController::instance(), SIGNAL(signalCardWindowMaximized()), this, SLOT(closeMenu()));

	kStatusBarTapMoveTolerance = HostBase::instance()->getInfo().displayHeight;

#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
	grabGesture(Qt::TapGesture);
	grabGesture(Qt::TapAndHoldGesture);
	grabGesture(Qt::PinchGesture);
	grabGesture((Qt::GestureType) SysMgrGestureFlick);
	grabGesture((Qt::GestureType) SysMgrGestureSingleClick);
#else
	grabGesture(Qt::TapGesture);
	grabGesture(WebosTapAndHoldGesture::gestureType());
	grabGesture(Qt::PinchGesture);
    grabGesture(FlickGesture::gestureType());
    grabGesture(SingleClickGesture::gestureType());
#endif

	m_statusBar = new StatusBar(StatusBar::TypeNormal, maxWidth, Settings::LunaSettings()->positiveSpaceTopPadding);
	if(m_statusBar) {
		SystemUiController::instance()->setStatusBar(m_statusBar);
		connect(m_statusBar, SIGNAL(signalSystemMenuStateChanged(bool)), this, SLOT(slotSystemMenuStateChanged(bool)));
	}

	m_sysMenu = new SystemMenu(320, 480, false);
	if(m_sysMenu) {
		m_sysMenu->setParentItem(this);
		connect(m_sysMenu, SIGNAL(signalCloseMenu()), this, SLOT(slotCloseSystemMenu()));
	}
}
Example #14
0
/*---------------------------------------------------------------------*//**
	最上面のノードを閉じる
**//*---------------------------------------------------------------------*/
void Menu::closeTopNode()
{
	if(_depthCur <= 0)
	{
		// メニューを閉じる
		closeMenu();
		_isDone = true;
	}
	else
	{
		// パネルを破棄する
		MenuTreeNode* mtnodeChild = _tnodeCur->object();
		ASSERT(mtnodeChild != 0L);
		ASSERT(mtnodeChild->panelReceptor() != 0L);
		mtnodeChild->panelReceptor()->destroy();
			
		_tnodeCur = _tnodeCur->parent();
		_depthCur--;
	}
}
Example #15
0
LStartButtonPlugin::LStartButtonPlugin(QWidget *parent, QString id, bool horizontal) : LPPlugin(parent, id, horizontal){
  button = new QToolButton(this);
    button->setAutoRaise(true);
    button->setToolButtonStyle(Qt::ToolButtonIconOnly);
    button->setPopupMode(QToolButton::DelayedPopup); //make sure it runs the update routine first
    connect(button, SIGNAL(clicked()), this, SLOT(openMenu()));
    this->layout()->setContentsMargins(0,0,0,0);
    this->layout()->addWidget(button);
  menu = new QMenu(this);
    menu->setContentsMargins(1,1,1,1);
  startmenu = new StartMenu(this);
    connect(startmenu, SIGNAL(CloseMenu()), this, SLOT(closeMenu()) );
  mact = new QWidgetAction(this);
    mact->setDefaultWidget(startmenu);
    menu->addAction(mact);
	
  button->setMenu(menu);
  connect(menu, SIGNAL(aboutToHide()), this, SLOT(updateButtonVisuals()) );
  QTimer::singleShot(0,this, SLOT(OrientationChange())); //Update icons/sizes
}
Example #16
0
void PopupMenu::closeMenu(bool openPreviousMenu)
{
    if(openPreviousMenu)
    {
        if(pOpenPopupMenu.size() > 0)
        {
            PreviousMenu* pm = pOpenPopupMenu.back();
            pOpenPopupMenu.pop_back();
            
            if(pm->pmt == BuInfoMenu)
            {
                BuildingInfoMenu* bim = BuildingInfoMenu::create(pm->b);
                bim->useAsTopmostPopupMenu();
            }
            else if(pm->pmt == SpInfoMenu)
            {
                SpriteInfoMenu* sim = new SpriteInfoMenu(pm->gs);
                sim->useAsTopmostPopupMenu();
            }
            else if(pm->pmt == SePopulationMenu)
            {
                SelectPopulation* sp = SelectPopulation::create(pm->b);
                sp->useAsTopmostPopupMenu();
            }
            else
            {
                closeMenu(openPreviousMenu);
            }
        }
        else
        {
            pOpenPopupMenu.clear();
        }
    }
    else
    {
        pOpenPopupMenu.clear();
    }
    
    this->cleanup();
}
Example #17
0
void MenuWindowManager::mouseReleaseEvent(QGraphicsSceneMouseEvent* event)
{
	if(m_systemMenuOpened) {
		// close the system menu
		closeMenu();
		return;
	}

	Window* targetWin = 0;
	QPointF pos = event->scenePos();
	Event ev;

#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
    if(!event->canceled())
#else
    if(event->isAccepted())
#endif
		ev.type = Event::PenUp;
	else
		ev.type = Event::PenCancel;

	ev.x = pos.x();
	ev.y = pos.y();
	ev.modifiers = Event::modifiersFromQt(event->modifiers());
	ev.setMainFinger(true);
	ev.clickCount = 0;
	ev.time = Time::curSysTimeMs();

	if (m_penDownState == PenDownInMenu && !m_winArray.empty()) {

		targetWin = m_winArray.first();
	}

	m_penDownState = PenDownInvalid;

	if (targetWin) {
		mapCoordToWindow(targetWin, ev.x, ev.y);
		WebAppMgrProxy::instance()->inputEvent(targetWin, &ev);
	}
}
Example #18
0
void GameMenu::onKeyDown(Event::Keyboard* event)
{
    switch (event->keyCode())
    {
        case SDLK_ESCAPE:
        case SDLK_d:
            closeMenu();
            break;
        case SDLK_s:
            doSaveGame();
            break;
        case SDLK_l:
            doLoadGame();
            break;
        case SDLK_p:
            doPreferences();
            break;
        case SDLK_e:
            doExit();
            break;
    }
}
Example #19
0
/*---------------------------------------------------------------------*//**
	破棄
**//*---------------------------------------------------------------------*/
void Menu::destroy()
{
	if(_isShow)
	{
		closeMenu();
	}

	// ツリー削除
	if(_tree != 0L)
	{
		for(TreeIterator<MenuTreeNode> it = _tree->iterator(); it.has(); it.next())
		{
			MenuTreeNode* mtnode = it.object();
			if(mtnode != 0L)	// ルートは NULL
			{
				mtnode->destroy();
			}
		}
		delete _tree;
		_tree = 0L;
	}
}
Example #20
0
LStartButtonPlugin::LStartButtonPlugin(QWidget *parent, QString id, bool horizontal) : LPPlugin(parent, id, horizontal){
  button = new QToolButton(this);
    button->setAutoRaise(true);
    button->setToolButtonStyle(Qt::ToolButtonIconOnly);
    button->setPopupMode(QToolButton::DelayedPopup); //make sure it runs the update routine first
    connect(button, SIGNAL(clicked()), this, SLOT(openMenu()));
    this->layout()->setContentsMargins(0,0,0,0);
    this->layout()->addWidget(button);
  menu = new ResizeMenu(this);
    menu->setContentsMargins(1,1,1,1);
    connect(menu, SIGNAL(aboutToHide()), this, SIGNAL(MenuClosed()));
    connect(menu, SIGNAL(MenuResized(QSize)), this, SLOT(SaveMenuSize(QSize)) );
  startmenu = new StartMenu(this);
    connect(startmenu, SIGNAL(CloseMenu()), this, SLOT(closeMenu()) );
    connect(startmenu, SIGNAL(UpdateQuickLaunch(QStringList)), this, SLOT(updateQuickLaunch(QStringList)));
  menu->setContents(startmenu);
  QSize saved = LSession::handle()->DesktopPluginSettings()->value("panelPlugs/"+this->type()+"/MenuSize", QSize(0,0)).toSize();
  if(!saved.isNull()){ startmenu->setFixedSize(saved); } //re-load the previously saved value
  
  button->setMenu(menu);
  connect(menu, SIGNAL(aboutToHide()), this, SLOT(updateButtonVisuals()) );
  QTimer::singleShot(0,this, SLOT(OrientationChange())); //Update icons/sizes
  QTimer::singleShot(0, startmenu, SLOT(ReLoadQuickLaunch()) );
}
Example #21
0
void returnFunc(int value) {
    closeMenu();
    updateScreens();
}
Example #22
0
void MenuBarButton::toggleMenu()
{
	if(menuOpen)	closeMenu();
	else			openMenu();
}
Example #23
0
void resetFunc(int value) {
    nukeBorder = false;
    closeMenu();
    updateScreens();
    initializeGameboy();
}
Example #24
0
void exitNoSaveFunc(int value) {
    muteSND();
    closeMenu();
    selectRom();
}
Example #25
0
/*---------------------------------------------------------------------*//**
	フレーム制御
**//*---------------------------------------------------------------------*/
void Menu::exec(ExecRes* res, const ExecCtx* ec)
{
	if(!_isShow)	{	return;		}
	
	// 現在のパネルに制御をまわす
	MenuTreeNode* mtnodeCur = _tnodeCur->object();
	ASSERT(mtnodeCur != 0L);
	MenuExecRes resPanel;
	mtnodeCur->panelReceptor()->exec(&resPanel, ec);
	switch(*resPanel.returnValue())
	{
	case MenuExecRes::ON_FUNC:
		{
			MenuTreeNode* mtnodeTrg = (*resPanel.targetNode())->object();
			TreeNode<MenuTreeNode>* tnodeChild = (*resPanel.targetNode())->child();
			ASSERT(tnodeChild != 0L);
			MenuTreeNode* mtnodeChild = tnodeChild->object();
			ASSERT(mtnodeChild != 0L);
			
			// 関数コール
			if(!mtnodeTrg->isDisabled())	// ただし、無効化中以外
			{
				if(_functblRef->onCall(this, ec, mtnodeChild, mtnodeTrg, _objCreateParamRef, _objShowParamRef))
				{
					// 反応があった場合
					if(mtnodeChild->isMenuClose())
					{
						// メニューを閉じる
						closeMenu();
						if(res != 0L)	{	res->setDone();	}
						_isDone = true;
					}
				}
			}
		}
		break;
	case MenuExecRes::ON_DIVE:
		{
			// 下の階層に潜る
			ASSERT(*resPanel.targetNode() != 0L);
			MenuTreeNode* mtnodeTrg = (*resPanel.targetNode())->object();
			if(!mtnodeTrg->isDisabled())	// ただし、無効化中以外
			{
				_tnodeCur = *resPanel.targetNode();
				_depthCur++;

				// パネルを作成する
				MenuTreeNode* mtnodeChild = _tnodeCur->object();
				ASSERT(mtnodeChild != 0L);
				PanelBase* panel = _pnlfctryRef->makePanel(_tnodeCur, _depthCur, false, _objShowParamRef, _objCreateParamRef);
				ASSERT(panel != 0L);
				mtnodeChild->panelReceptor()->create(panel);
			}
		}
		break;
	case MenuExecRes::ON_CANCEL:
		// 階層を上がる
		closeTopNode();
		if(_isDone)	// 最上位ノードだった場合
		{
			if(res != 0L)	{	res->setDone();	}
		}
		break;
	case MenuExecRes::ON_CSTMCHLD:
		{
			// 下の階層に潜る
			ASSERT(*resPanel.targetNode() != 0L);
			_tnodeCur = *resPanel.targetNode();
			_depthCur++;

			// 子の付け替え
			MenuTreeNode* mtnodeChild = _tnodeCur->object();
			VcString name = *mtnodeChild->getName();
			mtnodeChild->destroy();									// 一度破棄
			mtnodeChild->create(&name, false, false, false, 0, 0);	// 再生成

			// パネル作成
			PanelBase* panel = _pnlfctryRef->makePanel(_tnodeCur, _depthCur, true, _objShowParamRef, _objCreateParamRef);
			ASSERT(panel != 0L);
			mtnodeChild->panelReceptor()->create(panel);
		}
		break;
	case MenuExecRes::ON_CLICKOUTSIDE:
		{
			_functblRef->onClickOutside(this, ec, _objCreateParamRef, _objShowParamRef);
		}
		break;
	}
}
Example #26
0
/// returns true if command is processed
bool CRRecentBooksMenu::onCommand( int command, int params )
{
    if ( command==MCMD_SCROLL_FORWARD ) {
        setCurPage( getCurPage()+1 );
        return true;
    }
    if ( command==MCMD_SCROLL_BACK ) {
        setCurPage( getCurPage()-1 );
        return true;
    }
    if ( command>=MCMD_SELECT_1 && command<=MCMD_SELECT_9 ) {
        int index = command - MCMD_SELECT_1 + getTopItem();
        if ( index < 0 || index >= getItems().length() ) {
            closeMenu( 0 );
            return true;
        }
        CRMenuItem * item = getItems()[index];
        int n = item->getId();
        highlightCommandItem( n );
        closeMenu( MCMD_OPEN_RECENT_BOOK, n );
        return true;
    } else if ( command>=MCMD_SELECT_1_LONG && command<=MCMD_SELECT_9_LONG ) {
        int index = command - MCMD_SELECT_1_LONG + getTopItem();
        if ( index >=0 && index < _pageItems ) {
            //TODO: allow removing book from history
            //closeMenu( MCMD_REMOVE_RECENT_BOOK, index );
            removeItem( index );
            setDirty();
            return true;
        }
    } else if (command == MCMD_SELECT) {
		if (_selectedItem >= 0) {
			CRMenuItem * item = getItems()[_selectedItem];
			int n = item->getId();
			closeMenu( MCMD_OPEN_RECENT_BOOK, n );
			return true;
		}
		closeMenu( 0 );
		return true;
	} else if (command == MCMD_SELECT_LONG) {
		if (_selectedItem >= 0) {
#ifdef CR_POCKETBOOK
			showContextMenu();
#else
            removeItem( _selectedItem );
            setDirty();			
#endif
            return true;
		}
	} else if (command == MCMD_PREV_PAGE) {
		if (_topItem == 0) {
			closeMenu(0);
			return true;
		}
	}
#ifdef CR_POCKETBOOK
	else if (command == MCMD_OPEN_RECENT_BOOK) {
		closeMenu( command, _selectedItem + 1 );
		return true;
	} else if (command == PB_CMD_BOOKMARK_REMOVE && _selectedItem >= 0) {
		removeItem( _selectedItem );
		setDirty();
		return true;
	}
#endif
	return CRMenu::onCommand(command, params);
    //closeMenu( 0 );
    //return true;
}
	void ContextMenu::hide()
	{
		closeMenu();
	}
Example #28
0
void advanceFrameFunc(int value) {
    advanceFrame = true;
    closeMenu();
    updateScreens();
}
Example #29
0
 ~Button() { closeMenu({}); }
Example #30
0
// Called each vblank while the menu is on
void updateMenu() {
    if (subMenuUpdateFunc != 0) {
        subMenuUpdateFunc();
        return;
    }

    bool redraw = false;
    // Get input
    if (keyPressedAutoRepeat(KEY_UP)) {
        option--;
        if (option < -1)
            option = menuList[menu].numOptions-1;
        redraw = true;
    }
    else if (keyPressedAutoRepeat(KEY_DOWN)) {
        option++;
        if (option >= menuList[menu].numOptions)
            option = -1;
        redraw = true;
    }
    else if (keyPressedAutoRepeat(KEY_LEFT)) {
        if (option == -1) {
            menu--;
            if (menu < 0)
                menu = numMenus-1;
        }
        else if (menuList[menu].options[option].numValues != 0 && menuList[menu].options[option].enabled) {
            int selection = menuList[menu].options[option].selection-1;
            if (selection < 0)
                selection = menuList[menu].options[option].numValues-1;
            menuList[menu].options[option].selection = selection;
            menuList[menu].options[option].function(selection);
        }
        redraw = true;
    }
    else if (keyPressedAutoRepeat(KEY_RIGHT)) {
        if (option == -1) {
            menu++;
            if (menu >= numMenus)
                menu = 0;
        }
        else if (menuList[menu].options[option].numValues != 0 && menuList[menu].options[option].enabled) {
            int selection = menuList[menu].options[option].selection+1;
            if (selection >= menuList[menu].options[option].numValues)
                selection = 0;
            menuList[menu].options[option].selection = selection;
            menuList[menu].options[option].function(selection);
        }
        redraw = true;
    }
    else if (keyJustPressed(KEY_A)) {
        forceReleaseKey(KEY_A);
        if (option >= 0 && menuList[menu].options[option].numValues == 0 && menuList[menu].options[option].enabled) {
            menuList[menu].options[option].function(menuList[menu].options[option].selection);
        }
        redraw = true;
    }
    else if (keyJustPressed(KEY_B)) {
        forceReleaseKey(KEY_B);
        closeMenu();
        updateScreens();
    }
    else if (keyJustPressed(KEY_L)) {
        menu--;
        if (menu < 0)
            menu = numMenus-1;
        if (option >= menuList[menu].numOptions)
            option = menuList[menu].numOptions-1;
        redraw = true;
    }
    else if (keyJustPressed(KEY_R)) {
        menu++;
        if (menu >= numMenus)
            menu = 0;
        if (option >= menuList[menu].numOptions)
            option = menuList[menu].numOptions-1;
        redraw = true;
    }
    if (redraw && subMenuUpdateFunc == 0 &&
            isMenuOn()) // The menu may have been closed by an option
        doAtVBlank(redrawMenu);
}