本文整理汇总了C++中View::MouseEvent方法的典型用法代码示例。如果您正苦于以下问题:C++ View::MouseEvent方法的具体用法?C++ View::MouseEvent怎么用?C++ View::MouseEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类View
的用法示例。
在下文中一共展示了View::MouseEvent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MouseEvent
void Window::MouseEvent( int what, int x, int y, unsigned int buttons )
{
// Backwards, as added.
lock();
for ( int i = CountChildren() - 1; i >= 0; i-- )
{
View *view = ChildAt(i);
if ( view->Frame().Contains( x,y ) )
{
int nx = x - view->Frame().left;
int ny = y - view->Frame().top;
SetActiveView( view );
view->MouseEvent( what, nx, ny, buttons );
break;
}
}
unlock();
}
示例2: MouseEvent
void View::MouseEvent( int what, int x, int y, unsigned int buttons )
{
// Backwards, as added.
lock();
for ( int i = CountChildren() - 1; i >= 0; i-- )
{
View *view = ChildAt(i);
if ( view->Frame().Contains( x,y ) )
{
int nx = x - view->Frame().left;
int ny = y - view->Frame().top;
if ( GetWindow() != NULL ) GetWindow()->SetActiveView( view );
view->MouseEvent( what, nx, ny, buttons );
unlock();
return;
}
}
unlock();
// Otherwise...
switch( what )
{
case MOUSE_DOWN:
MouseDown( x, y, buttons );
break;
case MOUSE_UP:
if ( hasFlag( HAS_POPUPMENU ) == false )
{
MouseUp( x, y, buttons );
break;
}
// Only the right mouse button.
if ( m_buttons != RIGHT_MOUSE_BUTTON )
{
MouseUp( x, y, buttons );
break;
}
if ( m_popupMenu == NULL ) m_popupMenu = Popup();
if ( m_popupMenu == NULL ) return;
m_popupMenu->MoveTo( x - m_popupMenu->Frame().Width() / 2,
y - m_popupMenu->Frame().Height() / 2 );
m_popupMenu->Show();
break;
case MOUSE_MOVED:
MouseMoved( x, y, buttons );
break;
}
m_buttons = buttons;
}