本文整理汇总了C++中Msg_p::type方法的典型用法代码示例。如果您正苦于以下问题:C++ Msg_p::type方法的具体用法?C++ Msg_p::type怎么用?C++ Msg_p::type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Msg_p
的用法示例。
在下文中一共展示了Msg_p::type方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _receive
void Menubar::_receive( const Msg_p& pMsg )
{
Widget::_receive(pMsg);
switch( pMsg->type() )
{
case MsgType::MouseMove:
case MsgType::MousePress:
{
Coord pos = InputMsg::cast(pMsg)->pointerPos() - globalPos();
uint32_t item = _getItemAtAbsPos( pos.x, pos.y );
if( item && !m_items.get(item-1)->m_bEnabled )
item = 0; // Item is disabled and can't be marked.
if(m_markedItem != item)
{
m_markedItem = item;
_requestRender();
}
// If a menu entry already is selected we should
// switch to the new marked one.
if( m_selectedItem )
{
if( m_markedItem && m_selectedItem != m_markedItem )
{
_closeMenu( m_selectedItem );
_openMenu( m_markedItem );
}
}
// If this was a press, we need to select the item and open the menu.
//TODO: A click on an already open entry should close the menu.
if( item && pMsg->type()== MsgType::MousePress )
{
_openMenu( item );
}
}
case MsgType::MouseLeave:
m_markedItem = 0;
_requestRender();
break;
}
}
示例2: _filterType
bool MsgFilter::_filterType( const Msg_p& pMsg, const MsgFilter& filter )
{
if( pMsg->type() == filter.msgType() )
return true;
return false;
}
示例3: _receive
void TextEditor::_receive( const Msg_p& pMsg )
{
MsgType type = pMsg->type();
Widget::_receive( pMsg );
m_text.receive( pMsg );
}
示例4: _onMsg
void ModalLayer::_onMsg( const Msg_p& _pMsg )
{
Layer::_onMsg(_pMsg);
if( !m_modalHooks.isEmpty() && _findWidget( _pMsg->pointerPos(), WG_SEARCH_ACTION_TARGET ) == this )
{
switch( _pMsg->type() )
{
case WG_MSG_MOUSE_PRESS:
{
MouseButtonMsg_p pMsg = MouseButtonMsg::cast(_pMsg);
Base::msgRouter()->post( new ModalBlockedPressMsg( pMsg->button(), this) );
}
break;
case WG_MSG_MOUSE_RELEASE:
{
MouseButtonMsg_p pMsg = MouseButtonMsg::cast(_pMsg);
Base::msgRouter()->post( new ModalBlockedPressMsg( pMsg->button(), this) );
}
break;
case WG_MSG_MOUSE_MOVE:
{
Base::msgRouter()->post( new ModalMoveOutsideMsg(this) );
}
break;
}
}
}
示例5: _filterWheelRollMsgs
bool MsgFilter::_filterWheelRollMsgs( const Msg_p& pMsg, const MsgFilter& filter )
{
if( pMsg->type() == filter.msgType() )
{
int chr = WheelRollMsg::cast(pMsg)->wheel();
if( chr == filter.m_data1 )
return true;
}
return false;
}
示例6: _filterCharacterMsgs
bool MsgFilter::_filterCharacterMsgs( const Msg_p& pMsg, const MsgFilter& filter )
{
if( pMsg->type() == filter.msgType() )
{
int chr = CharacterMsg::cast(pMsg)->character();
if( chr == filter.m_data1 )
return true;
}
return false;
}
示例7: _filterNativeKeyMsgs
bool MsgFilter::_filterNativeKeyMsgs( const Msg_p& pMsg, const MsgFilter& filter )
{
if( pMsg->type() == filter.msgType() )
{
KeyMsg_p p = KeyMsg::cast(pMsg);
if( p->nativeKeyCode() == filter.m_data1 )
return true;
}
return false;
}
示例8: _filterItemToggleMsgs
bool MsgFilter::_filterItemToggleMsgs( const Msg_p& pMsg, const MsgFilter& filter )
{
if( pMsg->type() == filter.msgType() )
{
int itemId = ItemToggleMsg::cast(pMsg)->itemId();
if( itemId == filter.m_data1 )
return true;
}
return false;
}
示例9: _filterItemMousePressMsgs
bool MsgFilter::_filterItemMousePressMsgs( const Msg_p& pMsg, const MsgFilter& filter )
{
if( pMsg->type() == filter.msgType() )
{
ItemMousePressMsg_p pMsg = ItemMousePressMsg::cast(pMsg);
if( (filter.m_data1 == -1 || pMsg->itemId() == filter.m_data1) ||
(filter.m_data2 == -1 || pMsg->button() == filter.m_data2) )
return true;
}
return false;
}
示例10: receive
void InputHandler::receive( const Msg_p& pMsg )
{
if( pMsg->type() == MsgType::Tick ) {
int64_t timestamp = TickMsg::cast(pMsg)->timestamp();
_handleButtonRepeats( timestamp );
_handleKeyRepeats( timestamp );
m_timeStamp = timestamp;
}
}
示例11: _dispatchToTypeRoutes
void MsgRouter::_dispatchToTypeRoutes( const Msg_p& pMsg )
{
auto it = m_typeRoutes.find(pMsg->type());
if( it != m_typeRoutes.end() )
{
Route * pRoute = it->second.first();
while( pRoute )
{
pRoute->dispatch( pMsg );
pRoute = pRoute->next();
}
}
}
示例12: _finalizeMsg
void MsgRouter::_finalizeMsg( const Msg_p& pMsg )
{
// Fill in missing information in the event-class.
pMsg->m_timestamp = m_time;
pMsg->m_modKeys = m_modKeys;
// Only global POINTER_ENTER & POINTER_MOVE events have these members
// set, the rest needs to have them filled in.
if( pMsg->hasCopyTo() || (pMsg->type() != WG_MSG_MOUSE_MOVE && pMsg->type() != WG_MSG_MOUSE_ENTER) )
{
pMsg->m_pointerPos = m_pointerPos;
}
// Msg specific finalizations
switch( pMsg->type() )
{
// Key events need translation of keycodes.
case WG_MSG_KEY_PRESS:
case WG_MSG_KEY_RELEASE:
case WG_MSG_KEY_REPEAT:
{
KeyMsg* p = static_cast<KeyMsg*>(pMsg.rawPtr());
p->m_translatedKeyCode = Base::translateKey(p->m_nativeKeyCode);
}
break;
default:
break;
}
}
示例13: _filterKeyMsgs
bool MsgFilter::_filterKeyMsgs( const Msg_p& pMsg, const MsgFilter& filter )
{
if( pMsg->type() == filter.msgType() )
{
if( filter.m_data1 == 0 )
return true;
else
{
KeyMsg_p p = KeyMsg::cast(pMsg);
if( p->translatedKeyCode() == filter.m_data1 )
return true;
}
}
return false;
}
示例14: _filterMouseButtonMsgs
bool MsgFilter::_filterMouseButtonMsgs( const Msg_p& pMsg, const MsgFilter& filter )
{
if( pMsg->type() == filter.msgType() )
{
if( filter.m_data1 == 0 )
return true;
else
{
MouseButtonMsg_p p = MouseButtonMsg::cast(pMsg);
if( p->button() == filter.m_data1 )
return true;
}
}
return false;
}
示例15: _onMsg
void AnimPlayer::_onMsg( const Msg_p& pMsg )
{
Widget::_onMsg( pMsg );
switch( pMsg->type() )
{
case WG_MSG_TICK:
{
if( !m_pAnim || !m_state.isEnabled() )
return;
m_playPos += TickMsg::cast(pMsg)->millisec() * m_speed;
_playPosUpdated();
}
break;
}
}