Beispiel #1
0
ContactsBox::ContactsBox() : _scroll(this, st::newGroupScroll), _inner(),
	_addContact(this, lang(lng_add_contact_button), st::contactsAdd),
	_filter(this, st::contactsFilter, lang(lng_participant_filter)),
	_close(this, lang(lng_contacts_done), st::contactsClose),
	_hiding(false), a_opacity(0, 1) {

	_width = st::participantWidth;
	_height = App::wnd()->height() - st::boxPadding.top() - st::boxPadding.bottom();
	if (_height > st::participantMaxHeight) _height = st::participantMaxHeight;

	resize(_width, _height);

	_scroll.setWidget(&_inner);
	_scroll.setFocusPolicy(Qt::NoFocus);

	connect(&_addContact, SIGNAL(clicked()), App::wnd(), SLOT(onShowAddContact()));
	connect(&_close, SIGNAL(clicked()), this, SLOT(onClose()));
	connect(&_scroll, SIGNAL(scrolled()), &_inner, SLOT(updateSel()));
	connect(&_scroll, SIGNAL(scrolled()), this, SLOT(onScroll()));
	connect(&_filter, SIGNAL(changed()), this, SLOT(onFilterUpdate()));
	connect(&_filter, SIGNAL(cancelled()), this, SLOT(onClose()));
	connect(&_inner, SIGNAL(mustScrollTo(int,int)), &_scroll, SLOT(scrollToY(int,int)));

	showAll();
	_cache = myGrab(this, rect());
	hideAll();
}
AddParticipantBox::AddParticipantBox(ChatData *chat) :
	_scroll(this, st::newGroupScroll), _inner(chat),
	_filter(this, st::contactsFilter, lang(lng_participant_filter)),
	_invite(this, lang(lng_participant_invite), st::btnSelectDone),
	_cancel(this, lang(lng_cancel), st::btnSelectCancel),
	_hiding(false), a_opacity(0, 1), af_opacity(anim::linear) {

	_width = st::participantWidth;
	_height = App::wnd()->height() - st::boxPadding.top() - st::boxPadding.bottom();
	if (_height > st::participantMaxHeight) _height = st::participantMaxHeight;

	resize(_width, _height);

	_scroll.setWidget(&_inner);
	_scroll.setFocusPolicy(Qt::NoFocus);

	connect(&_invite, SIGNAL(clicked()), this, SLOT(onInvite()));
	connect(&_cancel, SIGNAL(clicked()), this, SIGNAL(closed()));
	connect(&_scroll, SIGNAL(scrolled()), &_inner, SLOT(updateSel()));
	connect(&_scroll, SIGNAL(scrolled()), this, SLOT(onScroll()));
	connect(&_filter, SIGNAL(changed()), this, SLOT(onFilterUpdate()));
	connect(&_filter, SIGNAL(cancelled()), this, SIGNAL(onClose()));
	connect(&_inner, SIGNAL(mustScrollTo(int,int)), &_scroll, SLOT(scrollToY(int,int)));
	connect(&_inner, SIGNAL(selectAllQuery()), &_filter, SLOT(selectAll()));

	showAll();
	_cache = myGrab(this, rect());
	hideAll();
}
ProfileWidget::ProfileWidget(QWidget *parent, const PeerData *peer) : QWidget(parent),
	_inner(this, &_scroll, peer), _scroll(this, st::setScroll), _showing(false) {
	_scroll.setWidget(&_inner);
	_scroll.move(0, 0);
	_inner.move(0, 0);
	_scroll.show();
	connect(&_scroll, SIGNAL(scrolled()), &_inner, SLOT(updateSelected()));
	connect(&_scroll, SIGNAL(scrolled()), this, SLOT(onScroll()));
}
Beispiel #4
0
void qtauMeterBar::wheelEvent(QWheelEvent *event)
{
    if (event->modifiers() & Qt::ControlModifier)
        emit zoomed(event->delta());
    else
        emit scrolled(event->delta());
}
Beispiel #5
0
void NMainWindow::wheelEvent(QWheelEvent *event)
{
    QDialog::wheelEvent(event);

    if (event->orientation() == Qt::Vertical)
        emit scrolled(event->delta());
}
Beispiel #6
0
void ScrollArea::onScrolled() {
	myEnsureResized(widget());

	bool em = false;
	int32 horValue = horizontalScrollBar()->value(), vertValue = verticalScrollBar()->value();
	if (_horValue != horValue) {
		if (_disabled) {
			horizontalScrollBar()->setValue(_horValue);
		} else {
			_horValue = horValue;
			if (_st.hiding) {
				hor.hideTimeout(_st.hiding);
			}
			em = true;
		}
	}
	if (_vertValue != vertValue) {
		if (_disabled) {
			verticalScrollBar()->setValue(_vertValue);
		} else {
			_vertValue = vertValue;
			if (_st.hiding) {
				vert.hideTimeout(_st.hiding);
			}
			em = true;
		}
	}
	if (em) emit scrolled();
}
Beispiel #7
0
ScrollArea::ScrollArea(QWidget *parent, const style::flatScroll &st, bool handleTouch) : QScrollArea(parent),
    _st(st),
	hor(this, false, &_st), vert(this, true, &_st), topSh(this, &_st), bottomSh(this, &_st),
    _touchEnabled(handleTouch), _touchScroll(false), _touchPress(false), _touchRightButton(false),
	_touchScrollState(TouchScrollManual), _touchPrevPosValid(false), _touchWaitingAcceleration(false),
    _touchSpeedTime(0), _touchAccelerationTime(0), _touchTime(0), _widgetAcceptsTouch(false) {
	connect(horizontalScrollBar(), SIGNAL(valueChanged(int)), this, SIGNAL(scrolled()));
	connect(verticalScrollBar(), SIGNAL(valueChanged(int)), this, SIGNAL(scrolled()));
	connect(&vert, SIGNAL(topShadowVisibility(bool)), &topSh, SLOT(changeVisibility(bool)));
	connect(&vert, SIGNAL(bottomShadowVisibility(bool)), &bottomSh, SLOT(changeVisibility(bool)));
	if (_st.hiding) {
		connect(this, SIGNAL(scrolled()), this, SLOT(onScrolled()));
	}

	setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

	setFrameStyle(QFrame::NoFrame | QFrame::Plain);
	viewport()->setAutoFillBackground(false);

	_horValue = horizontalScrollBar()->value();
	_vertValue = verticalScrollBar()->value();

	if (_touchEnabled) {
		viewport()->setAttribute(Qt::WA_AcceptTouchEvents);
		_touchTimer.setSingleShot(true);
		connect(&_touchTimer, SIGNAL(timeout()), this, SLOT(onTouchTimer()));
		connect(&_touchScrollTimer, SIGNAL(timeout()), this, SLOT(onTouchScrollTimer()));
	}
}
Beispiel #8
0
StickerSetBox::StickerSetBox(const MTPInputStickerSet &set) : ScrollableBox(st::stickersScroll), _inner(set),
_close(this, st::btnStickersClose),
_addStickers(this, lng_stickers_add_pack(lt_count, 0), st::btnStickersAdd),
_shareStickers(this, lang(lng_stickers_share_pack), st::btnStickersAdd),
_closeStickers(this, lang(lng_close), st::btnStickersAdd) {
	resize(st::stickersWidth, height());
	setMaxHeight(st::stickersMaxHeight);
	connect(App::main(), SIGNAL(stickersUpdated()), this, SLOT(onStickersUpdated()));

	init(&_inner, 0, st::boxFont->height + st::newGroupNamePadding.top() + st::newGroupNamePadding.bottom());

	connect(&_close, SIGNAL(clicked()), this, SLOT(onClose()));
	connect(&_addStickers, SIGNAL(clicked()), this, SLOT(onAddStickers()));
	connect(&_shareStickers, SIGNAL(clicked()), this, SLOT(onShareStickers()));
	connect(&_closeStickers, SIGNAL(clicked()), this, SLOT(onClose()));

	connect(&_inner, SIGNAL(updateButtons()), this, SLOT(onUpdateButtons()));
	connect(&_scroll, SIGNAL(scrolled()), this, SLOT(onScroll()));

	connect(&_inner, SIGNAL(installed(uint64)), this, SIGNAL(installed(uint64)));

	onStickersUpdated();

	onScroll();

	prepare();
}
Beispiel #9
0
void ScrollArea::onScrolled() {
	myEnsureResized(widget());

	bool em = false;
	int horizontalValue = horizontalScrollBar()->value();
	int verticalValue = verticalScrollBar()->value();
	if (_horizontalValue != horizontalValue) {
		if (_disabled) {
			horizontalScrollBar()->setValue(_horizontalValue);
		} else {
			_horizontalValue = horizontalValue;
			if (_st.hiding) {
				_horizontalBar->hideTimeout(_st.hiding);
			}
			em = true;
		}
	}
	if (_verticalValue != verticalValue) {
		if (_disabled) {
			verticalScrollBar()->setValue(_verticalValue);
		} else {
			_verticalValue = verticalValue;
			if (_st.hiding) {
				_verticalBar->hideTimeout(_st.hiding);
			}
			em = true;
		}
	}
	if (em) {
		emit scrolled();
		if (!_movingByScrollBar) {
			sendSynteticMouseEvent(this, QEvent::MouseMove, Qt::NoButton);
		}
	}
}
Beispiel #10
0
CountrySelect::CountrySelect() : QWidget(App::wnd()),
	_result("none"),
    _filter(this, st::inpCountry, lang(lng_country_ph)), _scroll(this, st::scrollCountries), _list(&_scroll),
    _doneButton(this, lang(lng_country_done), st::btnSelectDone),
    _cancelButton(this, lang(lng_cancel), st::btnSelectCancel),
    _innerLeft(0), _innerTop(0), _innerWidth(0), _innerHeight(0),
	a_alpha(0), a_bgAlpha(0), a_coord(st::countriesSlideShift), _shadow(st::boxShadow) {
	setGeometry(App::wnd()->rect());
	
	App::wnd()->topWidget(this);

	connect(App::wnd(), SIGNAL(resized(const QSize &)), this, SLOT(onParentResize(const QSize &)));
	connect(&_doneButton, SIGNAL(clicked()), this, SLOT(onCountryChoose()));
	connect(&_cancelButton, SIGNAL(clicked()), this, SLOT(onCountryCancel()));
	connect(&_scroll, SIGNAL(scrollFinished()), this, SLOT(onScrollFinished()));
	connect(&_scroll, SIGNAL(geometryChanged()), &_list, SLOT(onParentGeometryChanged()));
	connect(&_scroll, SIGNAL(scrolled()), &_list, SLOT(onUpdateSelected()));
	connect(&_list, SIGNAL(countrySelected()), this, SLOT(onCountryChoose()));
	connect(&_filter, SIGNAL(changed()), this, SLOT(onFilterUpdate()));
	connect(&_list, SIGNAL(mustScrollTo(int, int)), &_scroll, SLOT(scrollToY(int, int)));

	show();
	setFocus();
	_scroll.setWidget(&_list);
	_scroll.setFocusPolicy(Qt::NoFocus);

	prepareAnimation(0);
}
InnerDropdown::InnerDropdown(
	QWidget *parent,
	const style::InnerDropdown &st)
