コード例 #1
0
ファイル: CATextField.cpp プロジェクト: hawkchch/CrossApp
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();
}
コード例 #2
0
ファイル: CATextField.cpp プロジェクト: Super-Man/CrossApp
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();
}
コード例 #3
0
ファイル: CATextEditHelper.cpp プロジェクト: garyyyy/CrossApp
CATextSelectView *CATextSelectView::create()
{
	CATextSelectView *pTextSelView = new CATextSelectView();
	if (pTextSelView && pTextSelView->init())
	{
		pTextSelView->autorelease();
		return pTextSelView;
	}
	CC_SAFE_DELETE(pTextSelView);
	return pTextSelView;
}
コード例 #4
0
ファイル: CATextEditHelper.cpp プロジェクト: garyyyy/CrossApp
void CATextSelectView::hideTextSelectView()
{
	CATextSelectView* pSelTextView = NULL;
	if (CAWindow *rootWindow = CAApplication::getApplication()->getRootWindow())
	{
		pSelTextView = (CATextSelectView*)rootWindow->getSubviewByTextTag("CATextSelectView");
	}
	if (pSelTextView)
	{
		pSelTextView->hideTextSelView();
	}
}
コード例 #5
0
ファイル: CATextField.cpp プロジェクト: hawkchch/CrossApp
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();
}