Beispiel #1
0
void CATextField::moveSelectChars(bool isLeftBtn, const CCPoint& pt)
{
	int l, r, p;
	calculateSelChars(convertToNodeSpace(pt), l, r, p);

	if (isLeftBtn)
	{
		if (p < m_curSelCharRange.second)
			m_curSelCharRange.first = p;
	}
	else
	{
		if (p > m_curSelCharRange.first)
			m_curSelCharRange.second = p;
	}

	m_iString_l_length = l;
	m_iString_r_length = r;
	bool isBackward = p < m_iCurPos;
	m_iCurPos = p;
	adjustCursorMove(!isBackward);
	CATextSelectView* pSelCharsView = CATextSelectView::create();
	bool ll, rr;
	CCRect cc = convertRectToWorldSpace(getZZCRect(&ll, &rr));
	pSelCharsView->showTextSelView(cc, this, ll, rr);
	this->hideCursorMark();
}
Beispiel #2
0
void CATextField::ccStartSelect()
{
	if (m_nInputType == KEY_BOARD_INPUT_PASSWORD)
		return;

	if (m_sText.empty())
		return;

	int index = getStringCharCount(m_sText.substr(0, m_iCurPos));
	if (index == 0)
	{
		m_curSelCharRange.first = m_iCurPos;
		m_curSelCharRange.second = m_iCurPos + m_vTextFiledChars.front().charSize;
	}
	else
	{
		m_curSelCharRange.first = m_iCurPos - m_vTextFiledChars[index - 1].charSize;
		m_curSelCharRange.second = m_iCurPos;
	}

	CATextSelectView* pSelCharsView = CATextSelectView::create();
	bool l, r;
	CCRect cc = getZZCRect(&l, &r);
	pSelCharsView->showTextSelView(convertRectToWorldSpace(cc), this, l, r);
	m_pCursorMark->setVisible(false);

//	CATextArrowView::hideTextArrowView();
}
Beispiel #3
0
void CATextField::selectAll()
{
	if (m_nInputType == KEY_BOARD_INPUT_PASSWORD)
		return;

	m_curSelCharRange.first = 0;
	m_curSelCharRange.second = m_iCurPos = (int)m_sText.length();

	CATextSelectView* pSelCharsView = CATextSelectView::create();
	bool l, r;
	CCRect cc = getZZCRect(&l, &r);
	pSelCharsView->showTextSelView(convertRectToWorldSpace(cc), this, l, r);
	this->hideCursorMark();
}