NS_IMETHODIMP nsListBoxBodyFrame::ScrollByLines(PRInt32 aNumLines) { PRInt32 scrollIndex, visibleRows; GetIndexOfFirstVisibleRow(&scrollIndex); GetNumberOfVisibleRows(&visibleRows); scrollIndex += aNumLines; if (scrollIndex < 0) scrollIndex = 0; else { PRInt32 numRows = GetRowCount(); PRInt32 lastPageTopRow = numRows - visibleRows; if (scrollIndex > lastPageTopRow) scrollIndex = lastPageTopRow; } ScrollToIndex(scrollIndex); // we have to do a sync update for mac because if we scroll too quickly // w/out going back to the main event loop we can easily scroll the wrong // bits and it looks like garbage (bug 63465). // XXXbz is this seriously still needed? // I'd use Composite here, but it doesn't always work. // vm->Composite(); PresContext()->GetViewManager()->ForceUpdate(); return NS_OK; }
// Returns true if successful (id is present) bool tpanelscrollbar::ScrollToId(uint64_t id, int offset) { int index = parent->IDToCurrentDispIndex(id); if (index >= 0) { ScrollToIndex(index, offset); return true; } else { return false; } }
void SoundCloudService::SearchFinished(QNetworkReply* reply, int task_id) { reply->deleteLater(); SongList songs = ExtractSongs(ExtractResult(reply)); // Fill results list for (const Song& song : songs) { QStandardItem* child = CreateSongItem(song); search_->appendRow(child); } QModelIndex index = model()->merged_model()->mapFromSource(search_->index()); ScrollToIndex(index); }
void SpotifyService::SearchResults( const pb::spotify::SearchResponse& response) { if (QStringFromStdString(response.request().query()) != pending_search_) { qLog(Debug) << "Old search result for" << QStringFromStdString(response.request().query()) << "expecting" << pending_search_; return; } pending_search_.clear(); SongList songs; for (int i = 0; i < response.result_size(); ++i) { Song song; SongFromProtobuf(response.result(i), &song); songs << song; } qLog(Debug) << "Got" << songs.count() << "results"; ClearSearchResults(); // Fill results list for (const Song& song : songs) { QStandardItem* child = CreateSongItem(song); search_->appendRow(child); } const QString did_you_mean_suggestion = QStringFromStdString(response.did_you_mean()); qLog(Debug) << "Did you mean suggestion: " << did_you_mean_suggestion; if (!did_you_mean_suggestion.isEmpty()) { search_box_->did_you_mean()->Show(did_you_mean_suggestion); } else { // In case something else was previously displayed search_box_->did_you_mean()->hide(); } QModelIndex index = model()->merged_model()->mapFromSource(search_->index()); ScrollToIndex(index); }
nsresult nsListBoxBodyFrame::ScrollByLines(PRInt32 aNumLines) { PRInt32 scrollIndex, visibleRows; GetIndexOfFirstVisibleRow(&scrollIndex); GetNumberOfVisibleRows(&visibleRows); scrollIndex += aNumLines; if (scrollIndex < 0) scrollIndex = 0; else { PRInt32 numRows = GetRowCount(); PRInt32 lastPageTopRow = numRows - visibleRows; if (scrollIndex > lastPageTopRow) scrollIndex = lastPageTopRow; } ScrollToIndex(scrollIndex); return NS_OK; }