void ColorDropDownPopup::mousePressEvent(Widgets::MouseEvent *event) { if(event->button() == Widgets::LeftButton && event->pos().x < SLICE_W) { event->accept(); int selected = (event->pos().y+_scroll)/SLICE_H; selectionChanged.emit(selected); close(); } else if(event->button() == Widgets::WheelUpButton) { setScroll(_scroll-10); event->accept(); } else if(event->button() == Widgets::WheelDownButton) { setScroll(_scroll+10); event->accept(); } }
void MapWindow::mapMove(int dx, int dy) { int hValue = m_horizontalScrollBar->value() + dx; int vValue = m_verticalScrollBar->value() + dy; disconnect(m_horizontalScrollBar, &QAbstractSlider::valueChanged, m_canvas, &MapCanvas::setHorizontalScroll); disconnect(m_verticalScrollBar, &QAbstractSlider::valueChanged, m_canvas, &MapCanvas::setVerticalScroll); m_horizontalScrollBar->setValue(hValue); m_verticalScrollBar->setValue(vValue); emit setScroll(hValue, vValue); connect(m_horizontalScrollBar, &QAbstractSlider::valueChanged, m_canvas, &MapCanvas::setHorizontalScroll); connect(m_verticalScrollBar, &QAbstractSlider::valueChanged, m_canvas, &MapCanvas::setVerticalScroll); }
void MapWindow::scrollTimerTimeout() { qint32 vValue = m_verticalScrollBar->value() + m_verticalScrollStep; qint32 hValue = m_horizontalScrollBar->value() + m_horizontalScrollStep; disconnect(m_horizontalScrollBar, &QAbstractSlider::valueChanged, m_canvas, &MapCanvas::setHorizontalScroll); disconnect(m_verticalScrollBar, &QAbstractSlider::valueChanged, m_canvas, &MapCanvas::setVerticalScroll); m_horizontalScrollBar->setValue(hValue); m_verticalScrollBar->setValue(vValue); emit setScroll(hValue, vValue); connect(m_horizontalScrollBar, &QAbstractSlider::valueChanged, m_canvas, &MapCanvas::setHorizontalScroll); connect(m_verticalScrollBar, &QAbstractSlider::valueChanged, m_canvas, &MapCanvas::setVerticalScroll); }
void HistoryBuffer::add(const unsigned char* bytes, int len) { int rc; assert(hasScroll()); rc = lseek(ion,length,SEEK_SET); if (rc < 0) { perror("HistoryBuffer::add.seek"); setScroll(FALSE); return; } rc = write(ion,bytes,len); if (rc < 0) { perror("HistoryBuffer::add.write"); setScroll(FALSE); return; } length += rc; }
void HistoryBuffer::get(unsigned char* bytes, int len, int loc) { int rc; assert(hasScroll()); if (loc < 0 || len < 0 || loc + len > length) fprintf(stderr,"getHist(...,%d,%d): invalid args.\n",len,loc); rc = lseek(ion,loc,SEEK_SET); if (rc < 0) { perror("HistoryBuffer::get.seek"); setScroll(FALSE); return; } rc = read(ion,bytes,len); if (rc < 0) { perror("HistoryBuffer::get.read"); setScroll(FALSE); return; } }
void VTTRegion::updateParametersFromRegion(VTTRegion* region) { m_heightInLines = region->height(); m_width = region->width(); m_regionAnchor = FloatPoint(region->regionAnchorX(), region->regionAnchorY()); m_viewportAnchor = FloatPoint(region->viewportAnchorX(), region->viewportAnchorY()); setScroll(region->scroll(), ASSERT_NO_EXCEPTION); }
void TextLabel::setScroll(const QString &a, const QPoint &speed, int gap, int pause) { ScrollType t = TextLabel::ScrollNone; QString scroll = a.toUpper(); if (scroll == "NONE") scroll = TextLabel::ScrollNone; else if (a == "NORMAL") scroll = TextLabel::ScrollNormal; else if (a == "BACKANDFORTH") scroll = TextLabel::ScrollBackAndForth; else if (a == "ONEPASS") scroll = TextLabel::ScrollOnePass; setScroll(t, speed, gap, pause); }
int PlayListWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QTreeWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: playListEmpty(); break; case 1: playItem((*reinterpret_cast< PlayListItem*(*)>(_a[1]))); break; case 2: addFile((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; case 3: addFile((*reinterpret_cast< QString(*)>(_a[1]))); break; case 4: addFile((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QMap<QString,QString>(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3]))); break; case 5: addFile((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QMap<QString,QString>(*)>(_a[2]))); break; case 6: { int _r = addDir((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; } break; case 7: { int _r = addDir((*reinterpret_cast< QString(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; } break; case 8: removeSelected(); break; case 9: doubleClicked((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; case 10: scrollToActive(); break; case 11: deselect((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; case 12: clearPlayList(); break; case 13: { int _r = loadM3UPlayList((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; } break; case 14: { int _r = loadM3UPlayList((*reinterpret_cast< QString(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; } break; case 15: { int _r = loadPLSPlayList((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; } break; case 16: { int _r = loadPLSPlayList((*reinterpret_cast< QString(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; } break; case 17: saveM3UPlayList((*reinterpret_cast< QString(*)>(_a[1]))); break; case 18: savePLSPlayList((*reinterpret_cast< QString(*)>(_a[1]))); break; case 19: updateColumnWidth((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3]))); break; case 20: updateColumnPosition((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3]))); break; case 21: headerContextMenu((*reinterpret_cast< const QPoint(*)>(_a[1]))); break; case 22: setScroll(); break; case 23: hideSection(); break; case 24: showSection(); break; case 25: printPos((*reinterpret_cast< int(*)>(_a[1]))); break; default: ; } _id -= 26; } return _id; }
void MainWindow::setParams() { setBrightnessMax(eep[EEPROM_BR_MAX]); sbxBrmax->setValue(eep[EEPROM_BR_MAX]); setScroll(eep[EEPROM_SCROLL_INTERVAL]); sbxScroll->setValue(eep[EEPROM_SCROLL_INTERVAL]); cbxHoursignal->setChecked(eep[EEPROM_HOURSIGNAL]); cbxRotate->setChecked(eep[EEPROM_SCREEN_ROTATE]); cbxFontsize->setChecked(eep[EEPROM_BIGNUM]); cbxHourzero->setChecked(eep[EEPROM_HOURZERO]); cbxBmpTemp->setChecked(eep[EEPROM_SENS_MASK] & SENS_MASK_BMP_TEMP); cbxDhtTemp->setChecked(eep[EEPROM_SENS_MASK] & SENS_MASK_DHT_TEMP); cbxBmpPres->setChecked(eep[EEPROM_SENS_MASK] & SENS_MASK_BMP_PRES); cbxDhtHumi->setChecked(eep[EEPROM_SENS_MASK] & SENS_MASK_DHT_HUMI); }
HistoryBuffer::~HistoryBuffer() { setScroll(FALSE); }
void pHexEdit::setColumns(unsigned columns) { setScroll(); update(); }
void pHexEdit::setRows(unsigned rows) { setScroll(); update(); }
void pHexEdit::setOffset(unsigned offset) { setScroll(); updateScroll(); update(); }
void pHexEdit::setLength(unsigned length) { setScroll(); update(); }
int main() { float scrollPos = 0.0f; float scrollDir = 0.0f const float scrollFriction = 0.9f; const float clampFriction = 0.9f; int dragAnchor = 0; bool draging = false; int prevDragAnchor = 0; float maxScrollPos = 100; while (1) { scanKeys(); // process input int down = keysDown(); int up = keysUp(); touchPosition touchPos; touchRead(&touchPos); if (down & KEY_TOUCH) { // always stop when tapping the screen scrollDir = 0.0f; if (touchPos.px < SCREEN_WIDTH / 2) { prevDragAnchor = dragAnchour = touchPos.py; draging = true; } else { int canvasPos = touchPos.py - scrollPos; int entry = canvasPos / ENTRY_HEIGHT; selectEntry(entry); } } else if (up & KEY_TOUCH) { draging = false; } // animate if (!draging) { scrollPos += scrollDir; scrollDir *= scrollFriction; if (fabs(scrollDir) < 0.01f) scrollDir = 0.0f; if (scrollPos < 0.0f) { // clamp to start scrollDir = 0.0f; scrollPos *= clampFriction; } else if (scrollPos > maxScrollPos) { // clamp to end scrollDir = 0.0f; scrollPos = scrollPos + (maxScrollPos - scrollPos) * clampFriction; } setScroll(int(scrollPos)); } else { setScroll(touchPos.py - dragAnchor); // track scrollDir scrollDir += touchPos.py - prevDragAnchor; scrollDir *= scrollFriction; prevDragAnchor = dragAnchor; } swiWaitForVBlank(); } }