本文整理汇总了C++中wxScrollWinEvent::GetEventType方法的典型用法代码示例。如果您正苦于以下问题:C++ wxScrollWinEvent::GetEventType方法的具体用法?C++ wxScrollWinEvent::GetEventType怎么用?C++ wxScrollWinEvent::GetEventType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxScrollWinEvent
的用法示例。
在下文中一共展示了wxScrollWinEvent::GetEventType方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnScrollBar
void wxVideoTerminal::OnScrollBar(wxScrollWinEvent &evt)
{
if (evt.GetOrientation() == wxVERTICAL)
{
if (evt.GetEventType() == wxEVT_SCROLLWIN_BOTTOM)
//wxLogDebug("You scrollwin Bottom: %d", evt.GetPosition())
;
else if (evt.GetEventType() == wxEVT_SCROLLWIN_TOP)
//wxLogDebug("You scrollwin Top: %d", evt.GetPosition())
;
else if (evt.GetEventType() == wxEVT_SCROLLWIN_LINEDOWN)
LineDown();
else if (evt.GetEventType() == wxEVT_SCROLLWIN_LINEUP)
LineUp();
else if (evt.GetEventType() == wxEVT_SCROLLWIN_PAGEUP)
PageUp();
else if (evt.GetEventType() == wxEVT_SCROLLWIN_PAGEDOWN)
PageDown();
else if (evt.GetEventType() == wxEVT_SCROLLWIN_THUMBTRACK ||
evt.GetEventType() == wxEVT_SCROLLWIN_THUMBRELEASE)
{
int scroll_pos = m_firstline_row + evt.GetPosition();
UpdateScrollPos(scroll_pos);
}
}
}
示例2: onScroll
void WX_VIEW_CONTROLS::onScroll( wxScrollWinEvent& aEvent )
{
const double linePanDelta = 0.05;
const double pagePanDelta = 0.5;
int type = aEvent.GetEventType();
int dir = aEvent.GetOrientation();
if( type == wxEVT_SCROLLWIN_THUMBTRACK )
{
auto center = m_view->GetCenter();
const auto& boundary = m_view->GetBoundary();
// Flip scroll direction in flipped view
const double xstart = ( m_view->IsMirroredX() ?
boundary.GetRight() : boundary.GetLeft() );
const double xdelta = ( m_view->IsMirroredX() ? -1 : 1 );
if( dir == wxHORIZONTAL )
center.x = xstart + xdelta * ( aEvent.GetPosition() / m_scrollScale.x );
else
center.y = boundary.GetTop() + aEvent.GetPosition() / m_scrollScale.y;
m_view->SetCenter( center );
}
else
{
double dist = 0;
if( type == wxEVT_SCROLLWIN_PAGEUP )
dist = pagePanDelta;
else if( type == wxEVT_SCROLLWIN_PAGEDOWN )
dist = -pagePanDelta;
else if( type == wxEVT_SCROLLWIN_LINEUP )
dist = linePanDelta;
else if( type == wxEVT_SCROLLWIN_LINEDOWN )
dist = -linePanDelta;
else
{
wxASSERT( "Unhandled event type" );
return;
}
VECTOR2D scroll = m_view->ToWorld( m_view->GetScreenPixelSize(), false ) * dist;
double scrollX = 0.0;
double scrollY = 0.0;
if ( dir == wxHORIZONTAL )
scrollX = -scroll.x;
else
scrollY = -scroll.y;
VECTOR2D delta( scrollX, scrollY );
m_view->SetCenter( m_view->GetCenter() + delta );
}
m_parentPanel->Refresh();
}
示例3: OnScroll
void wxVScrolledWindow::OnScroll(wxScrollWinEvent& event)
{
size_t lineFirstNew;
const wxEventType evtType = event.GetEventType();
if ( evtType == wxEVT_SCROLLWIN_TOP )
{
lineFirstNew = 0;
}
else if ( evtType == wxEVT_SCROLLWIN_BOTTOM )
{
lineFirstNew = m_lineMax;
}
else if ( evtType == wxEVT_SCROLLWIN_LINEUP )
{
lineFirstNew = m_lineFirst ? m_lineFirst - 1 : 0;
}
else if ( evtType == wxEVT_SCROLLWIN_LINEDOWN )
{
lineFirstNew = m_lineFirst + 1;
}
else if ( evtType == wxEVT_SCROLLWIN_PAGEUP )
{
lineFirstNew = FindFirstFromBottom(m_lineFirst);
}
else if ( evtType == wxEVT_SCROLLWIN_PAGEDOWN )
{
lineFirstNew = GetVisibleEnd();
if ( lineFirstNew )
lineFirstNew--;
}
else if ( evtType == wxEVT_SCROLLWIN_THUMBRELEASE )
{
lineFirstNew = event.GetPosition();
}
else if ( evtType == wxEVT_SCROLLWIN_THUMBTRACK )
{
lineFirstNew = event.GetPosition();
}
else // unknown scroll event?
{
wxFAIL_MSG( _T("unknown scroll event type?") );
return;
}
ScrollToLine(lineFirstNew);
#ifdef __WXMAC__
Update();
#endif // __WXMAC__
}
示例4: OnScroll
void DisView::OnScroll(wxScrollWinEvent &evt)
{
if(evt.GetOrientation() != wxSB_VERTICAL || _emu->emu == NULL)
return;
static long lockedLine = 0;
static bool scrolling = false;
wxEventType type = evt.GetEventType();
if (type == wxEVT_SCROLLWIN_THUMBTRACK)
{
if (!scrolling)
{
lockedLine = _startingLine;
scrolling = true;
}
int pos = evt.GetPosition()-50;
int scrollAmount = pos*(_numberOfLines/50);
// if the result would wrap around
if (lockedLine < -scrollAmount)
_startingLine = lockedLine + scrollAmount + _numberOfLines;
else
_startingLine = (lockedLine + scrollAmount);
_startingLine %= _numberOfLines;
} else if (type == wxEVT_SCROLLWIN_THUMBRELEASE) {
scrolling = false;
lockedLine = 0;
} else if (type == wxEVT_SCROLLWIN_LINEUP)
{
if (_startingLine == 0)
_startingLine = _numberOfLines;
_startingLine -= 1;
} else if (type == wxEVT_SCROLLWIN_LINEDOWN)
{
_startingLine += _emu->emu->Disassemble(_emu->handle, _startingLine, NULL, NULL);
_startingLine %= _numberOfLines;
} else if (type == wxEVT_SCROLLWIN_PAGEUP)
{
if (_startingLine < 50)
_startingLine += _numberOfLines;
_startingLine -= 50;
} else if (type == wxEVT_SCROLLWIN_PAGEDOWN)
{
_startingLine += 50;
_startingLine %= _numberOfLines;
}
Refresh();
}
示例5: OnScroll
void DocHistory::OnScroll(wxScrollWinEvent& event) {
wxSize size = GetClientSize();
int pos = m_scrollPos;
if (event.GetEventType() == wxEVT_SCROLLWIN_THUMBTRACK ||
event.GetEventType() == wxEVT_SCROLLWIN_THUMBRELEASE)
{
pos = event.GetPosition();
}
else if (event.GetEventType() == wxEVT_SCROLLWIN_PAGEUP) {
pos -= size.y;
if (pos < 0) pos = 0;
}
else if (event.GetEventType() == wxEVT_SCROLLWIN_PAGEDOWN) {
pos += size.y;
if (pos > m_treeHeight - size.y) pos = m_treeHeight - size.y;
}
else if (event.GetEventType() == wxEVT_SCROLLWIN_LINEUP) {
pos = pos - (pos % m_lineHeight) - m_lineHeight;
if (pos < 0) pos = 0;
}
else if (event.GetEventType() == wxEVT_SCROLLWIN_LINEDOWN) {
pos = pos - (pos % m_lineHeight) + m_lineHeight;
if (pos > m_treeHeight - size.y) pos = m_treeHeight - size.y;
}
else if (event.GetEventType() == wxEVT_SCROLLWIN_TOP) {
pos = 0;
}
else if (event.GetEventType() == wxEVT_SCROLLWIN_BOTTOM) {
pos = m_treeHeight - size.y;
if (pos < 0) pos = 0;
}
if (pos != m_scrollPos) {
m_oldScrollPos = m_scrollPos;
m_scrollPos = pos;
m_isScrolling = true;
wxClientDC dc(this);
DrawLayout(dc);
}
}
示例6: onScroll
void DropDownList::onScroll(wxScrollWinEvent& ev) {
wxEventType type = ev.GetEventType();
if (type == wxEVT_SCROLLWIN_TOP) {
scrollTo(0);
} else if (type == wxEVT_SCROLLWIN_BOTTOM) {
scrollTo(INT_MAX);
} else if (type == wxEVT_SCROLLWIN_LINEUP) {
scrollTo(visible_start - item_size.height);
} else if (type == wxEVT_SCROLLWIN_LINEDOWN) {
scrollTo(visible_start + item_size.height);
} else if (type == wxEVT_SCROLLWIN_PAGEUP) {
scrollTo(visible_start - (GetClientSize().y - item_size.height));
} else if (type == wxEVT_SCROLLWIN_PAGEDOWN) {
scrollTo(visible_start + (GetClientSize().y - item_size.height));
} else {
scrollTo(ev.GetPosition());
}
}
示例7: OnScrollWinEvents
void OnScrollWinEvents(wxScrollWinEvent& e)
{
wxEventType scrollType(e.GetEventType());
bool horiz = e.GetOrientation() == wxHORIZONTAL;
wxPoint pos(viewStart);
if (scrollType == wxEVT_SCROLLWIN_THUMBTRACK || scrollType == wxEVT_SCROLLWIN_THUMBRELEASE) {
if (horiz)
pos.x = e.GetPosition();
else
pos.y = e.GetPosition();
}
else if (scrollType == wxEVT_SCROLLWIN_LINEDOWN) {
if (horiz)
pos.x += LINE_STEP;
else
pos.y += LINE_STEP;
}
else if (scrollType == wxEVT_SCROLLWIN_LINEUP) {
if (horiz)
pos.x -= LINE_STEP;
else
pos.y -= LINE_STEP;
}
else if (scrollType == wxEVT_SCROLLWIN_PAGEUP) {
if (horiz)
pos.x -= m_scrollView->visibleWidth() - PAGE_KEEP;
else
pos.y -= m_scrollView->visibleHeight() - PAGE_KEEP;
}
else if (scrollType == wxEVT_SCROLLWIN_PAGEDOWN) {
if (horiz)
pos.x += m_scrollView->visibleWidth() - PAGE_KEEP;
else
pos.y += m_scrollView->visibleHeight() - PAGE_KEEP;
}
else
return e.Skip();
m_scrollView->setContentsPos(pos.x, pos.y);
m_scrollView->update();
}
示例8: OnScrollWinEvents
void OnScrollWinEvents(wxScrollWinEvent& e)
{
wxEventType scrollType(e.GetEventType());
bool horiz = e.GetOrientation() == wxHORIZONTAL;
wxPoint pos(viewStart);
if (scrollType == wxEVT_SCROLLWIN_THUMBTRACK || scrollType == wxEVT_SCROLLWIN_THUMBRELEASE) {
if (horiz)
pos.x = e.GetPosition();
else
pos.y = e.GetPosition();
}
else if (scrollType == wxEVT_SCROLLWIN_LINEDOWN) {
if (horiz)
pos.x += Scrollbar::pixelsPerLineStep();
else
pos.y += Scrollbar::pixelsPerLineStep();
}
else if (scrollType == wxEVT_SCROLLWIN_LINEUP) {
if (horiz)
pos.x -= Scrollbar::pixelsPerLineStep();
else
pos.y -= Scrollbar::pixelsPerLineStep();
}
else if (scrollType == wxEVT_SCROLLWIN_PAGEUP) {
if (horiz)
pos.x -= max<int>(m_scrollView->visibleWidth() * Scrollbar::minFractionToStepWhenPaging(), m_scrollView->visibleWidth() - Scrollbar::maxOverlapBetweenPages());
else
pos.y -= max<int>(m_scrollView->visibleHeight() * Scrollbar::minFractionToStepWhenPaging(), m_scrollView->visibleHeight() - Scrollbar::maxOverlapBetweenPages());
}
else if (scrollType == wxEVT_SCROLLWIN_PAGEDOWN) {
if (horiz)
pos.x += max<int>(m_scrollView->visibleWidth() * Scrollbar::minFractionToStepWhenPaging(), m_scrollView->visibleWidth() - Scrollbar::maxOverlapBetweenPages());
else
pos.y += max<int>(m_scrollView->visibleHeight() * Scrollbar::minFractionToStepWhenPaging(), m_scrollView->visibleHeight() - Scrollbar::maxOverlapBetweenPages());
}
else
return e.Skip();
m_scrollView->setScrollPosition(IntPoint(pos.x, pos.y));
}
示例9: OnScroll
void WinEDA_DrawPanel::OnScroll( wxScrollWinEvent &event )
/*********************************************************/
{
int id = event.GetEventType();
int dir, value = 0;
int x,y;
GetViewStart( &x, &y );
dir = event.GetOrientation(); // wxHORIZONTAL ou wxVERTICAL
if ( id == wxEVT_SCROLLWIN_LINEUP) value = - m_ScrollButt_unit;
else if ( id == wxEVT_SCROLLWIN_LINEDOWN) value = m_ScrollButt_unit;
else if ( id == wxEVT_SCROLLWIN_THUMBTRACK )
{
value = event.GetPosition();
if ( dir == wxHORIZONTAL ) Scroll( value, -1 );
else Scroll( -1, value );
return;
}
else
{
event.Skip();
return;
}
if ( dir == wxHORIZONTAL )
{
Scroll( x + value, -1 );
}
else
{
Scroll( -1, y + value );
}
}
示例10: 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();
}
示例11: 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;
}