: RpWidget(parent)
, _st(st)
, _scroll(this, _st.scroll) {
	_hideTimer.setSingleShot(true);
	connect(&_hideTimer, SIGNAL(timeout()), this, SLOT(onHideAnimated()));

	connect(_scroll, SIGNAL(scrolled()), this, SLOT(onScroll()));

	hide();

	shownValue(
	) | rpl::filter([](bool shown) {
		return shown;
	}) | rpl::take(1) | rpl::map([=] {
		// We can't invoke this before the window is created.
		// So instead we start handling them on the first show().
		return macWindowDeactivateEvents();
	}) | rpl::flatten_latest(
	) | rpl::filter([=] {
		return !isHidden();
	}) | rpl::start_with_next([=] {
		leaveEvent(nullptr);
	}, lifetime());
}
Beispiel #12
0
void KTabBar::rightClicked()
{
  if(ptab->tpos == 0)
    ptab->tpos -= (2 * JUMP);
  else
    ptab->tpos -= JUMP;
  QResizeEvent e(size(), size());
  resizeEvent(&e);
  emit scrolled( LeftArrow );
}
Beispiel #13
0
void KTabBar::leftClicked()
{
  if(ptab->tpos == (0-(2*JUMP)))
    ptab->tpos += (2 * JUMP);
  else
    ptab->tpos += JUMP;
  QResizeEvent e(size(), size());
  resizeEvent(&e);
  emit scrolled( RightArrow );
}
Beispiel #14
0
void BoxContent::finishScrollCreate() {
	Expects(_scroll != nullptr);

	if (!_scroll->isHidden()) {
		_scroll->show();
	}
	updateScrollAreaGeometry();
	connect(_scroll, SIGNAL(scrolled()), this, SLOT(onScroll()));
	connect(_scroll, SIGNAL(innerResized()), this, SLOT(onInnerResize()));
}
Beispiel #15
0
InnerDropdown::InnerDropdown(QWidget *parent, const style::InnerDropdown &st) : TWidget(parent)
, _st(st)
, _scroll(this, _st.scroll) {
	_hideTimer.setSingleShot(true);
	connect(&_hideTimer, SIGNAL(timeout()), this, SLOT(onHideAnimated()));

	connect(_scroll, SIGNAL(scrolled()), this, SLOT(onScroll()));

	if (cPlatform() == dbipMac || cPlatform() == dbipMacOld) {
		connect(App::wnd()->windowHandle(), SIGNAL(activeChanged()), this, SLOT(onWindowActiveChanged()));
	}

	hide();
}
void ScreenWindow::scrollTo( int line )
{
    int maxCurrentLineNumber = lineCount() - windowLines();
    line = qBound(0,line,maxCurrentLineNumber);

    const int delta = line - _currentLine;
    _currentLine = line;

    // keep track of number of lines scrolled by,
    // this can be reset by calling resetScrollCount()
    _scrollCount += delta;

    _bufferNeedsUpdate = true;

    emit scrolled(_currentLine);
}
Beispiel #17
0
CountrySelectBox::CountrySelectBox() : ItemListBox(st::countriesScroll, st::boxWidth)
, _inner()
, _filter(this, st::boxSearchField, lang(lng_country_ph))
, _filterCancel(this, st::boxSearchCancel)
, _topShadow(this) {
	ItemListBox::init(&_inner, st::boxScrollSkip, st::boxTitleHeight + _filter.height());

	connect(&_scroll, SIGNAL(scrolled()), &_inner, SLOT(updateSel()));
	connect(&_filter, SIGNAL(changed()), this, SLOT(onFilterUpdate()));
	connect(&_filter, SIGNAL(submitted(bool)), this, SLOT(onSubmit()));
	connect(&_filterCancel, SIGNAL(clicked()), this, SLOT(onFilterCancel()));
	connect(&_inner, SIGNAL(mustScrollTo(int, int)), &_scroll, SLOT(scrollToY(int, int)));
	connect(&_inner, SIGNAL(countryChosen(const QString&)), this, SIGNAL(countryChosen(const QString&)));

	_filterCancel.setAttribute(Qt::WA_OpaquePaintEvent);

	prepare();
}
Beispiel #18
0
Widget::Widget(QWidget *parent, PeerData *peer) : Window::SectionWidget(parent)
, _scroll(this, st::setScroll)
, _inner(this, peer)
, _fixedBar(this, peer)
, _fixedBarShadow(this, st::shadowColor) {
	_fixedBar->move(0, 0);
	_fixedBar->resizeToWidth(width());
	_fixedBar->show();

	_fixedBarShadow->setMode(ToggleableShadow::Mode::HiddenFast);
	_fixedBarShadow->raise();
	updateAdaptiveLayout();

	_scroll->setOwnedWidget(_inner);
	_scroll->move(0, _fixedBar->height());
	_scroll->show();

	connect(_scroll, SIGNAL(scrolled()), this, SLOT(onScroll()));
	connect(_inner, SIGNAL(cancelled()), _fixedBar, SLOT(onBack()));
}
Beispiel #19
0
void ScreenWindow::scrollTo( int line )
{
    //kDebug() << "ScreenWindow scrolled to " << line << ":" << this;
    if ( line < 0 )
       line = 0;

    if ( (lineCount() - windowLines()) < line )
       line = qMax(0,lineCount() - windowLines()); 

    const int delta = line - _currentLine;

    _currentLine = line;

    // keep track of number of lines scrolled by,
    // this can be reset by calling resetScrollCount()
    _scrollCount += delta;

	_bufferNeedsUpdate = true;

    emit scrolled(_currentLine);
}
Beispiel #20
0
void KNoteBook::init()
{
  //debug("KNoteBook::init");
  sections = new QList<KWizard>;
  sections->setAutoDelete(true);
  pnote = new KNoteBookProtected;
  pnote->directionsreflectspage = pnote->enablepopupmenu = pnote->enablearrowbuttons = false;
  pnote->current = -1;
  pnote->numtabs = 0;
  pnote->currentwiz = 0L;
  pnote->ok = pnote->cancel = pnote->def = pnote->help = 0L;
  pnote->tabbar = new KTabBar(this);
  connect( pnote->tabbar, SIGNAL(selected(int)), SLOT( showSection(int)) );
  connect( pnote->tabbar, SIGNAL(scrolled(ArrowType)),
                   SLOT( tabScroll(ArrowType)) );
  //debug("tabbar");
  pnote->menu = new QPopupMenu();
  connect( pnote->menu, SIGNAL(highlighted(int)), SLOT( menuChoice(int)) );
  connect( pnote->menu, SIGNAL(activatedRedirect(int)), SLOT( menuChoiceRedirect(int)) );

  //debug("init - done");
}
Beispiel #21
0
void ClickableLabel::wheelEvent(QWheelEvent * e)
{
    emit scrolled(e->delta());
}
Beispiel #22
0
bool BaseWidget::scroll_callback(double xdiff, double ydiff) {
    double mx, my;
    display_get_cursor_position(&mx, &my);
    return scrolled((int)mx, (int)my, ydiff * 30);
}
void cVerticalScrollbar::onScroll(int oldpos) {
	emit scrolled(pos_);
}
void cHorizontalScrollbar::onScroll(int oldpos) {	
	emit scrolled(pos_);
}
Beispiel #25
0
void qtauPiano::wheelEvent(QWheelEvent *event)
{
    emit scrolled(event->delta());
}
Beispiel #26
0
void MyGraphicsView::scrollEvent()
{
    emit scrolled();
}
Beispiel #27
0
void LargeTable::wheelEvent(QWheelEvent *event) {
    // Ignoring the event does not seem to help in delivering it to the
    // LargeTableView, so we deliver it ourselves
    emit scrolled(event);
    event->accept();
}
void dtkComposerCompass::setView(dtkComposerView *view)
{
    d->view = view;

    connect(d->view, SIGNAL(scrolled()), this, SLOT(update()));
}
Beispiel #29
0
void HaiQTextEdit::scrollContentsBy ( int dx, int dy ) {
	QTextEdit::scrollContentsBy(dx,dy);
	emit scrolled();
}