mirror of https://github.com/axmolengine/axmol.git
fixed #2068: Updating source format.
This commit is contained in:
parent
b91c5f099c
commit
9ecaacf59b
|
@ -36,7 +36,7 @@ static int _calcCharCount(const char * pszText)
|
||||||
while ((ch = *pszText))
|
while ((ch = *pszText))
|
||||||
{
|
{
|
||||||
CC_BREAK_IF(! ch);
|
CC_BREAK_IF(! ch);
|
||||||
|
|
||||||
if (0x80 != (0xC0 & ch))
|
if (0x80 != (0xC0 & ch))
|
||||||
{
|
{
|
||||||
++n;
|
++n;
|
||||||
|
@ -71,7 +71,7 @@ CCTextFieldTTF::~CCTextFieldTTF()
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
CCTextFieldTTF * CCTextFieldTTF::textFieldWithPlaceHolder(const char *placeholder, const CCSize& dimensions, CCTextAlignment alignment, const char *fontName, float fontSize)
|
CCTextFieldTTF * CCTextFieldTTF::textFieldWithPlaceHolder(const char *placeholder, const CCSize& dimensions, CCTextAlignment alignment, const char *fontName, float fontSize)
|
||||||
{
|
{
|
||||||
CCTextFieldTTF *pRet = new CCTextFieldTTF();
|
CCTextFieldTTF *pRet = new CCTextFieldTTF();
|
||||||
if(pRet && pRet->initWithPlaceHolder("", dimensions, alignment, fontName, fontSize))
|
if(pRet && pRet->initWithPlaceHolder("", dimensions, alignment, fontName, fontSize))
|
||||||
{
|
{
|
||||||
|
@ -180,7 +180,7 @@ void CCTextFieldTTF::insertText(const char * text, int len)
|
||||||
len = nPos;
|
len = nPos;
|
||||||
sInsert.erase(nPos);
|
sInsert.erase(nPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (len > 0)
|
if (len > 0)
|
||||||
{
|
{
|
||||||
if (m_pDelegate && m_pDelegate->onTextFieldInsertText(this, sInsert.c_str(), len))
|
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
|
// delegate doesn't want to insert text
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_nCharCount += _calcCharCount(sInsert.c_str());
|
m_nCharCount += _calcCharCount(sInsert.c_str());
|
||||||
std::string sText(*m_pInputText);
|
std::string sText(*m_pInputText);
|
||||||
sText.append(sInsert);
|
sText.append(sInsert);
|
||||||
|
@ -198,13 +198,13 @@ void CCTextFieldTTF::insertText(const char * text, int len)
|
||||||
if ((int)sInsert.npos == nPos) {
|
if ((int)sInsert.npos == nPos) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// '\n' inserted, let delegate process first
|
// '\n' inserted, let delegate process first
|
||||||
if (m_pDelegate && m_pDelegate->onTextFieldInsertText(this, "\n", 1))
|
if (m_pDelegate && m_pDelegate->onTextFieldInsertText(this, "\n", 1))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if delegate hasn't processed, detach from IME by default
|
// if delegate hasn't processed, detach from IME by default
|
||||||
detachWithIME();
|
detachWithIME();
|
||||||
}
|
}
|
||||||
|
@ -288,26 +288,26 @@ void CCTextFieldTTF::setColorSpaceHolder(const ccColor3B& color)
|
||||||
// input text property
|
// input text property
|
||||||
void CCTextFieldTTF::setString(const char *text)
|
void CCTextFieldTTF::setString(const char *text)
|
||||||
{
|
{
|
||||||
static char bulletString[] = {0xe2, 0x80, 0xa2, 0x00};
|
static char bulletString[] = {0xe2, 0x80, 0xa2, 0x00};
|
||||||
std::string displayText;
|
std::string displayText;
|
||||||
int length;
|
int length;
|
||||||
|
|
||||||
CC_SAFE_DELETE(m_pInputText);
|
CC_SAFE_DELETE(m_pInputText);
|
||||||
|
|
||||||
if (text)
|
if (text)
|
||||||
{
|
{
|
||||||
m_pInputText = new std::string(text);
|
m_pInputText = new std::string(text);
|
||||||
displayText = *m_pInputText;
|
displayText = *m_pInputText;
|
||||||
if (m_bSecureTextEntry)
|
if (m_bSecureTextEntry)
|
||||||
{
|
{
|
||||||
displayText = "";
|
displayText = "";
|
||||||
length = m_pInputText->length();
|
length = m_pInputText->length();
|
||||||
while (length)
|
while (length)
|
||||||
{
|
{
|
||||||
displayText.append(bulletString);
|
displayText.append(bulletString);
|
||||||
--length;
|
--length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -350,16 +350,16 @@ const char * CCTextFieldTTF::getPlaceHolder(void)
|
||||||
// secureTextEntry
|
// secureTextEntry
|
||||||
void CCTextFieldTTF::setSecureTextEntry(bool value)
|
void CCTextFieldTTF::setSecureTextEntry(bool value)
|
||||||
{
|
{
|
||||||
if (m_bSecureTextEntry != value)
|
if (m_bSecureTextEntry != value)
|
||||||
{
|
{
|
||||||
m_bSecureTextEntry = value;
|
m_bSecureTextEntry = value;
|
||||||
setString(getString());
|
setString(getString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CCTextFieldTTF::isSecureTextEntry()
|
bool CCTextFieldTTF::isSecureTextEntry()
|
||||||
{
|
{
|
||||||
return m_bSecureTextEntry;
|
return m_bSecureTextEntry;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_CC_END
|
NS_CC_END
|
||||||
|
|
Loading…
Reference in New Issue