Пример #1
0
bool CATextSelViewEx::ccTouchBegan(CATouch *pTouch, CAEvent *pEvent)
{
	CCPoint cTouchPoint = this->convertTouchToNodeSpace(pTouch);
    
	CCRect newRectL = m_pCursorMarkL->getFrame();
	newRectL.InflateRect(8);
	CCRect newRectR = m_pCursorMarkR->getFrame();
	newRectR.InflateRect(8);

	m_iSelViewTouchPos = 0;
	if (newRectL.containsPoint(cTouchPoint))
	{
		m_iSelViewTouchPos = 1;
	}
	else if (newRectR.containsPoint(cTouchPoint))
	{
		m_iSelViewTouchPos = 2;
	}
	else if (m_pControlView)
	{
		if (touchSelectText(pTouch))
		{
			CATextToolBarView *pToolBar = CATextToolBarView::create();
			pToolBar->addButton(UTF8("\u526a\u5207"), m_pControlView, callfunc_selector(CATextView::ccCutToClipboard));
			pToolBar->addButton(UTF8("\u590d\u5236"), m_pControlView, callfunc_selector(CATextView::ccCopyToClipboard));
			pToolBar->addButton(UTF8("\u7c98\u8d34"), m_pControlView, callfunc_selector(CATextView::ccPasteFromClipboard));
			pToolBar->show(m_pControlView);
			return false;
		}
	}
	return true;
}
Пример #2
0
void CALabel::ccTouchPress(CATouch *pTouch, CAEvent *pEvent)
{
	if (m_bEnableCopy)
	{
		CATextToolBarView *pToolBar = CATextToolBarView::create();
		pToolBar->addButton(UTF8("\u590d\u5236"), this, callfunc_selector(CALabel::copySelectText));
		pToolBar->show();
	}
}
Пример #3
0
CATextToolBarView *CATextToolBarView::create()
{
	CATextToolBarView *pAlert = new CATextToolBarView();
	if (pAlert && pAlert->init())
	{
		pAlert->autorelease();
		return pAlert;
	}
	CC_SAFE_DELETE(pAlert);
	return pAlert;
}
Пример #4
0
void CATextToolBarView::hideTextToolBar()
{
	CATextToolBarView* pToolBarView = NULL;
	if (CAWindow *rootWindow = CAApplication::getApplication()->getRootWindow())
	{
		pToolBarView = (CATextToolBarView*)rootWindow->getSubviewByTextTag("CATextToolBarView");
	}
	if (pToolBarView)
	{
		pToolBarView->resignFirstResponder();
        pToolBarView->removeFromSuperview();
	}
}
Пример #5
0
bool CATextSelectView::ccTouchBegan(CATouch *pTouch, CAEvent *pEvent)
{
	CCPoint cTouchPoint = this->convertTouchToNodeSpace(pTouch);

	CCRect newRectL = m_pCursorMarkL->getFrame();
	newRectL.InflateRect(8);
	CCRect newRectR = m_pCursorMarkR->getFrame();
	newRectR.InflateRect(8);

	m_iSelViewTouchPos = 0;
	if (newRectL.containsPoint(cTouchPoint))
	{
		m_iSelViewTouchPos = 1;
		return true;
	}

	if (newRectR.containsPoint(cTouchPoint))
	{
		m_iSelViewTouchPos = 2;
		return true;
	}

	CCPoint point = this->convertTouchToNodeSpace(pTouch);

	CCRect ccTextRect = m_pTextViewMask->getFrame();
	if (ccTextRect.containsPoint(point))
	{
		CATextToolBarView *pToolBar = CATextToolBarView::create();
		pToolBar->addButton(UTF8("\u526a\u5207"), this, callfunc_selector(CATextSelectView::ccCutToClipboard));
		pToolBar->addButton(UTF8("\u590d\u5236"), this, callfunc_selector(CATextSelectView::ccCopyToClipboard));
		pToolBar->addButton(UTF8("\u7c98\u8d34"), this, callfunc_selector(CATextSelectView::ccPasteFromClipboard));
		pToolBar->show();
	}
	else
	{
		if (resignFirstResponder())
		{
			hideTextSelView();
		}
		else
		{
			becomeFirstResponder();
		}
	}
	return true;
}
Пример #6
0
void CATextView::ccTouchPress(CATouch *pTouch, CAEvent *pEvent)
{
	if (m_pTextSelView->isTextViewShow())
		return;

	CATextToolBarView *pToolBar = CATextToolBarView::create();
	if (m_szText.empty())
	{
		pToolBar->addButton(UTF8("\u7c98\u8d34"), this, callfunc_selector(CATextView::ccPasteFromClipboard));
	}
	else
	{
		pToolBar->addButton(UTF8("\u7c98\u8d34"), this, callfunc_selector(CATextView::ccPasteFromClipboard));
		pToolBar->addButton(UTF8("\u5168\u9009"), this, callfunc_selector(CATextView::ccSelectAll));
		pToolBar->addButton(UTF8("\u9009\u62e9"), this, callfunc_selector(CATextView::ccStartSelect));
	}
	pToolBar->show();
}
Пример #7
0
void CATextField::ccTouchPress(CATouch *pTouch, CAEvent *pEvent)
{
	if (m_nInputType == KEY_BOARD_INPUT_PASSWORD)
		return;

	std::string cszText = CAClipboard::getText();
	if (cszText.empty() && m_sText.empty())
		return;

	becomeFirstResponder();
	CATextToolBarView *pToolBar = CATextToolBarView::create();
	if (m_sText.empty())
	{
		pToolBar->addButton(UTF8("\u7c98\u8d34"), this, callfunc_selector(CATextField::ccPasteFromClipboard));
	}
	else
	{
		pToolBar->addButton(UTF8("\u7c98\u8d34"), this, callfunc_selector(CATextField::ccPasteFromClipboard));
		pToolBar->addButton(UTF8("\u5168\u9009"), this, callfunc_selector(CATextField::ccSelectAll));
		pToolBar->addButton(UTF8("\u9009\u62e9"), this, callfunc_selector(CATextField::ccStartSelect));
	}
     pToolBar->show();
}