本文整理汇总了C++中Msg_p类的典型用法代码示例。如果您正苦于以下问题:C++ Msg_p类的具体用法?C++ Msg_p怎么用?C++ Msg_p使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Msg_p类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
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;
}
}
}
示例2: while
void MsgRouter::_dispatchQueued()
{
while( !m_msgQueue.empty() )
{
Msg_p pMsg = m_msgQueue.front();
m_insertPos = m_msgQueue.begin()+1; // Insert position set to right after current event.
do
{
if( pMsg->hasCopyTo() )
pMsg->getCopyTo()->receive( pMsg );
if( pMsg->hasSource() )
_dispatchToSourceRoutes( pMsg );
_dispatchToTypeRoutes( pMsg );
_broadcast( pMsg );
}
while( pMsg->doRepost() );
m_msgQueue.pop_front();
}
m_insertPos = m_msgQueue.begin(); // Insert position set right to start.
}
示例3: _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;
}
}
示例4: _filterType
bool MsgFilter::_filterType( const Msg_p& pMsg, const MsgFilter& filter )
{
if( pMsg->type() == filter.msgType() )
return true;
return false;
}
示例5: _receive
void TextEditor::_receive( const Msg_p& pMsg )
{
MsgType type = pMsg->type();
Widget::_receive( pMsg );
m_text.receive( pMsg );
}
示例6: _formatCopyTo
string MsgLogger::_formatCopyTo( const Msg_p& _pMsg ) const
{
std::string out;
if( _pMsg->hasCopyTo() )
{
char temp[64];
Receiver * pCopyTo = _pMsg->getCopyTo().rawPtr();
const char * pType = pCopyTo->className();
sprintf( temp, " copyTo=%p (%s)", pCopyTo, pType );
out = temp;
}
return out;
}
示例7: _dispatchToSourceRoutes
void MsgRouter::_dispatchToSourceRoutes( const Msg_p& pMsg )
{
Object * pSource = pMsg->sourceRawPtr();
if( pSource )
{
auto it = m_sourceRoutes.find(Object_wp(pSource));
if( it != m_sourceRoutes.end() )
{
Route * pRoute = it->second.first();
while( pRoute )
{
if( pRoute->m_filter == MsgType::Dummy || pRoute->m_filter == pMsg->type() )
pRoute->dispatch( pMsg );
pRoute = pRoute->next();
}
}
}
}
示例8: _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;
}
示例9: _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;
}
示例10: _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;
}
示例11: _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;
}
示例12: _formatSource
string MsgLogger::_formatSource( const Msg_p& _pMsg ) const
{
std::string out;
if( _pMsg->sourceRawPtr() )
{
char temp[64];
Object * pObject = _pMsg->sourceRawPtr();
static const char def_type[] = "deleted";
const char * pType = def_type;
if( pObject )
pType = pObject->className();
sprintf( temp, " source=%p (%s)", pObject, pType );
out = temp;
}
return out;
}
示例13: _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;
}
示例14: 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;
}
}
示例15: _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();
}
}
}