本文整理汇总了C++中GLWindow::OnMouseWheel方法的典型用法代码示例。如果您正苦于以下问题:C++ GLWindow::OnMouseWheel方法的具体用法?C++ GLWindow::OnMouseWheel怎么用?C++ GLWindow::OnMouseWheel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLWindow
的用法示例。
在下文中一共展示了GLWindow::OnMouseWheel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: scroll_event
static gint scroll_event( GtkWidget *widget,
GdkEventScroll *event,
gpointer data ){
GLWindow *wnd = (GLWindow*)data;
wnd->OnMouseWheel( ( event->direction == GDK_SCROLL_UP ) ? true : false, (int)event->x, (int)event->y );
return TRUE;
}
示例2: button_press
static void button_press (GtkWidget *widget, GdkEventButton *event, gpointer data)
{
GLWindow *wnd = (GLWindow*)data;
guint32 flags = 0;
gdk_pointer_grab (widget->window, FALSE,
(GdkEventMask)(GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK),
NULL, NULL, GDK_CURRENT_TIME);
gtk_window_set_focus (GTK_WINDOW (g_pParentWnd->m_pWidget), widget);
switch (event->button)
{
case 1: flags |= MK_LBUTTON; break;
case 2: flags |= MK_MBUTTON; break;
case 3: flags |= MK_RBUTTON; break;
#if !GTK_CHECK_VERSION (1,3,0)
case 4: wnd->OnMouseWheel(true); break;
case 5: wnd->OnMouseWheel(false); break;
#endif
}
if ((event->state & GDK_CONTROL_MASK) != 0)
flags |= MK_CONTROL;
if ((event->state & GDK_SHIFT_MASK) != 0)
flags |= MK_SHIFT;
if (event->type == GDK_BUTTON_PRESS)
{
switch (event->button)
{
case 1:
wnd->OnLButtonDown (flags, (int)event->x, (int)event->y); break;
case 2:
wnd->OnMButtonDown (flags, (int)event->x, (int)event->y); break;
case 3:
wnd->OnRButtonDown (flags, (int)event->x, (int)event->y); break;
}
}
else if (event->type == GDK_2BUTTON_PRESS)
{
// do nothing
}
}