void CLibraryTileView::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* /*pScrollBar*/) { CRect rc; GetClientRect( &rc ); SetFocus(); switch ( nSBCode ) { case SB_BOTTOM: ScrollTo( 0xFFFFFF ); break; case SB_LINEDOWN: ScrollBy( 32 ); break; case SB_LINEUP: ScrollBy( -32 ); break; case SB_PAGEDOWN: ScrollBy( rc.Height() ); break; case SB_PAGEUP: ScrollBy( -rc.Height() ); break; case SB_THUMBPOSITION: case SB_THUMBTRACK: ScrollTo( nPos ); break; case SB_TOP: ScrollTo( 0 ); break; } }
void CBrowseTreeCtrl::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) { switch ( nSBCode ) { case SB_BOTTOM: ScrollTo( 0xFFFFFFFF ); break; case SB_LINEDOWN: ScrollBy( 1 ); break; case SB_LINEUP: ScrollBy( -1 ); break; case SB_PAGEDOWN: ScrollBy( m_nVisible ); break; case SB_PAGEUP: ScrollBy( -m_nVisible ); break; case SB_THUMBPOSITION: case SB_THUMBTRACK: ScrollTo( nPos ); break; case SB_TOP: ScrollTo( 0 ); break; } }
void CListSide::Scroll(/*HWND hWnd, */int nMore) { if (false == m_bScrollEnabled) return; int add, scrollpos = GetScrollPos(m_hWnd, SB_VERT); int actual = scrollpos + nMore; if (actual < 0) { ScrollTo(0); return; } if (actual > m_dMaxScroll - m_dPage + 1) { ScrollTo(m_dMaxScroll - m_dPage + 1); return; } SetScrollPos(m_hWnd, SB_VERT, actual, 1); m_dScrollPos = actual; add = nMore; RECT client; GetClientRect(m_hWnd, &client); ScrollWindow(m_hWnd, 0, -add, NULL, &client); }
EVENT_RESULT CGUIControlGroupList::OnMouseEvent(const CPoint &point, const CMouseEvent &event) { if (event.m_id == ACTION_MOUSE_WHEEL_UP || event.m_id == ACTION_MOUSE_WHEEL_DOWN) { // find the current control and move to the next or previous float offset = 0; for (ciControls it = m_children.begin(); it != m_children.end(); ++it) { CGUIControl *control = *it; if (!control->IsVisible()) continue; float nextOffset = offset + Size(control) + m_itemGap; if (event.m_id == ACTION_MOUSE_WHEEL_DOWN && nextOffset > m_scroller.GetValue() && m_scroller.GetValue() < m_totalSize - Size()) // past our current offset { ScrollTo(nextOffset); return EVENT_RESULT_HANDLED; } else if (event.m_id == ACTION_MOUSE_WHEEL_UP && nextOffset >= m_scroller.GetValue() && m_scroller.GetValue() > 0) // at least at our current offset { ScrollTo(offset); return EVENT_RESULT_HANDLED; } offset = nextOffset; } } return EVENT_RESULT_UNHANDLED; }
void LinkHandler::GotoNamedDest(const WCHAR *name) { CrashIf(!owner || owner->linkHandler != this); if (!owner->ctrl) return; // Match order: // 1. Exact match on internal destination name // 2. Fuzzy match on full ToC item title // 3. Fuzzy match on a part of a ToC item title PageDestination *dest = owner->ctrl->GetNamedDest(name); if (dest) { ScrollTo(dest); delete dest; } else if (owner->ctrl->HasTocTree()) { DocTocItem *root = owner->ctrl->GetTocTree(); ScopedMem<WCHAR> fuzName(NormalizeFuzzy(name)); dest = FindTocItem(root, fuzName); if (!dest) dest = FindTocItem(root, fuzName, true); if (dest) ScrollTo(dest); delete root; } }
void TextEditor::ScrollToView (Coord x, Coord y) { Transformer tr(output->GetTransformer()); tr.InvTransform(x, y); if (y > ymax) { ScrollTo(0, perspective->y0 + perspective->cury - (ymax-y)); } else if (y < 0) { ScrollTo(0, perspective->y0 + perspective->cury - (-y)); } }
void StringBrowser::ScrollTo (int index) { register Perspective* p = perspective; IntCoord y0 = p->y0 + p->cury; IntCoord y = p->height - (index+1)*lineheight - y0; if (y > ymax) { ScrollTo(0, y0 - (ymax-y)); } else if (y < 0) { y -= (p->curheight % lineheight == 0) ? 0 : lineheight; ScrollTo(0, y0 - (-y)); } }
void PrettyImageView::ScrollBarAction(int action) { switch (action) { case QAbstractSlider::SliderSingleStepAdd: case QAbstractSlider::SliderPageStepAdd: ScrollTo(current_index_ + 1); break; case QAbstractSlider::SliderSingleStepSub: case QAbstractSlider::SliderPageStepSub: ScrollTo(current_index_ - 1); break; } }
void ExecutionLogWindow::OnKey(HWND hwnd, UINT vk, BOOL fDown, int cRepeat, UINT flags) { if (fDown) { switch (vk) { case VK_UP: ScrollDelta(hwnd, -cRepeat); break; case VK_DOWN: ScrollDelta(hwnd, +cRepeat); break; case VK_PRIOR: ScrollDelta(hwnd, -cRepeat*m_cLinesPerPage); break; case VK_NEXT: ScrollDelta(hwnd, +cRepeat*m_cLinesPerPage); break; case VK_HOME: ScrollTo(hwnd, 0); break; case VK_END: ScrollTo(hwnd, MAXLONG); break; } } }
void ExecutionLogWindow::OnVscroll(HWND hwnd, HWND hwndCtl, UINT code, int pos) { switch (code) { case SB_LINEUP: ScrollDelta(hwnd, -1); break; case SB_LINEDOWN: ScrollDelta(hwnd, +1); break; case SB_PAGEUP: ScrollDelta(hwnd, -m_cLinesPerPage); break; case SB_PAGEDOWN: ScrollDelta(hwnd, +m_cLinesPerPage); break; case SB_THUMBPOSITION: ScrollTo(hwnd, GetScrollPos(hwnd, SB_VERT)); break; case SB_THUMBTRACK: ScrollTo(hwnd, GetTrackPos(hwnd, SB_VERT)); break; case SB_TOP: ScrollTo(hwnd, 0); break; case SB_BOTTOM: ScrollTo(hwnd, MAXLONG); break; } }
void BListView::ScrollToSelection() { BRect itemFrame = ItemFrame(CurrentSelection(0)); if (Bounds().Contains(itemFrame)) return; if (itemFrame.top < Bounds().top) ScrollTo(itemFrame.left, itemFrame.top); else ScrollTo(itemFrame.left, itemFrame.bottom - Bounds().Height()); }
void sBrowserTree::OnPaint() { sInt pos; sRect r; NewScrollValue = -1; Height = sPainter->GetHeight(sGui->FixedFont)+2; pos = 0; PaintDir(Dir,pos,0); SizeY = Height*pos; CalcSizeY = SizeY; r = Client; r.y0 = Client.y0 + pos*Height; r.y1 = Client.y1; if(r.y0<r.y1) sPainter->Paint(sGui->FlatMat,r,sGui->Palette[sGC_BACK]); if(ScrollToSelection && NewScrollValue!=-1) { sRect r; r.Init(Client.x0,NewScrollValue,Client.x1,NewScrollValue+Height-1); ScrollTo(r); } ScrollToSelection = 0; }
void JXTreeListWidget::ScrollToShowChildren ( const JIndex index ) { const JTreeNode* node = itsTreeList->GetNode(index); if (!node->HasChildren()) { return; } // scroll minimum to show last child const JTreeNode* lastChild = node->GetChild(node->GetChildCount()); ScrollToNode(lastChild); // if original node not visible, force it to be const JCoordinate y = GetRowTop(index); if (y < (GetAperture()).top) { ScrollTo(0, y); } }
/** * レイアウトを再計算します。 */ void TextDiffView::DiffPaneView::recalcLayout() { dataHeight = -1; // 高さキャッシュをクリア BRect bounds = Bounds(); float boundsHeight = bounds.Height() + 1; float height = getDataHeight(); if (height < boundsHeight) { height = boundsHeight; } // サイズが広がったりした結果、縦方向に // スクロールできないところまでスクロールした状態になったら // バウンズ矩形を調整する。 if (bounds.bottom >= height) { // この ScrollTo の中から adjustScrollBar が呼び出される ScrollTo(BPoint(bounds.left, height - boundsHeight)); } else { adjustScrollBar(); } }
void EnsureVisible(HWND hwnd,struct ClcData *dat,int iItem,int partialOk) { int itemy,newy; int moved=0; RECT clRect; if (dat==NULL||IsBadCodePtr((void *)dat)||!dat->row_heights) { TRACE("dat is null __FILE____LINE__"); return ; }; GetClientRect(hwnd,&clRect); itemy=RowHeights_GetItemTopY(dat,iItem); if(partialOk) { if(itemy+dat->row_heights[iItem]-1<dat->yScroll) {newy=itemy; moved=1;} else if(itemy>=dat->yScroll+clRect.bottom) {newy=itemy-clRect.bottom+dat->row_heights[iItem]; moved=1;} } else { if(itemy<dat->yScroll) {newy=itemy; moved=1;} else if(itemy>=dat->yScroll+clRect.bottom-dat->row_heights[iItem]) {newy=itemy-clRect.bottom+dat->row_heights[iItem]; moved=1;} } if(moved) ScrollTo(hwnd,dat,newy,0); }
void StringBrowser::Adjust (Perspective& np) { register Perspective* p = perspective; float scale = (np.height == 0) ? 1 : float(p->height) / float(np.height); int x = p->x0 + int((np.curx - np.x0) * scale); int y = p->y0 + int((np.cury - np.y0) * scale); ScrollTo(x, y); }
void JXColHeaderWidget::Receive ( JBroadcaster* sender, const Message& message ) { // scrollbar moved if (sender == const_cast<JXScrollbar*>(itsHScrollbar) && message.Is(JXScrollbar::kScrolled)) { ScrollTo(itsHScrollbar->GetValue(), 0); } // columns changed else if (sender == itsTable && message.Is(JTable::kColWidthChanged)) { const JTable::ColWidthChanged* info = dynamic_cast(const JTable::ColWidthChanged*, &message); assert( info != NULL ); SetColWidth(info->GetIndex(), info->GetNewColWidth()); } else if (sender == itsTable && message.Is(JTable::kAllColWidthsChanged))
void TextEditor::ScrollToView (IntCoord x, IntCoord y) { IntCoord dx = x < 0 ? x : x > xmax ? x - xmax : 0; IntCoord dy = y < 0 ? y : y > ymax ? y - ymax : 0; if (dx != 0 || dy != 0) { ScrollTo(perspective->curx + dx, perspective->cury + dy); } }
void HexView::ScrollToCaret() { int x, y; int dx = 0, dy = 0; // first of all bring the view into view ScrollTo(m_nCursorOffset); if(m_nCursorOffset % m_nBytesPerLine != 0) { m_fCursorAdjustment = FALSE; } // now find cursor position CaretPosFromOffset(m_nCursorOffset, &x, &y); if(y < 0) dy = y; else if(y > m_nWindowLines - 1) dy = y - m_nWindowLines + 1; if(x < 0) dx = x; Scroll(dx, dy); CaretPosFromOffset(m_nCursorOffset, &x, &y); PositionCaret(x, y, m_nWhichPane); }
void SearchListView::Clear(void) { fRectVec.clear(); BColumnListView::Clear(); ScrollTo(BPoint(0, 0)); }
wxTreeItemId PHPFileLayoutTree::TryGetPrevItem(wxTreeItemId item) { wxCHECK_MSG(item.IsOk(), wxTreeItemId(), wxT("invalid tree item")); // find out the starting point wxTreeItemId prevItem = GetPrevSibling(item); if(!prevItem.IsOk()) { prevItem = GetItemParent(item); if(prevItem == GetRootItem()) { return wxTreeItemId(); } } // from there we must be able to navigate until this item while(prevItem.IsOk()) { ScrollTo(prevItem); if(!IsVisible(prevItem)) { return wxTreeItemId(); } const wxTreeItemId nextItem = GetNextVisible(prevItem); if(!nextItem.IsOk() || nextItem == item) return prevItem; prevItem = nextItem; } return wxTreeItemId(); }
void JXRowHeaderWidget::Receive ( JBroadcaster* sender, const Message& message ) { // scrollbar moved if (sender == const_cast<JXScrollbar*>(itsVScrollbar) && message.Is(JXScrollbar::kScrolled)) { ScrollTo(0, itsVScrollbar->GetValue()); } // rows changed else if (sender == itsTable && message.Is(JTable::kRowHeightChanged)) { const JTable::RowHeightChanged* info = dynamic_cast(const JTable::RowHeightChanged*, &message); assert( info != NULL ); SetRowHeight(info->GetIndex(), info->GetNewRowHeight()); } else if (sender == itsTable && message.Is(JTable::kAllRowHeightsChanged))
void sTextControl::ScrollToCursor() { sInt i,x,y,h,pos; sRect r; Post(CursorCmd); CursorWish = GetCursorX(); h = sPainter->GetHeight(sGui->FixedFont); y = Client.y0+2; x = Client.x0+2; pos = 0; for(;;) { i = 0; while(Text[pos+i]!=0 && Text[pos+i]!='\n') i++; if(Cursor>=pos && Cursor<=pos+i) { r.x0 = x+sPainter->GetWidth(sGui->FixedFont,Text+pos,Cursor-pos); r.y0 = y; r.x1 = r.x0+1; r.y1 = y+h; ScrollTo(r,sGWS_SAFE); return; } y+=h; pos+=i; if(Text[pos]==0) break; if(Text[pos]=='\n') pos++; } }
NS_IMETHODIMP nsScrollPortView::ScrollByLines(PRInt32 aNumLinesX, PRInt32 aNumLinesY) { nscoord dx = mLineHeight*aNumLinesX; nscoord dy = mLineHeight*aNumLinesY; return ScrollTo(mOffsetX + dx, mOffsetY + dy, NS_VMREFRESH_SMOOTHSCROLL); }
void CMLineIndexTable::Receive ( JBroadcaster* sender, const Message& message ) { if (sender == itsText && (message.Is(JTextEditor::kTextChanged) || message.Is(JTextEditor::kTextSet))) { AdjustToText(); } else if (sender == itsVScrollbar && message.Is(JXScrollbar::kScrolled)) { const JXScrollbar::Scrolled* info = dynamic_cast<const JXScrollbar::Scrolled*>(&message); assert( info != NULL ); ScrollTo(0, info->GetValue()); } else if (sender == itsLink && (message.Is(CMLink::kDebuggerStarted) || message.Is(CMLink::kSymbolsLoaded) || message.Is(CMLink::kAttachedToProcess) || message.Is(CMLink::kDetachedFromProcess) || message.Is(CMLink::kProgramRunning) || message.Is(CMLink::kProgramFinished))) { if (!itsLink->HasCore()) { SetCurrentLine(0); } } else if (sender == itsLink->GetBreakpointManager() && message.Is(CMBreakpointManager::kBreakpointsChanged)) { UpdateBreakpoints(); } else if (sender == itsLineMenu && message.Is(JXMenu::kNeedsUpdate)) { UpdateLineMenu(); } else if (sender == itsLineMenu && message.Is(JXMenu::kItemSelected)) { const JXMenu::ItemSelected* selection = dynamic_cast<const JXMenu::ItemSelected*>(&message); assert( selection != NULL ); HandleLineMenu(selection->GetIndex()); } else { JXTable::Receive(sender, message); } }
void PrettyImageView::AddImage(const QUrl& url) { PrettyImage* image = new PrettyImage(url, network_, container_); connect(image, SIGNAL(destroyed()), SLOT(ScrollToCurrent())); connect(image, SIGNAL(Loaded()), SLOT(ScrollToCurrent())); layout_->insertWidget(layout_->count() - 1, image); if (current_index_ == -1) ScrollTo(0); }
void TextEditor::Adjust (Perspective& np) { float scale = float(perspective->height) / float(np.height); ScrollTo( perspective->x0 + int((np.curx - np.x0)*scale), perspective->y0 + int((np.cury - np.y0)*scale) ); np = *perspective; }
// // Sets the total units of the window // void TScroller::SetTotalRangeOfUnits(long xTotalUnits, long yTotalUnits) { XTotalUnits = xTotalUnits; YTotalUnits = yTotalUnits; SetSBarRange(); ScrollTo(XPos, YPos); }
// /// Sets the xRange and yRange of the TScroller to the parameters specified. Then /// calls SetSBarRange to synchronize the range of the owner window's scroll bars. // void TScroller::SetRange(long xRange, long yRange) { XRange = xRange; YRange = yRange; SetSBarRange(); ScrollTo(XPos, YPos); }
void MemoryView::ScrollToSelection() { if (fTargetBlock != NULL) { target_addr_t offset = fTargetAddress - fTargetBlock->BaseAddress(); int32 lineNumber = 0; if (fHexBlocksPerLine > 0) lineNumber = offset / (fHexBlocksPerLine * (1 << (fHexMode - 1))); else if (fTextCharsPerLine > 0) lineNumber = offset / fTextCharsPerLine; float y = lineNumber * fLineHeight; if (y < Bounds().top) ScrollTo(0.0, y); else if (y + fLineHeight > Bounds().bottom) ScrollTo(0.0, y + fLineHeight - Bounds().Height()); } }