本文整理汇总了C++中TopWindow::forwardEvent方法的典型用法代码示例。如果您正苦于以下问题:C++ TopWindow::forwardEvent方法的具体用法?C++ TopWindow::forwardEvent怎么用?C++ TopWindow::forwardEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TopWindow
的用法示例。
在下文中一共展示了TopWindow::forwardEvent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleEvent
void CtrlSliderBg::handleEvent( EvtGeneric &rEvent )
{
if( rEvent.getAsString().find( "mouse:left:down" ) != string::npos )
{
// Compute the resize factors
float factorX, factorY;
getResizeFactors( factorX, factorY );
// Get the position of the control
const Position *pPos = getPosition();
// Get the value corresponding to the position of the mouse
EvtMouse &rEvtMouse = (EvtMouse&)rEvent;
int x = rEvtMouse.getXPos();
int y = rEvtMouse.getYPos();
m_rVariable.set( m_rCurve.getNearestPercent(
(int)((x - pPos->getLeft()) / factorX),
(int)((y - pPos->getTop()) / factorY) ) );
// Forward the clic to the cursor
EvtMouse evt( getIntf(), x, y, EvtMouse::kLeft, EvtMouse::kDown );
TopWindow *pWin = getWindow();
if( pWin && m_pCursor )
{
EvtEnter evtEnter( getIntf() );
// XXX It was not supposed to be implemented like that !!
pWin->forwardEvent( evtEnter, *m_pCursor );
pWin->forwardEvent( evt, *m_pCursor );
}
}
else if( rEvent.getAsString().find( "scroll" ) != string::npos )
{
int direction = ((EvtScroll&)rEvent).getDirection();
float percentage = m_rVariable.get();
if( direction == EvtScroll::kUp )
{
percentage += SCROLL_STEP;
}
else
{
percentage -= SCROLL_STEP;
}
m_rVariable.set( percentage );
}
}