本文整理汇总了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();
}
}
示例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();
}
}
示例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();
}
示例4: keyPressed
virtual void keyPressed(const KeyEvent& e)
{
if(e.getKey() == KeyEvent::KEY_Q && e.getModifiers() & KeyEvent::KEY_MODIFIER_CONTROL)
{
TutorialWindowEventProducer->closeWindow();
}
}
示例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();
}
}
}
示例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;
}
示例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;
}
示例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();
}
}
示例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();
}
示例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;
}
示例11: keyPressed
void ClickLabel::keyPressed(KeyEvent& keyEvent)
{
Key key = keyEvent.getKey();
if (key.getValue() == Key::ENTER || key.getValue() == Key::SPACE) {
mKeyPressed = true;
keyEvent.consume();
}
}
示例12: keyDown
void TextField::keyDown( KeyEvent &keyEvent )
{
handleKeyboard(keyEvent);
if(keyEvent.getKey() == KEY_ENTER)
{
dispatchActionEvent(ActionEvent(this));
}
keyEvent.consume();
}
示例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;
}
示例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();
}
}
示例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();
}