当前位置: 首页>>代码示例>>C++>>正文


C++ KeyEvent::getKey方法代码示例

本文整理汇总了C++中KeyEvent::getKey方法的典型用法代码示例。如果您正苦于以下问题:C++ KeyEvent::getKey方法的具体用法?C++ KeyEvent::getKey怎么用?C++ KeyEvent::getKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KeyEvent的用法示例。


在下文中一共展示了KeyEvent::getKey方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: keyDown

	void RadioButton::keyDown( KeyEvent &keyEvent )
	{
		
		if(keyEvent.getKey() == KEY_SPACE || keyEvent.getKey() == KEY_ENTER)
		{
			isDoingKeyAction = true;
			changeRadioButtonState(CLICKED);
			keyEvent.consume();
		}
	}
开发者ID:jmasterx,项目名称:Agui,代码行数:10,代码来源:RadioButton.cpp

示例2: keyUp

	void RadioButton::keyUp( KeyEvent &keyEvent )
	{
		if(!isDoingKeyAction)
		{
			return;
		}
		isDoingKeyAction = false;
		if(keyEvent.getKey() == KEY_SPACE || keyEvent.getKey() == KEY_ENTER)
		{
			dispatchActionEvent(ActionEvent(
				this));
			modifyRadioButtonState();
			nextCheckState();
			keyEvent.consume();
		}
	}
开发者ID:jmasterx,项目名称:Agui,代码行数:16,代码来源:RadioButton.cpp

示例3: keyPressed

    void TextField::keyPressed(KeyEvent& keyEvent)
    {
        Key key = keyEvent.getKey();

        if (key.getValue() == Key::Left)
            mText->setCaretPosition(mText->getCaretPosition() - 1);

        else if (key.getValue() == Key::Right)
            mText->setCaretPosition(mText->getCaretPosition() + 1);

        else if (key.getValue() == Key::Delete && mEditable)
            mText->remove(1);

        else if (key.getValue() == Key::Backspace && mEditable)
            mText->remove(-1);

        else if (key.getValue() == Key::Enter)
            distributeActionEvent();

        else if (key.getValue() == Key::Home)
            mText->setCaretColumn(0);

        else if (key.getValue() == Key::End)
            mText->setCaretColumn(mText->getNumberOfCharacters(0));

        else if (key.isCharacter()
                 && key.getValue() != Key::Tab
                 && mEditable)
            mText->insert(key.getValue());

        if (key.getValue() != Key::Tab)
            keyEvent.consume();

        fixScroll();
    }
开发者ID:sanyaade-g2g-repos,项目名称:guichan,代码行数:35,代码来源:textfield.cpp

示例4: keyPressed

 virtual void keyPressed(const KeyEvent& e)
 {
     if(e.getKey() == KeyEvent::KEY_Q && e.getModifiers() & KeyEvent::KEY_MODIFIER_CONTROL)
     {
          TutorialWindowEventProducer->closeWindow();
     }
 }
开发者ID:Himbeertoni,项目名称:OpenSGToolbox,代码行数:7,代码来源:TemplateMain.cpp

示例5: keyPressed

    void Slider::keyPressed(KeyEvent& keyEvent)
    {
        Key key = keyEvent.getKey();

        if (getOrientation() == HORIZONTAL)
        {
            if (key.getValue() == Key::RIGHT)
            {
                setValue(getValue() + getStepLength());
                distributeActionEvent();
                keyEvent.consume();
            }
            else if (key.getValue() == Key::LEFT)
            {
                setValue(getValue() - getStepLength());
                distributeActionEvent();
                keyEvent.consume();
            }            
        }
        else
        {
            if (key.getValue() == Key::UP)
            {
                setValue(getValue() + getStepLength());
                distributeActionEvent();
                keyEvent.consume();
            }
            else if (key.getValue() == Key::DOWN)
            {
                setValue(getValue() - getStepLength());
                distributeActionEvent();
                keyEvent.consume();
            }
        }
    }
