Пример #1
0
void SmoothToolTip::leave() {
	m_hover        = false;
	m_hoverPreview = NULL;

	stopScrollAnimation();

	itemLeave(m_hoverItem);
}
Пример #2
0
void SmoothToolTip::clear() {
	stopScrollAnimation(true);

	Plasma::WindowEffects::showWindowThumbnails(m_widget->winId());

	m_hoverPreview = NULL;
	QBoxLayout *layout = qobject_cast<QBoxLayout*>(m_widget->layout());

	foreach (WindowPreview* preview, m_previews) {
		preview->hide();
		layout->removeWidget(preview);
		delete preview;
	}
void Pull2RefreshTableView::onPullUpRefresh()
{
	Pull2RefreshTableViewDelegate* pDelegate = getDelegate();
	if (pDelegate && pDelegate->onPullUpRefresh(this))
	{
		if (m_pFooter)
		{
			stopScrollAnimation();
			float fOffsetY = getViewSize().height - getContentSize().height;
			fOffsetY = fOffsetY < 0 ? 0 : fOffsetY;
			CCPoint offset = ccp(0, fOffsetY + m_pFooter->getContentSize().height);
			this->setContentOffsetInDuration(offset, 0.2f);
		}
	}
}
void Pull2RefreshTableView::onPullDownRefresh()
{
	Pull2RefreshTableViewDelegate* pDelegate = getDelegate();
	if (pDelegate && pDelegate->onPullDownRefresh(this))
	{
		if (m_pHeader)
		{
			// set header node show in offset
			// CCLOG("view.height=%0.2f, container.height=%0.2f, header.height=%0.2f, offset.y=%0.2f", getViewSize().height, getContentSize().height, m_pHeader->getContentSize().height, getContentOffset().y);
			stopScrollAnimation();
			CCPoint offset = ccp(0, getViewSize().height - getContentSize().height - m_pHeader->getContentSize().height);
			this->setContentOffsetInDuration(offset, 0.2f);
		}
	}
}
Пример #5
0
void SmoothToolTip::animateScroll(qreal progress) {
	int x = m_xStart + (int)(progress * m_dx);
	int y = m_yStart + (int)(progress * m_dy);
	m_widget->move(x, y);
	
	if (m_moveAnimationUpdated && !m_hoverItem.isNull()) {
		QPoint pos = m_hoverItem->popupPosition(m_widget->size(), true, NULL);
	
		int dx = pos.x() - x;
		int dy = pos.y() - y;

		if ((dx <= 0.0 && m_dx >= 0.0) || (dx >= 0.0 && m_dx <= 0.0) ||
			(dy <= 0.0 && m_dy >= 0.0) || (dy >= 0.0 && m_dy <= 0.0)) {
			stopScrollAnimation(true);
			moveBesideTaskItem(m_shown);
		}
	}
}
Пример #6
0
SmoothToolTip::~SmoothToolTip() {
	stopScrollAnimation(true);
	m_widget->hide();
	delete m_widget;
	m_widget = NULL;
}