Exemple #1
0
void CNavButton::onMouseWheel (CPoint /*pt*/, int delta, xl::uint /*key*/) {
	if (delta > 0) {
		_GetTarget()->onCommand(ID_NAV_PREV, shared_from_this());
	} else {
		_GetTarget()->onCommand(ID_NAV_NEXT, shared_from_this());
	}
}
Exemple #2
0
void CCtrlGesture::drawMe (HDC hdc) {
	if (m_points.size() <= 1) {
		return;
	}

	CResMgr *pResMgr = CResMgr::getInstance();
	CRect rc = getClientRect();

	CDCHandle dc(hdc);
	if (m_gestureLineWidth > 0) {
		// HPEN pen = ::CreatePen(PS_SOLID, m_gestureLineWidth, _GetColor());
		HPEN pen = pResMgr->getPen(PS_SOLID, (xl::ushort)m_gestureLineWidth, _GetColor());
		HPEN oldPen = dc.SelectPen(pen);

		dc.Polyline(&m_points[0], m_points.size());

		dc.SelectPen(oldPen);
		// ::DeleteObject(pen);
	}

	assert(_GetTarget() != NULL);
	tstring text = m_gesture;
	text += _T(" (");
	text += _GetTarget()->onGesture(m_isTimeout ? _T("canceled") : m_gesture, m_points[0], false);
	text += _T(")");

	// rc.top = rc.bottom - 20;
	COLORREF oldColor = dc.SetTextColor(_GetColor());
	HFONT oldFont = dc.SelectFont(_GetFont());
	dc.drawTransparentText(text, text.length(), rc, DT_CENTER | DT_BOTTOM | DT_SINGLELINE);
	dc.SelectFont(oldFont);
	dc.SetTextColor(oldColor);
}
Exemple #3
0
void CCtrlGesture::onRButtonUp (CPoint pt, uint key) {
	assert(m_pCtrlMain->getCaptureCtrl() == shared_from_this());
	assert(m_points.size() > 0);

	CPoint ptDown = m_points[0];
	bool pass2background = m_points.size() == 1;
	tstring gesture = m_gesture;
	bool isTimeout = m_isTimeout;
	CCtrlTarget *pTarget = _GetTarget(); // save it before removed from control main
	assert(pTarget != NULL);
	
	_Capture(false);
	m_pCtrlMain->removeChild(m_id);
	m_points.clear();
	m_gesture.clear();
	m_isTimeout = false;

	if (::GetTickCount() - m_lastMove < m_gestureTimeout && !isTimeout) {
		pTarget->onGesture(gesture, ptDown, true);
		m_lastMove = 0;
	} else if (pass2background && !isTimeout) {
		CControlPtr ctrl = m_pCtrlMain->getControlByPoint(ptDown);
		if (ctrl != NULL) {
			ctrl->onRButtonDown(ptDown, key);
		}

		ctrl = m_pCtrlMain->getControlByPoint(pt);
		if (ctrl != NULL) {
			ctrl->onRButtonUp(pt, key);
		}
	}
}
Exemple #4
0
void CCtrlButton::onLButtonUp (CPoint pt, uint /*key*/) {
	if (disable) {
		if (_GetMainCtrl()->getCaptureCtrl() == shared_from_this()) {
			_Capture(false);
		}
		return;
	}
	_Capture(false);
	m_pushAndCapture = false;
	invalidate();

	assert (_GetTarget() != NULL);
	if (isPointIn(pt)) {
		_GetTarget()->onCommand(m_id, shared_from_this());
	}
}