本文整理汇总了C++中OSFactory::getMousePos方法的典型用法代码示例。如果您正苦于以下问题:C++ OSFactory::getMousePos方法的具体用法?C++ OSFactory::getMousePos怎么用?C++ OSFactory::getMousePos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OSFactory
的用法示例。
在下文中一共展示了OSFactory::getMousePos方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void Tooltip::CmdShow::execute()
{
if( m_pParent->m_pImage )
{
if( m_pParent->m_xPos == -1 )
{
// Get the mouse coordinates and the image size
OSFactory *pOsFactory = OSFactory::instance( m_pParent->getIntf() );
int x, y;
pOsFactory->getMousePos( x, y );
int scrWidth = pOsFactory->getScreenWidth();
int scrHeight = pOsFactory->getScreenHeight();
int w = m_pParent->m_pImage->getWidth();
int h = m_pParent->m_pImage->getHeight();
// Compute the position of the tooltip
x -= (w / 2 + 4);
y += (h + 5);
if( x + w > scrWidth )
x -= (x + w - scrWidth);
else if( x < 0 )
x = 0;
if( y + h > scrHeight )
y -= (2 * h + 20);
m_pParent->m_xPos = x;
m_pParent->m_yPos = y;
}
// Show the tooltip window
m_pParent->m_pOsTooltip->show( m_pParent->m_xPos, m_pParent->m_yPos,
*(m_pParent->m_pImage) );
}
}
示例2: evt
void X11Loop::handleX11Event()
{
XEvent event;
OSFactory *pOsFactory = OSFactory::instance( getIntf() );
// Look for the next event in the queue
XNextEvent( XDISPLAY, &event );
if( event.xany.window == m_rDisplay.getMainWindow() )
{
if( event.type == MapNotify )
{
// When the "parent" window is mapped, show all the visible
// windows, as it is not automatic, unfortunately
Theme *pTheme = getIntf()->p_sys->p_theme;
if( pTheme )
{
// Commented out as it really doesn't seem useful
// but rather brings visible problems
// pTheme->getWindowManager().synchVisibility();
}
}
return;
}
// Find the window to which the event is sent
GenericWindow *pWin =
((X11Factory*)pOsFactory)->m_windowMap[event.xany.window];
if( !pWin )
{
return;
}
// Send the right event object to the window
switch( event.type )
{
case Expose:
{
EvtRefresh evt( getIntf(), event.xexpose.x,
event.xexpose.y, event.xexpose.width,
event.xexpose.height );
pWin->processEvent( evt );
break;
}
case FocusIn:
{
EvtFocus evt( getIntf(), true );
pWin->processEvent( evt );
break;
}
case FocusOut:
{
EvtFocus evt( getIntf(), false );
pWin->processEvent( evt );
break;
}
case MotionNotify:
{
// Don't trust the position in the event, it is
// out of date. Get the actual current position instead
int x, y;
pOsFactory->getMousePos( x, y );
EvtMotion evt( getIntf(), x, y );
pWin->processEvent( evt );
break;
}
case LeaveNotify:
{
EvtLeave evt( getIntf() );
pWin->processEvent( evt );
break;
}
case ButtonPress:
case ButtonRelease:
{
EvtMouse::ActionType_t action = EvtMouse::kDown;
switch( event.type )
{
case ButtonPress:
action = EvtMouse::kDown;
break;
case ButtonRelease:
action = EvtMouse::kUp;
break;
}
// Get the modifiers
int mod = EvtInput::kModNone;
if( event.xbutton.state & Mod1Mask )
{
mod |= EvtInput::kModAlt;
}
if( event.xbutton.state & ControlMask )
{
mod |= EvtInput::kModCtrl;
}
if( event.xbutton.state & ShiftMask )
{
//.........这里部分代码省略.........
示例3: evt
void X11Loop::handleX11Event()
{
XEvent event;
OSFactory *pOsFactory = OSFactory::instance( getIntf() );
// Look for the next event in the queue
XNextEvent( XDISPLAY, &event );
if( event.xany.window == m_rDisplay.getMainWindow() )
{
if( event.type == ClientMessage )
{
Atom wm_protocols =
XInternAtom( XDISPLAY, "WM_PROTOCOLS", False);
Atom wm_delete =
XInternAtom( XDISPLAY, "WM_DELETE_WINDOW", False);
if( event.xclient.message_type == wm_protocols &&
event.xclient.data.l[0] == wm_delete )
{
msg_Dbg( getIntf(), "Received WM_DELETE_WINDOW message" );
libvlc_Quit( getIntf()->p_libvlc );
}
}
return;
}
// Find the window to which the event is sent
GenericWindow *pWin =
((X11Factory*)pOsFactory)->m_windowMap[event.xany.window];
if( !pWin )
{
return;
}
// Send the right event object to the window
switch( event.type )
{
case Expose:
{
EvtRefresh evt( getIntf(), event.xexpose.x,
event.xexpose.y, event.xexpose.width,
event.xexpose.height );
pWin->processEvent( evt );
break;
}
case FocusIn:
{
EvtFocus evt( getIntf(), true );
pWin->processEvent( evt );
break;
}
case FocusOut:
{
EvtFocus evt( getIntf(), false );
pWin->processEvent( evt );
break;
}
case MotionNotify:
{
// Don't trust the position in the event, it is
// out of date. Get the actual current position instead
int x, y;
pOsFactory->getMousePos( x, y );
EvtMotion evt( getIntf(), x, y );
pWin->processEvent( evt );
break;
}
case LeaveNotify:
{
EvtLeave evt( getIntf() );
pWin->processEvent( evt );
break;
}
case ButtonPress:
case ButtonRelease:
{
EvtMouse::ActionType_t action = EvtMouse::kDown;
switch( event.type )
{
case ButtonPress:
action = EvtMouse::kDown;
break;
case ButtonRelease:
action = EvtMouse::kUp;
break;
}
int mod = X11ModToMod( event.xbutton.state );
// Check for double clicks
if( event.type == ButtonPress &&
event.xbutton.button == 1 )
{
mtime_t time = mdate();
int x, y;
pOsFactory->getMousePos( x, y );
if( time - m_lastClickTime < m_dblClickDelay &&
//.........这里部分代码省略.........