本文整理汇总了C++中gcn::KeyEvent::isConsumed方法的典型用法代码示例。如果您正苦于以下问题:C++ KeyEvent::isConsumed方法的具体用法?C++ KeyEvent::isConsumed怎么用?C++ KeyEvent::isConsumed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gcn::KeyEvent
的用法示例。
在下文中一共展示了KeyEvent::isConsumed方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: keyPressed
void TabbedArea::keyPressed(gcn::KeyEvent& keyEvent)
{
if (keyEvent.isConsumed() || !isFocused())
return;
if (keyEvent.getKey().getValue() == Key::LEFT)
{
int index = getSelectedTabIndex();
index--;
if (index < 0)
setSelectedTab(mTabs[mTabs.size() - 1].first);
else
setSelectedTab(mTabs[index].first);
keyEvent.consume();
}
else if (keyEvent.getKey().getValue() == Key::RIGHT)
{
int index = getSelectedTabIndex();
index++;
if (index >= (int) mTabs.size())
setSelectedTab(mTabs[0].first);
else
setSelectedTab(mTabs[index].first);
keyEvent.consume();
}
}
示例2: keyPressed
void TabbedArea::keyPressed(gcn::KeyEvent& keyEvent)
{
if (keyEvent.isConsumed() || !isFocused())
return;
if (keyEvent.getKey().getValue() == Key::LEFT)
{
TabContainer::iterator index = getTabIterator(mSelectedTab);
if (index != mTabs.begin())
setSelectedTab((--index)->first);
else
setSelectedTab((--mTabs.end())->first);
keyEvent.consume();
}
else if (keyEvent.getKey().getValue() == Key::RIGHT)
{
TabContainer::iterator index = getTabIterator(mSelectedTab);
if (index != (--mTabs.end()))
setSelectedTab((++index)->first);
else
setSelectedTab(mTabs.begin()->first);
keyEvent.consume();
}
}
示例3: keyPressed
void FFScrollArea::keyPressed(gcn::KeyEvent &keyEvent)
{
if (keyEvent.isConsumed())
{
return;
}
if (keyEvent.getKey().getValue() == gcn::Key::Down)
{
setVerticalScrollAmount(getVerticalScrollAmount() + 16);
}
else if (keyEvent.getKey().getValue() == gcn::Key::Up)
{
setVerticalScrollAmount(getVerticalScrollAmount() - 16);
}
}
示例4: keyPressed
// -- KeyListener notifications
void DropDown::keyPressed(gcn::KeyEvent& keyEvent)
{
if (keyEvent.isConsumed())
return;
int actionId = static_cast<KeyEvent*>(&keyEvent)->getActionId();
switch (actionId)
{
case Input::KEY_GUI_SELECT:
case Input::KEY_GUI_SELECT2:
dropDown();
break;
case Input::KEY_GUI_UP:
setSelected(getSelected() - 1);
break;
case Input::KEY_GUI_DOWN:
setSelected(getSelected() + 1);
break;
case Input::KEY_GUI_HOME:
setSelected(0);
break;
case Input::KEY_GUI_END:
if (mListBox->getListModel())
{
setSelected(mListBox->getListModel()->
getNumberOfElements() - 1);
}
break;
default:
return;
}
keyEvent.consume();
}
示例5: keyPressed
// -- KeyListener notifications
void DropDown::keyPressed(gcn::KeyEvent& keyEvent)
{
if (keyEvent.isConsumed())
return;
gcn::Key key = keyEvent.getKey();
if (key.getValue() == Key::ENTER || key.getValue() == Key::SPACE)
dropDown();
else if (key.getValue() == Key::UP)
setSelected(getSelected() - 1);
else if (key.getValue() == Key::DOWN)
setSelected(getSelected() + 1);
else if (key.getValue() == Key::HOME)
setSelected(0);
else if (key.getValue() == Key::END)
setSelected(mListBox->getListModel()->getNumberOfElements() - 1);
else
return;
keyEvent.consume();
}