开发者ID:hoodwolf,项目名称:Infraelly,代码行数:35,代码来源:slider.cpp

示例6: onKeyPressed

bool Dan::onKeyPressed(const KeyEvent & evt)
{



	if(evt.getKey() == Orz::KC_B)
	{
		LockInterface * lock = _dataServer->queryInterface<LockInterface>();
		DataServerInterface * data = _dataServer->queryInterface<DataServerInterface>();
		
		if(check())
		{


			CodingFormatInterface * format = _coding->queryInterface<CodingFormatInterface>();

		

			format->clear();
			format->setCost(data->getCost());
			format->setEarn(data->getEarn());
			format->setPass(data->getSeconds()/ 3600);

			{
				if(!data->loadCodingData())
				{
					data->reset();
				}

				CodingFormatInterface * lockData = _dataServer->queryInterface<CodingFormatInterface>();
				unsigned int times = lockData->getLockTimes();
				format->setTimes(times);
				lockData->setLockTimes(times +1);
				format->setID(lockData->getLockID());
				data->saveCodingData();

			}
			
			std::string str = format->encode10(60 ,20);
			
			std::wstring wstr;
			for(int i=0;i<20; i++)
			{
				if(i%5 == 0 && i != 0)
					wstr.push_back(',');
				wstr.push_back(str.at(i));
			}
			lock->setLockCode2(str);
				
			data->save();
			warning(L"报账码生成,成功!");
			setText("Dan/Bg/Text/BzmText", wstr);
		}/*else
		{
			setText("Dan/Bg/Text/BzmText", L"?????,?????,?????,?????");
		}*/

	}
	return false;
}
开发者ID:dbabox,项目名称:aomi,代码行数:60,代码来源:Dan.cpp

示例7: onKeyPressed

bool OgreNodeDebuggerComponent::onKeyPressed(const KeyEvent & evt)
{

	KeyMap::iterator it = _keyMap.find(evt.getKey());
	if(it != _keyMap.end())
	{
		it->second.first = true;
	}

	if(KC_P == evt.getKey())
		Print(_activeNode);
	if(Orz::KC_TAB == evt.getKey())
	{
		next();
	}
	return false;
}
开发者ID:dbabox,项目名称:aomi,代码行数:17,代码来源:OgreNodeDebuggerComponent.cpp

示例8: keyUp

	void Button::keyUp( KeyEvent &keyEvent )
	{
		if(!isDoingKeyAction)
		{
			return;
		}
		isDoingKeyAction = false;
		if(keyEvent.getKey() == KEY_SPACE || keyEvent.getKey() == KEY_ENTER)
		{
			dispatchActionEvent(ActionEvent(
				this));
			handleToggleClick();
			modifyButtonState();

			keyEvent.consume();
		}
	}
开发者ID:arvidsson,项目名称:Agui,代码行数:17,代码来源:Button.cpp

示例9: keyPressed

    void TextField::keyPressed(KeyEvent& keyEvent)
    {
        Key key = keyEvent.getKey();

        if (key.getValue() == Key::Left && mCaretPosition > 0)
        {
            --mCaretPosition;
        }

        else if (key.getValue() == Key::Right && mCaretPosition < mText.size())
        {
            ++mCaretPosition;
        }

        else if (key.getValue() == Key::Delete && mCaretPosition < mText.size()
                 && mEditable)
        {
            mText.erase(mCaretPosition, 1);
        }

        else if (key.getValue() == Key::Backspace && mCaretPosition > 0
                 && mEditable)
        {
            mText.erase(mCaretPosition - 1, 1);
            --mCaretPosition;
        }

        else if (key.getValue() == Key::Enter)
        {
            distributeActionEvent();
        }

        else if (key.getValue() == Key::Home)
        {
            mCaretPosition = 0;
        }

        else if (key.getValue() == Key::End)
        {
            mCaretPosition = mText.size();
        }

        else if (key.isCharacter()
                 && key.getValue() != Key::Tab
                 && mEditable)
        {
            mText.insert(mCaretPosition, std::string(1,(char)key.getValue()));
            ++mCaretPosition;
        }

        if (key.getValue() != Key::Tab)
        {
            keyEvent.consume();
        }

        fixScroll();
    }
