void wxScrollHelperNative::Scroll( int x_pos, int y_pos ) { wxCHECK_RET( m_targetWindow != 0, _T("No target window") ); DoScroll(wxHORIZONTAL, x_pos, m_xScrollPixelsPerLine, &m_xScrollPosition); DoScroll(wxVERTICAL, y_pos, m_yScrollPixelsPerLine, &m_yScrollPosition); }
extern void AutoScroll( RECT eatom, POINT delta ) /***********************************************/ { POINT offset; RECT clrect; HWND wnd; int xdel; int ydel; POINT mouse; eatom = eatom; /* ref'd to avoid warnings */ if( GetScrollConfig() == SCROLL_NONE ) { return; } wnd = GetAppWnd(); GetClientRect( wnd, &clrect ); GetOffset( &offset ); OffsetRect( &clrect, offset.x, offset.y ); xdel = 0; ydel = 0; mouse = GetPrevMouse(); mouse.x += delta.x; mouse.y += delta.y; if( (delta.x > 0 && (abs( mouse.x - clrect.right ) < GetHorizontalInc() || mouse.x > clrect.right)) || (delta.x < 0 && (abs( mouse.x - clrect.left ) < GetHorizontalInc() || mouse.x < clrect.left)) ) { xdel = delta.x; if( xdel > 0 ) { xdel = __max( 1, (xdel * SLOW_DOWN_N) / SLOW_DOWN_D ); } else { xdel = __min( -1, (xdel * SLOW_DOWN_N) / SLOW_DOWN_D ); } } if( (delta.y > 0 && (abs( mouse.y - clrect.bottom ) < GetVerticalInc() || mouse.y > clrect.bottom)) || (delta.y < 0 && (abs( mouse.y - clrect.top ) < GetVerticalInc() || mouse.y < clrect.top)) ) { ydel = delta.y; if( ydel > 0 ) { ydel = __max( 1, (ydel * SLOW_DOWN_N) / SLOW_DOWN_D ); } else { ydel = __min( -1, (ydel * SLOW_DOWN_N) / SLOW_DOWN_D ); } } if( !(GetScrollConfig() & SCROLL_VERT) ) { ydel = 0; } if( !(GetScrollConfig() & SCROLL_HORZ) ) { xdel = 0; } DoScroll( wnd, xdel, ydel, TRUE ); UpdateWindow( wnd ); }
extern void HorizontalScroll( WPARAM wparam, LPARAM lparam, HWND wnd ) /********************************************************************/ { int xdel; RECT clrect; POINT offset; RECT scrollrect; wparam = wparam; lparam = lparam; if( !(GetScrollConfig() & SCROLL_HORZ) ) { return; } GetClientRect( GetAppWnd(), &clrect ); scrollrect = GetScrollRect(); xdel = 0; GetOffset( &offset ); switch( LOWORD( wparam ) ) { case SB_BOTTOM: xdel = scrollrect.right - offset.x - clrect.right; break; case SB_LINEDOWN: xdel = LN_SC_AMOUNT; break; case SB_LINEUP: xdel = -LN_SC_AMOUNT; break; case SB_PAGEDOWN: xdel = (long)clrect.right * PG_SC_PERCENT / 100; break; case SB_PAGEUP: xdel = -(long)clrect.right * PG_SC_PERCENT / 100; break; case SB_THUMBPOSITION: //xdel = GET_WM_VSCROLL_POS( wparam, lparam ) - offset.x - clrect.right; xdel = GET_WM_VSCROLL_POS( wparam, lparam ) - offset.x; break; case SB_TOP: xdel = -offset.x; break; default: break; } // make sure we do not expose area's not in the scroll rect if( clrect.right <= scrollrect.right && clrect.left >= scrollrect.left ) { if( xdel ) { if( clrect.right + offset.x + xdel > scrollrect.right ) { xdel = scrollrect.right - clrect.right - offset.x; } } else { if( clrect.left + offset.x + xdel < scrollrect.left ) { xdel = clrect.left + offset.x - scrollrect.left; } } } DoScroll( wnd, xdel, 0, TRUE ); }
extern void VerticalScroll( WPARAM wparam, LPARAM lparam, HWND wnd ) /******************************************************************/ { int ydel; RECT clrect; POINT offset; RECT scrollrect; wparam = wparam; lparam = lparam; if( !(GetScrollConfig() & SCROLL_VERT) ) { return; } GetClientRect( GetAppWnd(), &clrect ); scrollrect = GetScrollRect(); ydel = 0; GetOffset( &offset ); switch( LOWORD( wparam ) ) { case SB_BOTTOM: ydel = scrollrect.bottom - offset.y - clrect.bottom; break; case SB_LINEDOWN: ydel = LN_SC_AMOUNT; break; case SB_LINEUP: ydel = -LN_SC_AMOUNT; break; case SB_PAGEDOWN: ydel = (long)clrect.bottom * PG_SC_PERCENT / 100; break; case SB_PAGEUP: ydel = -((long)clrect.bottom * PG_SC_PERCENT / 100); break; case SB_THUMBPOSITION: //ydel = GET_WM_VSCROLL_POS( wparam, lparam ) - offset.y - clrect.bottom; ydel = GET_WM_VSCROLL_POS( wparam, lparam ) - offset.y; break; case SB_TOP: ydel = -offset.y; break; default: break; } // make sure we do not expose area's not in the scroll rect if( clrect.bottom <= scrollrect.bottom && clrect.top >= scrollrect.top ) { if( ydel ) { if( clrect.bottom + offset.y + ydel > scrollrect.bottom ) { ydel = scrollrect.bottom - clrect.bottom - offset.y; } } else { if( clrect.top + offset.y + ydel < scrollrect.top ) { ydel = clrect.top + offset.y - scrollrect.top; } } } DoScroll( wnd, 0, ydel, TRUE ); }
bool wxTextCtrl::ScrollPages(int pages) { GtkAdjustment *adj = GetVAdj(); if ( !adj ) return false; return DoScroll(adj, (int)ceil(pages*adj->page_increment)); }
void ScrollBar::LineUp() { if (_scroInfo.iVisualPos > 0) { --(_scroInfo.iVisualPos); DoScroll(); } }
void ScrollBar::ScrollToBegin(bool bRepaint) { if (_scroInfo.iVisualPos != 0) { _scroInfo.iVisualPos = 0; DoScroll(bRepaint); } }
void ScrollBar::OnHorzTrack(suic::Element* pSender, suic::MouseEventArg& e) { if (!_rcTrack.Empty()) { int iMin = 0; suic::Point ptWindow = e.MousePoint(); suic::Point ptSelf = PointToScreen(suic::Point()); suic::Rect rect(ptSelf.x, ptSelf.y, RenderSize().cx, RenderSize().cy); suic::Size szClamp(0, 0); int nThumbLength = 0; szClamp.cx = rect.left + (_decreaseBtn.IsVisible() ? (int)_decreaseBtn.GetWidth() : 0); szClamp.cy = rect.right - (_increaseBtn.IsVisible() ? (int)_increaseBtn.GetWidth() : 0); nThumbLength = _rcTrackStart.Width(); szClamp.cy -= nThumbLength; suic::Point ptOffset(ptWindow.x - _ptTrackStart.x, ptWindow.y - _ptTrackStart.y); suic::Rect rectNew(_rcTrackStart); if (abs(ptOffset.y) < 150) { rectNew.Offset(ptOffset.x, 0); if (rectNew.left < szClamp.cx) { rectNew.left = szClamp.cx; rectNew.right = rectNew.left + nThumbLength; } else if (szClamp.cy < rectNew.left) { rectNew.left = szClamp.cy; rectNew.right = rectNew.left + nThumbLength; } } if (!rectNew.Equal(&_rcTrack)) { _rcTrack = rectNew; int nPosNew = PosFromThumb(_rcTrack.left - szClamp.cx, szClamp); if (_scroInfo.iVisualPos != nPosNew) { _scroInfo.iVisualPos = nPosNew; DoScroll(true); } } } }
bool wxTextCtrl::ScrollLines(int lines) { GtkAdjustment *adj = GetVAdj(); if ( !adj ) return false; // this is hardcoded to 10 in GTK+ 1.2 (great idea) int diff = 10*lines; return DoScroll(adj, diff); }
void ScrollBar::ScrollToEnd(bool bRepaint) { int iMin = 0; int iMaxPos = max(0, (_scroInfo.iMax - iMin + 1 - _scroInfo.iPage)); if (_scroInfo.iVisualPos != iMaxPos) { _scroInfo.iVisualPos = iMaxPos; DoScroll(bRepaint); } }
void ScrollBar::LineDown() { int iMin = 0; int iMaxPos = _scroInfo.iMax - iMin + 1 - _scroInfo.iPage; if (_scroInfo.iVisualPos < iMaxPos) { ++(_scroInfo.iVisualPos); DoScroll(); } }
void GUIDoScroll( gui_window *wnd, int row_col, int bar ) { int rows; int cols; rows = 0; cols = 0; if( bar == SB_HORZ ) { cols = row_col; } else { rows = row_col; } DoScroll( wnd, rows, cols, -1, -1, false ); }
void RocketMenuPlugin::HighlightItem(Rocket::Core::Element *e) { static ColorAnimation colorAnimation(rgb(255,255,255), rgb(235, 156, 9), 1); DocumentData *doc_data = GetDocumentData(e->GetOwnerDocument()); if (doc_data != NULL) { if (doc_data->active_item != e && !e->IsClassSet("disabled")) { if (doc_data->active_item != NULL) { m_animation->CancelAnimation(doc_data->active_item); OptionsData *options_data = GetOptionsData(doc_data->active_item); if (options_data != NULL) { ShowElement(options_data->hdr, false); ShowElement(options_data->ftr, false); } RangeData *range_data = GetRangeData(doc_data->active_item); if (range_data != NULL) { ShowElement(range_data->hdr, false); ShowElement(range_data->ftr, false); } KeyData *key_data = GetKeyData(doc_data->active_item); if (key_data != NULL) { UpdateKeyChooser(key_data, doc_data->active_key, false); } } if (e != NULL) { if (e->GetParentNode()->HasAttribute("scroll")) { DoScroll(doc_data->active_item, e, e->GetParentNode()->GetParentNode()); } if (!e->HasAttribute("noanim")) { m_animation->AnimateElement(e, AnimationTypeBounce, 0.3f, &colorAnimation); } AttachCursor(e, doc_data->cursor_left, doc_data->cursor_right); OptionsData *options_data = GetOptionsData(e); if (options_data != NULL) { ShowElement(options_data->hdr, true); ShowElement(options_data->ftr, true); } RangeData *range_data = GetRangeData(e); if (range_data != NULL) { ShowElement(range_data->hdr, true); ShowElement(range_data->ftr, true); } KeyData *key_data = GetKeyData(e); if (key_data != NULL) { UpdateKeyChooser(key_data, doc_data->active_key, true); } m_delegate->DidActivateItem(e); } doc_data->active_item = e; } } }
FX_BOOL CFWL_ScrollBarImp::SendEvent() { if (m_iMinButtonState == FWL_PARTSTATE_SCB_Pressed) { DoScroll(FWL_SCBCODE_StepBackward, m_fTrackPos); return FALSE; } if (m_iMaxButtonState == FWL_PARTSTATE_SCB_Pressed) { DoScroll(FWL_SCBCODE_StepForward, m_fTrackPos); return FALSE; } if (m_iMinTrackState == FWL_PARTSTATE_SCB_Pressed) { DoScroll(FWL_SCBCODE_PageBackward, m_fTrackPos); return m_rtThumb.Contains(m_cpTrackPointX, m_cpTrackPointY); } if (m_iMaxTrackState == FWL_PARTSTATE_SCB_Pressed) { DoScroll(FWL_SCBCODE_PageForward, m_fTrackPos); return m_rtThumb.Contains(m_cpTrackPointX, m_cpTrackPointY); } if (m_iMouseWheel) { FX_WORD dwCode = m_iMouseWheel < 0 ? FWL_SCBCODE_StepForward : FWL_SCBCODE_StepBackward; DoScroll(dwCode, m_fTrackPos); } return TRUE; }
void ScrollBar::PageUp() { if (_scroInfo.iVisualPos <= 0) { return; } _scroInfo.iVisualPos -= _scroInfo.iPage; if (_scroInfo.iVisualPos < 0) { _scroInfo.iVisualPos = 0; } DoScroll(); }
void ScrollBar::PageDown() { int iMin = 0; int iMaxPos = _scroInfo.iMax - iMin + 1 - _scroInfo.iPage; if (_scroInfo.iVisualPos >= iMaxPos) { return; } _scroInfo.iVisualPos += _scroInfo.iPage; if (_scroInfo.iVisualPos > iMaxPos) { _scroInfo.iVisualPos = iMaxPos; } DoScroll(); }
void GUIDoHScroll( gui_window *wnd, int cols ) { DoScroll( wnd, 0, cols, -1, -1, true ); }
void GUIDoVScrollClip( gui_window *wnd, int rows, int start, int end ) { DoScroll( wnd, rows, 0, start, end, true ); }
void GUIDoHScrollClip( gui_window *wnd, int cols, int start, int end ) { DoScroll( wnd, 0, cols, start, end, true ); }
void GUIDoVScroll( gui_window *wnd, int rows ) { DoScroll( wnd, rows, 0, -1, -1, true ); }