fixed #2068: Updating source format.

This commit is contained in:
James Chen 2013-04-19 09:55:29 +08:00
parent b91c5f099c
commit 9ecaacf59b
1 changed files with 27 additions and 27 deletions

View File

@ -36,7 +36,7 @@ static int _calcCharCount(const char * pszText)
while ((ch = *pszText))
{
CC_BREAK_IF(! ch);
if (0x80 != (0xC0 & ch))
{
++n;
@ -71,7 +71,7 @@ CCTextFieldTTF::~CCTextFieldTTF()
//////////////////////////////////////////////////////////////////////////
CCTextFieldTTF * CCTextFieldTTF::textFieldWithPlaceHolder(const char *placeholder, const CCSize& dimensions, CCTextAlignment alignment, const char *fontName, float fontSize)
{
{
CCTextFieldTTF *pRet = new CCTextFieldTTF();
if(pRet && pRet->initWithPlaceHolder("", dimensions, alignment, fontName, fontSize))
{
@ -180,7 +180,7 @@ void CCTextFieldTTF::insertText(const char * text, int len)
len = nPos;
sInsert.erase(nPos);
}
if (len > 0)
{
if (m_pDelegate && m_pDelegate->onTextFieldInsertText(this, sInsert.c_str(), len))
@ -188,7 +188,7 @@ void CCTextFieldTTF::insertText(const char * text, int len)
// delegate doesn't want to insert text
return;
}
m_nCharCount += _calcCharCount(sInsert.c_str());
std::string sText(*m_pInputText);
sText.append(sInsert);
@ -198,13 +198,13 @@ void CCTextFieldTTF::insertText(const char * text, int len)
if ((int)sInsert.npos == nPos) {
return;
}
// '\n' inserted, let delegate process first
if (m_pDelegate && m_pDelegate->onTextFieldInsertText(this, "\n", 1))
{
return;
}
// if delegate hasn't processed, detach from IME by default
detachWithIME();
}
@ -288,26 +288,26 @@ void CCTextFieldTTF::setColorSpaceHolder(const ccColor3B& color)
// input text property
void CCTextFieldTTF::setString(const char *text)
{
static char bulletString[] = {0xe2, 0x80, 0xa2, 0x00};
std::string displayText;
int length;
static char bulletString[] = {0xe2, 0x80, 0xa2, 0x00};
std::string displayText;
int length;
CC_SAFE_DELETE(m_pInputText);
if (text)
{
m_pInputText = new std::string(text);
displayText = *m_pInputText;
if (m_bSecureTextEntry)
{
displayText = "";
length = m_pInputText->length();
while (length)
{
displayText.append(bulletString);
--length;
}
}
displayText = *m_pInputText;
if (m_bSecureTextEntry)
{
displayText = "";
length = m_pInputText->length();
while (length)
{
displayText.append(bulletString);
--length;
}
}
}
else
{
@ -350,16 +350,16 @@ const char * CCTextFieldTTF::getPlaceHolder(void)
// secureTextEntry
void CCTextFieldTTF::setSecureTextEntry(bool value)
{
if (m_bSecureTextEntry != value)
{
m_bSecureTextEntry = value;
setString(getString());
}
if (m_bSecureTextEntry != value)
{
m_bSecureTextEntry = value;
setString(getString());
}
}
bool CCTextFieldTTF::isSecureTextEntry()
{
return m_bSecureTextEntry;
return m_bSecureTextEntry;
}
NS_CC_END