本文整理汇总了C++中wxScrollWinEvent类的典型用法代码示例。如果您正苦于以下问题:C++ wxScrollWinEvent类的具体用法?C++ wxScrollWinEvent怎么用?C++ wxScrollWinEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了wxScrollWinEvent类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: CalcScrollInc
int wxScrolledWindow::CalcScrollInc(wxScrollWinEvent& event)
{
int pos = event.GetPosition();
int orient = event.GetOrientation();
int nScrollInc = 0;
if (event.GetEventType() == wxEVT_SCROLLWIN_TOP)
{
if (orient == wxHORIZONTAL)
nScrollInc = - m_xScrollPosition;
else
nScrollInc = - m_yScrollPosition;
} else
if (event.GetEventType() == wxEVT_SCROLLWIN_BOTTOM)
{
if (orient == wxHORIZONTAL)
nScrollInc = GetVirtualSize().GetWidth() / m_xScrollPixelsPerLine - m_xScrollPosition;
else
nScrollInc = GetVirtualSize().GetHeight() / m_yScrollPixelsPerLine - m_yScrollPosition;
} else
if (event.GetEventType() == wxEVT_SCROLLWIN_LINEUP)
{
nScrollInc = -1;
} else
if (event.GetEventType() == wxEVT_SCROLLWIN_LINEDOWN)
{
nScrollInc = 1;
} else
if (event.GetEventType() == wxEVT_SCROLLWIN_PAGEUP)
{
if (orient == wxHORIZONTAL)
nScrollInc = -GetScrollPageSize(wxHORIZONTAL);
else
nScrollInc = -GetScrollPageSize(wxVERTICAL);
} else
if (event.GetEventType() == wxEVT_SCROLLWIN_PAGEDOWN)
{
if (orient == wxHORIZONTAL)
nScrollInc = GetScrollPageSize(wxHORIZONTAL);
else
nScrollInc = GetScrollPageSize(wxVERTICAL);
} else
if ((event.GetEventType() == wxEVT_SCROLLWIN_THUMBTRACK) ||
(event.GetEventType() == wxEVT_SCROLLWIN_THUMBRELEASE))
{
if (orient == wxHORIZONTAL)
nScrollInc = pos - m_xScrollPosition;
else
nScrollInc = pos - m_yScrollPosition;
}
if (orient == wxHORIZONTAL)
{
if (m_xScrollPixelsPerLine > 0)
{
int max = (int)(m_hAdjust->upper - m_hAdjust->page_size + 0.5);
if (max < 0) max = 0;
if ( (m_xScrollPosition + nScrollInc) < 0 )
nScrollInc = -m_xScrollPosition; // As -ve as we can go
else if ( (m_xScrollPosition + nScrollInc) > max )
nScrollInc = max - m_xScrollPosition; // As +ve as we can go
}
else
m_targetWindow->Refresh();
}
else
{
if (m_yScrollPixelsPerLine > 0)
{
int max = (int)(m_vAdjust->upper - m_vAdjust->page_size + 0.5);
if (max < 0) max = 0;
if ( (m_yScrollPosition + nScrollInc) < 0 )
nScrollInc = -m_yScrollPosition; // As -ve as we can go
else if ( (m_yScrollPosition + nScrollInc) > max )
nScrollInc = max - m_yScrollPosition; // As +ve as we can go
}
else
m_targetWindow->Refresh();
}
return nScrollInc;
}
开发者ID:HackLinux,项目名称:chandler-1,代码行数:84,代码来源:scrolwin.cpp
示例2: OnScroll
void EDA_DRAW_PANEL::OnScroll( wxScrollWinEvent& event )
{
int id = event.GetEventType();
int x, y;
int ppux, ppuy;
int csizeX, csizeY;
int unitsX, unitsY;
GetViewStart( &x, &y );
GetScrollPixelsPerUnit( &ppux, &ppuy );
GetClientSize( &csizeX, &csizeY );
GetVirtualSize( &unitsX, &unitsY );
int tmpX = x;
int tmpY = y;
csizeX /= ppux;
csizeY /= ppuy;
unitsX /= ppux;
unitsY /= ppuy;
int dir = event.GetOrientation(); // wxHORIZONTAL or wxVERTICAL
// On windows and on wxWidgets >= 2.9.5 and < 3.1,
// there is a bug in mousewheel event which always generates 2 scroll events
// (should be the case only for the default mousewheel event)
// with id = wxEVT_SCROLLWIN_LINEUP or wxEVT_SCROLLWIN_LINEDOWN
// so we skip these events.
// Note they are here just in case, because they are not actually used
// in Kicad
#if wxCHECK_VERSION( 3, 1, 0 ) || !wxCHECK_VERSION( 2, 9, 5 ) || ( !defined (__WINDOWS__) && !defined (__WXMAC__) )
int maxX = unitsX - csizeX;
int maxY = unitsY - csizeY;
if( id == wxEVT_SCROLLWIN_LINEUP )
{
if( dir == wxHORIZONTAL )
{
x -= m_scrollIncrementX;
if( x < 0 )
x = 0;
}
else
{
y -= m_scrollIncrementY;
if( y < 0 )
y = 0;
}
}
else if( id == wxEVT_SCROLLWIN_LINEDOWN )
{
if( dir == wxHORIZONTAL )
{
x += m_scrollIncrementX;
if( x > maxX )
x = maxX;
}
else
{
y += m_scrollIncrementY;
if( y > maxY )
y = maxY;
}
}
else
#endif
if( id == wxEVT_SCROLLWIN_THUMBTRACK )
{
if( dir == wxHORIZONTAL )
x = event.GetPosition();
else
y = event.GetPosition();
}
else
{
event.Skip();
return;
}
wxLogTrace( kicadTraceCoords,
wxT( "Setting scroll bars ppuX=%d, ppuY=%d, unitsX=%d, unitsY=%d, posX=%d, posY=%d" ),
ppux, ppuy, unitsX, unitsY, x, y );
double scale = GetParent()->GetScreen()->GetScalingFactor();
wxPoint center = GetParent()->GetScrollCenterPosition();
center.x += KiROUND( (double) ( x - tmpX ) / scale );
center.y += KiROUND( (double) ( y - tmpY ) / scale );
GetParent()->SetScrollCenterPosition( center );
Scroll( x, y );
event.Skip();
}
开发者ID:Lotharyx,项目名称:kicad-source-mirror,代码行数:97,代码来源:eda_draw_panel.cpp
示例3: OnScroll
// ============================================================================
// uwHexCtrl - Events
// ============================================================================
void uwHexCtrl::OnScroll( wxScrollWinEvent& event )
{
Refresh();
event.Skip();
}
开发者ID:roman-dzieciol,项目名称:wxUnrilities_XML,代码行数:8,代码来源:uwHexCtrl.cpp
示例4: OnScroll
void wxSplitterScrolledWindow::OnScroll(wxScrollWinEvent& event)
{
// Ensure that events being propagated back up the window hierarchy
// don't cause an infinite loop
static bool inOnScroll = FALSE;
if (inOnScroll)
{
event.Skip();
return;
}
inOnScroll = TRUE;
int orient = event.GetOrientation();
int nScrollInc = CalcScrollInc(event);
if (nScrollInc == 0)
{
inOnScroll = FALSE;
return;
}
if (orient == wxHORIZONTAL)
{
inOnScroll = FALSE;
event.Skip();
return;
#if 0
int newPos = m_xScrollPosition + nScrollInc;
SetScrollPos(wxHORIZONTAL, newPos, TRUE );
#endif
}
else
{
int newPos = m_yScrollPosition + nScrollInc;
SetScrollPos(wxVERTICAL, newPos, TRUE );
}
if (orient == wxHORIZONTAL)
{
m_xScrollPosition += nScrollInc;
}
else
{
m_yScrollPosition += nScrollInc;
}
// Find targets in splitter window and send the event to them
wxNode* node = GetChildren().First();
while (node)
{
wxWindow* child = (wxWindow*) node->Data();
if (child->IsKindOf(CLASSINFO(wxSplitterWindow)))
{
wxSplitterWindow* splitter = (wxSplitterWindow*) child;
if (splitter->GetWindow1())
splitter->GetWindow1()->ProcessEvent(event);
if (splitter->GetWindow2())
splitter->GetWindow2()->ProcessEvent(event);
break;
}
node = node->Next();
}
#ifdef __WXMAC__
m_targetWindow->MacUpdateImmediately() ;
#endif
inOnScroll = FALSE;
}
开发者ID:Undrizzle,项目名称:yolanda,代码行数:69,代码来源:splittree.cpp
示例5: OnVScroll
void view::OnVScroll(wxScrollWinEvent & event)
{
this->m_drawing_view.set_y_scroll_ratio( -(event.GetPosition() - 50 )/100.0);
}
开发者ID:CNCBASHER,项目名称:quantracker_sim,代码行数:4,代码来源:view.cpp
示例6: OnScroll
void DataListCtrl::OnScroll(wxScrollWinEvent& event)
{
EndEdit(false);
event.Skip(true);
}
开发者ID:takashi310,项目名称:VVD_Viewer,代码行数:5,代码来源:ListPanel.cpp
示例7: OnScrollEvent
void wxListCtrlEx::OnScrollEvent(wxScrollWinEvent& event)
{
event.Skip();
OnPreEmitPostScrollEvent();
}
开发者ID:juaristi,项目名称:filezilla,代码行数:5,代码来源:listctrlex.cpp
注:本文中的wxScrollWinEvent类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论