本文整理汇总了C++中Msg_p::isMouseButtonMsg方法的典型用法代码示例。如果您正苦于以下问题:C++ Msg_p::isMouseButtonMsg方法的具体用法?C++ Msg_p::isMouseButtonMsg怎么用?C++ Msg_p::isMouseButtonMsg使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Msg_p
的用法示例。
在下文中一共展示了Msg_p::isMouseButtonMsg方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _onMsg
//.........这里部分代码省略.........
m_text.setSelectionMode(true);
if( modKeys & MODKEY_CTRL )
m_text.gotoPrevWord();
else
m_text.goLeft();
break;
case Key::Right:
if( modKeys & MODKEY_SHIFT )
m_text.setSelectionMode(true);
if( modKeys & MODKEY_CTRL )
m_text.gotoNextWord();
else
m_text.goRight();
break;
case Key::Up:
if( modKeys & MODKEY_SHIFT )
m_text.setSelectionMode(true);
m_text.cursorGoUp( 1, globalGeo() );
break;
case Key::Down:
if( modKeys & MODKEY_SHIFT )
m_text.setSelectionMode(true);
m_text.cursorGoDown( 1, globalGeo() );
break;
case Key::Backspace:
if(m_text.hasSelection())
m_text.delSelection();
else if( modKeys & MODKEY_CTRL )
m_text.delPrevWord();
else
m_text.delPrevChar();
break;
case Key::Delete:
if(m_text.hasSelection())
m_text.delSelection();
else if( modKeys & MODKEY_CTRL )
m_text.delNextWord();
else
m_text.delNextChar();
break;
case Key::Home:
if( modKeys & MODKEY_SHIFT )
m_text.setSelectionMode(true);
if( modKeys & MODKEY_CTRL )
m_text.goBot();
else
m_text.goBol();
break;
case Key::End:
if( modKeys & MODKEY_SHIFT )
m_text.setSelectionMode(true);
if( modKeys & MODKEY_CTRL )
m_text.goEot();
else
m_text.goEol();
break;
default:
break;
}
}
// Let text object handle its actions.
/*
bool bChanged = m_text.onAction( action, button_key, globalGeo(), Coord(info.x, info.y) );
if( bChanged )
RequestRender();
*/
// Swallow message depending on rules.
if( pMsg->isMouseButtonMsg() && isSelectable() )
{
if( MouseButtonMsg::cast(pMsg)->button() == MouseButton::Left )
pMsg->swallow();
}
else if( pMsg->isKeyMsg() && isEditable() )
{
Key key = KeyMsg::cast(pMsg)->translatedKeyCode();
if( KeyMsg::cast(pMsg)->isMovementKey() == true ||
key == Key::Delete || key == Key::Backspace || key == Key::Return || (key == Key::Tab && m_bTabLock) )
pMsg->swallow();
//TODO: Would be good if we didn't forward any character-creating keys either...
}
else if( type == MsgType::TextInput )
pMsg->swallow();
}