开发者ID:olofn,项目名称:db_public,代码行数:57,代码来源:textfield.cpp

示例10:

bool Dan2::onKeyReleased(const KeyEvent & evt)
{
	int old = _n;
	if(evt.getKey() == Orz::KC_UP)
	{
		
		if(_n > 0)
			--_n;
	}
	if(evt.getKey() == Orz::KC_DOWN)
	{
		if(_n < 8)
			++_n;
	}
	int now =  _n;
	redo(old, now);
	return false;
}
开发者ID:dbabox,项目名称:aomi,代码行数:18,代码来源:Dan2.cpp

示例11: keyPressed

	void ClickLabel::keyPressed(KeyEvent& keyEvent)
	{
		Key key = keyEvent.getKey();

		if (key.getValue() == Key::ENTER || key.getValue() == Key::SPACE) {
			mKeyPressed = true;
			keyEvent.consume();
		}
	}
开发者ID:karottenreibe,项目名称:FIFE,代码行数:9,代码来源:clicklabel.cpp

示例12: keyDown

	void TextField::keyDown( KeyEvent &keyEvent )
	{
		handleKeyboard(keyEvent);
		if(keyEvent.getKey() == KEY_ENTER)
		{
			dispatchActionEvent(ActionEvent(this));
		}
			keyEvent.consume();
	}
开发者ID:arvidsson,项目名称:Agui,代码行数:9,代码来源:TextField.cpp

示例13: onKeyReleased

bool OgreNodeDebuggerComponent::onKeyReleased(const KeyEvent & evt)
{

	KeyMap::iterator it = _keyMap.find(evt.getKey());
	if(it != _keyMap.end())
	{
		it->second.first = false;
	}
	return false;
}
开发者ID:dbabox,项目名称:aomi,代码行数:10,代码来源:OgreNodeDebuggerComponent.cpp

示例14: keyReleased

	void ClickLabel::keyReleased(KeyEvent& keyEvent)
	{
		Key key = keyEvent.getKey();

		if ((key.getValue() == Key::ENTER || key.getValue() == Key::SPACE) && mKeyPressed) {
			mKeyPressed = false;
			distributeActionEvent();
			keyEvent.consume();
		}
	}
开发者ID:karottenreibe,项目名称:FIFE,代码行数:10,代码来源:clicklabel.cpp

示例15: keyPressed

    void TextField::keyPressed(KeyEvent& keyEvent)
    {
        Key key = keyEvent.getKey();

        if (key.getValue() == Key::LEFT && mCaretPosition > 0)
        {
            --mCaretPosition;
        }

        else if (key.getValue() == Key::RIGHT && mCaretPosition < mText.size())
        {
            ++mCaretPosition;
        }

        else if (key.getValue() == Key::_DELETE && mCaretPosition < mText.size())
        {
            mText.erase(mCaretPosition, 1);
        }

        else if (key.getValue() == Key::BACKSPACE && mCaretPosition > 0)
        {
            mText.erase(mCaretPosition - 1, 1);
            --mCaretPosition;
        }

        else if (key.getValue() == Key::ENTER)
        {
            generateAction();
        }

        else if (key.getValue() == Key::HOME)
        {
            mCaretPosition = 0;
        }

        else if (key.getValue() == Key::END)
        {
            mCaretPosition = mText.size();
        }

        else if (key.isCharacter()
                 && key.getValue() != Key::TAB)
        {
            mText.insert(mCaretPosition, std::string(1,(char)key.getValue()));
            ++mCaretPosition;
        }

        if (key.getValue() != Key::TAB)
        {
            keyEvent.consume();
        }
        
        fixScroll();
    }
开发者ID:DakaraOnline,项目名称:AONX,代码行数:54,代码来源:textfield.cpp


注:本文中的KeyEvent::getKey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。