mirror of https://github.com/axmolengine/axmol.git
Implement CCEditBox for Tizen. (develop branch)
This commit is contained in:
parent
44e1382b9a
commit
47fac0ed98
|
@ -26,12 +26,27 @@ THE SOFTWARE.
|
||||||
#include "CCOspForm.h"
|
#include "CCOspForm.h"
|
||||||
#include "CCDirector.h"
|
#include "CCDirector.h"
|
||||||
#include "CCEGLView.h"
|
#include "CCEGLView.h"
|
||||||
|
#include <FBase.h>
|
||||||
|
#include <FText.h>
|
||||||
|
|
||||||
USING_NS_CC;
|
USING_NS_CC;
|
||||||
|
using namespace Tizen::Base;
|
||||||
|
using namespace Tizen::Text;
|
||||||
using namespace Tizen::Ui;
|
using namespace Tizen::Ui;
|
||||||
using namespace Tizen::Ui::Controls;
|
using namespace Tizen::Ui::Controls;
|
||||||
using namespace Tizen::Graphics;
|
using namespace Tizen::Graphics;
|
||||||
|
|
||||||
|
CCOspForm::CCOspForm()
|
||||||
|
: __pKeypad(null)
|
||||||
|
, m_pfEditTextCallback(null)
|
||||||
|
, m_pCtx(null)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CCOspForm::~CCOspForm()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
result
|
result
|
||||||
CCOspForm::OnInitializing(void)
|
CCOspForm::OnInitializing(void)
|
||||||
{
|
{
|
||||||
|
@ -41,6 +56,16 @@ CCOspForm::OnInitializing(void)
|
||||||
return E_SUCCESS;
|
return E_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
result
|
||||||
|
CCOspForm::OnTerminating(void)
|
||||||
|
{
|
||||||
|
result r = E_SUCCESS;
|
||||||
|
|
||||||
|
__pKeypad->Destroy();
|
||||||
|
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CCOspForm:: OnTouchDoublePressed(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
|
CCOspForm:: OnTouchDoublePressed(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
|
||||||
{
|
{
|
||||||
|
@ -87,3 +112,51 @@ CCOspForm::OnTouchReleased(const Control& source, const Point& currentPosition,
|
||||||
float y = currentPosition.y;
|
float y = currentPosition.y;
|
||||||
CCDirector::sharedDirector()->getOpenGLView()->handleTouchesEnd(1, &id, &x, &y);
|
CCDirector::sharedDirector()->getOpenGLView()->handleTouchesEnd(1, &id, &x, &y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CCOspForm::OnTextValueChanged(const Tizen::Ui::Control& source)
|
||||||
|
{
|
||||||
|
String text = __pKeypad->GetText();
|
||||||
|
AsciiEncoding ascii;
|
||||||
|
m_pfEditTextCallback((const char *)ascii.GetBytesN(text)->GetPointer(), m_pCtx);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCOspForm::OnTextValueChangeCanceled(const Tizen::Ui::Control& source)
|
||||||
|
{
|
||||||
|
m_pfEditTextCallback("", m_pCtx);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CCOspForm::ShowKeypad(KeypadStyle keypadStyle, KeypadInputModeCategory keypadCategory, bool bSingleLineEnabled, bool bTextPrediction, int nMaxLength, EditTextCallback pfEditTextCallback, void* pCtx)
|
||||||
|
{
|
||||||
|
m_pfEditTextCallback = pfEditTextCallback;
|
||||||
|
m_pCtx = pCtx;
|
||||||
|
|
||||||
|
if (__pKeypad)
|
||||||
|
{
|
||||||
|
__pKeypad->RemoveTextEventListener(*this);
|
||||||
|
__pKeypad->Destroy();
|
||||||
|
__pKeypad = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nMaxLength > 100)
|
||||||
|
nMaxLength = 100;
|
||||||
|
else if (nMaxLength == -1)
|
||||||
|
nMaxLength = 100;
|
||||||
|
|
||||||
|
__pKeypad = new Keypad();
|
||||||
|
__pKeypad->Construct(keypadStyle, keypadCategory, nMaxLength);
|
||||||
|
__pKeypad->AddTextEventListener(*this);
|
||||||
|
|
||||||
|
__pKeypad->SetTextPredictionEnabled(bTextPrediction);
|
||||||
|
__pKeypad->SetSingleLineEnabled(bSingleLineEnabled);
|
||||||
|
__pKeypad->SetShowState(true);
|
||||||
|
__pKeypad->Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CCOspForm::CloseKeypad()
|
||||||
|
{
|
||||||
|
__pKeypad->SetShowState(false);
|
||||||
|
Invalidate(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,12 +29,19 @@ THE SOFTWARE.
|
||||||
#include <FBase.h>
|
#include <FBase.h>
|
||||||
#include <FUi.h>
|
#include <FUi.h>
|
||||||
|
|
||||||
|
typedef void (*EditTextCallback)(const char* pText, void* ctx);
|
||||||
|
|
||||||
class CCOspForm
|
class CCOspForm
|
||||||
: public Tizen::Ui::Controls::Form
|
: public Tizen::Ui::Controls::Form
|
||||||
, public Tizen::Ui::ITouchEventListener
|
, public Tizen::Ui::ITouchEventListener
|
||||||
|
, public Tizen::Ui::ITextEventListener
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
CCOspForm();
|
||||||
|
~CCOspForm();
|
||||||
|
|
||||||
virtual result OnInitializing(void);
|
virtual result OnInitializing(void);
|
||||||
|
virtual result OnTerminating(void);
|
||||||
virtual void OnTouchDoublePressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo);
|
virtual void OnTouchDoublePressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo);
|
||||||
virtual void OnTouchFocusIn(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo);
|
virtual void OnTouchFocusIn(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo);
|
||||||
virtual void OnTouchFocusOut(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo);
|
virtual void OnTouchFocusOut(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo);
|
||||||
|
@ -42,6 +49,17 @@ public:
|
||||||
virtual void OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo);
|
virtual void OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo);
|
||||||
virtual void OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo);
|
virtual void OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo);
|
||||||
virtual void OnTouchReleased(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo);
|
virtual void OnTouchReleased(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo);
|
||||||
|
|
||||||
|
// ITextEventListener
|
||||||
|
virtual void OnTextValueChanged(const Tizen::Ui::Control& source);
|
||||||
|
virtual void OnTextValueChangeCanceled(const Tizen::Ui::Control& source);
|
||||||
|
|
||||||
|
void ShowKeypad(Tizen::Ui::Controls::KeypadStyle keypadStyle, Tizen::Ui::Controls::KeypadInputModeCategory keypadCategory, bool bSingleLineEnabled, bool bTextPrediction, int nMaxLength, EditTextCallback pfEditTextCallback, void* pCtx);
|
||||||
|
void CloseKeypad();
|
||||||
|
|
||||||
|
Tizen::Ui::Controls::Keypad*__pKeypad;
|
||||||
|
EditTextCallback m_pfEditTextCallback;
|
||||||
|
void* m_pCtx;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _CCOSPFORM_H_
|
#endif // _CCOSPFORM_H_
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
Copyright (c) 2010-2012 cocos2d-x.org
|
Copyright (c) 2010-2012 cocos2d-x.org
|
||||||
Copyright (c) 2012 James Chen
|
Copyright (c) 2012 James Chen
|
||||||
|
Copyright (c) 2013 Lee, Jae-Hong
|
||||||
|
|
||||||
http://www.cocos2d-x.org
|
http://www.cocos2d-x.org
|
||||||
|
|
||||||
|
@ -28,7 +29,9 @@
|
||||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN)
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN)
|
||||||
|
|
||||||
#include "CCEditBox.h"
|
#include "CCEditBox.h"
|
||||||
|
#include "platform/tizen/CCOspForm.h"
|
||||||
|
|
||||||
|
using namespace Tizen::Ui::Controls;
|
||||||
|
|
||||||
NS_CC_EXT_BEGIN
|
NS_CC_EXT_BEGIN
|
||||||
|
|
||||||
|
@ -48,17 +51,14 @@ CCEditBoxImplTizen::CCEditBoxImplTizen(CCEditBox* pEditText)
|
||||||
, m_colPlaceHolder(ccGRAY)
|
, m_colPlaceHolder(ccGRAY)
|
||||||
, m_nMaxLength(-1)
|
, m_nMaxLength(-1)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CCEditBoxImplTizen::~CCEditBoxImplTizen()
|
CCEditBoxImplTizen::~CCEditBoxImplTizen()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCEditBoxImplTizen::doAnimationWhenKeyboardMove(float duration, float distance)
|
void CCEditBoxImplTizen::doAnimationWhenKeyboardMove(float duration, float distance)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const int CC_EDIT_BOX_PADDING = 5;
|
static const int CC_EDIT_BOX_PADDING = 5;
|
||||||
|
@ -67,35 +67,35 @@ bool CCEditBoxImplTizen::initWithSize(const CCSize& size)
|
||||||
{
|
{
|
||||||
int fontSize = (int)size.height-12;
|
int fontSize = (int)size.height-12;
|
||||||
m_pLabel = CCLabelTTF::create("", "", size.height-12);
|
m_pLabel = CCLabelTTF::create("", "", size.height-12);
|
||||||
// align the text vertically center
|
// align the text vertically center
|
||||||
m_pLabel->setAnchorPoint(ccp(0, 0.5f));
|
m_pLabel->setAnchorPoint(ccp(0, 0.5f));
|
||||||
m_pLabel->setPosition(ccp(CC_EDIT_BOX_PADDING, size.height / 2.0f));
|
m_pLabel->setPosition(ccp(CC_EDIT_BOX_PADDING, size.height / 2.0f));
|
||||||
m_pLabel->setColor(m_colText);
|
m_pLabel->setColor(m_colText);
|
||||||
m_pEditBox->addChild(m_pLabel);
|
m_pEditBox->addChild(m_pLabel);
|
||||||
|
|
||||||
m_pLabelPlaceHolder = CCLabelTTF::create("", "", size.height-12);
|
m_pLabelPlaceHolder = CCLabelTTF::create("", "", size.height-12);
|
||||||
// align the text vertically center
|
// align the text vertically center
|
||||||
m_pLabelPlaceHolder->setAnchorPoint(ccp(0, 0.5f));
|
m_pLabelPlaceHolder->setAnchorPoint(ccp(0, 0.5f));
|
||||||
m_pLabelPlaceHolder->setPosition(ccp(CC_EDIT_BOX_PADDING, size.height / 2.0f));
|
m_pLabelPlaceHolder->setPosition(ccp(CC_EDIT_BOX_PADDING, size.height / 2.0f));
|
||||||
m_pLabelPlaceHolder->setVisible(false);
|
m_pLabelPlaceHolder->setVisible(false);
|
||||||
m_pLabelPlaceHolder->setColor(m_colPlaceHolder);
|
m_pLabelPlaceHolder->setColor(m_colPlaceHolder);
|
||||||
m_pEditBox->addChild(m_pLabelPlaceHolder);
|
m_pEditBox->addChild(m_pLabelPlaceHolder);
|
||||||
|
|
||||||
m_EditSize = size;
|
m_EditSize = size;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCEditBoxImplTizen::setFont(const char* pFontName, int fontSize)
|
void CCEditBoxImplTizen::setFont(const char* pFontName, int fontSize)
|
||||||
{
|
{
|
||||||
if(m_pLabel != NULL) {
|
if(m_pLabel != NULL) {
|
||||||
m_pLabel->setFontName(pFontName);
|
m_pLabel->setFontName(pFontName);
|
||||||
m_pLabel->setFontSize(fontSize);
|
m_pLabel->setFontSize(fontSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_pLabelPlaceHolder != NULL) {
|
if(m_pLabelPlaceHolder != NULL) {
|
||||||
m_pLabelPlaceHolder->setFontName(pFontName);
|
m_pLabelPlaceHolder->setFontName(pFontName);
|
||||||
m_pLabelPlaceHolder->setFontSize(fontSize);
|
m_pLabelPlaceHolder->setFontSize(fontSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCEditBoxImplTizen::setFontColor(const ccColor3B& color)
|
void CCEditBoxImplTizen::setFontColor(const ccColor3B& color)
|
||||||
|
@ -106,10 +106,10 @@ void CCEditBoxImplTizen::setFontColor(const ccColor3B& color)
|
||||||
|
|
||||||
void CCEditBoxImplTizen::setPlaceholderFont(const char* pFontName, int fontSize)
|
void CCEditBoxImplTizen::setPlaceholderFont(const char* pFontName, int fontSize)
|
||||||
{
|
{
|
||||||
if(m_pLabelPlaceHolder != NULL) {
|
if(m_pLabelPlaceHolder != NULL) {
|
||||||
m_pLabelPlaceHolder->setFontName(pFontName);
|
m_pLabelPlaceHolder->setFontName(pFontName);
|
||||||
m_pLabelPlaceHolder->setFontSize(fontSize);
|
m_pLabelPlaceHolder->setFontSize(fontSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCEditBoxImplTizen::setPlaceholderFontColor(const ccColor3B& color)
|
void CCEditBoxImplTizen::setPlaceholderFontColor(const ccColor3B& color)
|
||||||
|
@ -153,19 +153,19 @@ void CCEditBoxImplTizen::setText(const char* pText)
|
||||||
if (pText != NULL)
|
if (pText != NULL)
|
||||||
{
|
{
|
||||||
m_strText = pText;
|
m_strText = pText;
|
||||||
|
|
||||||
if (m_strText.length() > 0)
|
if (m_strText.length() > 0)
|
||||||
{
|
{
|
||||||
m_pLabelPlaceHolder->setVisible(false);
|
m_pLabelPlaceHolder->setVisible(false);
|
||||||
|
|
||||||
std::string strToShow;
|
std::string strToShow;
|
||||||
|
|
||||||
if (kEditBoxInputFlagPassword == m_eEditBoxInputFlag)
|
if (kEditBoxInputFlagPassword == m_eEditBoxInputFlag)
|
||||||
{
|
{
|
||||||
long length = cc_utf8_strlen(m_strText.c_str(), -1);
|
long length = cc_utf8_strlen(m_strText.c_str(), -1);
|
||||||
for (long i = 0; i < length; i++)
|
for (long i = 0; i < length; i++)
|
||||||
{
|
{
|
||||||
strToShow.append("\u25CF");
|
strToShow.append("*");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -173,15 +173,15 @@ void CCEditBoxImplTizen::setText(const char* pText)
|
||||||
strToShow = m_strText;
|
strToShow = m_strText;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_pLabel->setString(strToShow.c_str());
|
m_pLabel->setString(strToShow.c_str());
|
||||||
|
|
||||||
// Clip the text width to fit to the text box
|
// Clip the text width to fit to the text box
|
||||||
float fMaxWidth = m_EditSize.width - CC_EDIT_BOX_PADDING * 2;
|
float fMaxWidth = m_EditSize.width - CC_EDIT_BOX_PADDING * 2;
|
||||||
CCRect clippingRect = m_pLabel->getTextureRect();
|
CCRect clippingRect = m_pLabel->getTextureRect();
|
||||||
if(clippingRect.size.width > fMaxWidth) {
|
if(clippingRect.size.width > fMaxWidth) {
|
||||||
clippingRect.size.width = fMaxWidth;
|
clippingRect.size.width = fMaxWidth;
|
||||||
m_pLabel->setTextureRect(clippingRect);
|
m_pLabel->setTextureRect(clippingRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -189,7 +189,7 @@ void CCEditBoxImplTizen::setText(const char* pText)
|
||||||
m_pLabelPlaceHolder->setVisible(true);
|
m_pLabelPlaceHolder->setVisible(true);
|
||||||
m_pLabel->setString("");
|
m_pLabel->setString("");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,46 +207,40 @@ void CCEditBoxImplTizen::setPlaceHolder(const char* pText)
|
||||||
{
|
{
|
||||||
m_pLabelPlaceHolder->setVisible(true);
|
m_pLabelPlaceHolder->setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_pLabelPlaceHolder->setString(m_strPlaceHolder.c_str());
|
m_pLabelPlaceHolder->setString(m_strPlaceHolder.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCEditBoxImplTizen::setPosition(const CCPoint& pos)
|
void CCEditBoxImplTizen::setPosition(const CCPoint& pos)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCEditBoxImplTizen::setVisible(bool visible)
|
void CCEditBoxImplTizen::setVisible(bool visible)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCEditBoxImplTizen::setContentSize(const CCSize& size)
|
void CCEditBoxImplTizen::setContentSize(const CCSize& size)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCEditBoxImplTizen::setAnchorPoint(const CCPoint& anchorPoint)
|
void CCEditBoxImplTizen::setAnchorPoint(const CCPoint& anchorPoint)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCEditBoxImplTizen::visit(void)
|
void CCEditBoxImplTizen::visit(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCEditBoxImplTizen::onEnter(void)
|
void CCEditBoxImplTizen::onEnter(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void editBoxCallbackFunc(const char* pText, void* ctx)
|
static void editBoxCallbackFunc(const char* pText, void* ctx)
|
||||||
{
|
{
|
||||||
CCEditBoxImplTizen* thiz = (CCEditBoxImplTizen*)ctx;
|
CCEditBoxImplTizen* thiz = (CCEditBoxImplTizen*)ctx;
|
||||||
thiz->setText(pText);
|
thiz->setText(pText);
|
||||||
|
|
||||||
if (thiz->getDelegate() != NULL)
|
if (thiz->getDelegate() != NULL)
|
||||||
{
|
{
|
||||||
thiz->getDelegate()->editBoxTextChanged(thiz->getCCEditBox(), thiz->getText());
|
thiz->getDelegate()->editBoxTextChanged(thiz->getCCEditBox(), thiz->getText());
|
||||||
|
@ -276,11 +270,63 @@ void CCEditBoxImplTizen::openKeyboard()
|
||||||
cocos2d::CCScriptEngineProtocol* pEngine = cocos2d::CCScriptEngineManager::sharedManager()->getScriptEngine();
|
cocos2d::CCScriptEngineProtocol* pEngine = cocos2d::CCScriptEngineManager::sharedManager()->getScriptEngine();
|
||||||
pEngine->executeEvent(pEditBox->getScriptEditBoxHandler(), "began",pEditBox);
|
pEngine->executeEvent(pEditBox->getScriptEditBoxHandler(), "began",pEditBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
KeypadStyle keypadStyle = KEYPAD_STYLE_NORMAL;
|
||||||
|
KeypadInputModeCategory keypadCategory = KEYPAD_MODE_ALPHA;
|
||||||
|
bool bSingleLineEnabled = false;
|
||||||
|
switch (m_eEditBoxInputMode)
|
||||||
|
{
|
||||||
|
case kEditBoxInputModeAny:
|
||||||
|
keypadStyle = KEYPAD_STYLE_NORMAL;
|
||||||
|
break;
|
||||||
|
case kEditBoxInputModeEmailAddr:
|
||||||
|
keypadStyle = KEYPAD_STYLE_EMAIL;
|
||||||
|
break;
|
||||||
|
case kEditBoxInputModeNumeric:
|
||||||
|
case kEditBoxInputModeDecimal:
|
||||||
|
keypadStyle = KEYPAD_STYLE_NUMBER;
|
||||||
|
keypadCategory = KEYPAD_MODE_NUMERIC;
|
||||||
|
break;
|
||||||
|
case kEditBoxInputModePhoneNumber:
|
||||||
|
keypadStyle = KEYPAD_STYLE_PHONE_NUMBER;
|
||||||
|
break;
|
||||||
|
case kEditBoxInputModeUrl:
|
||||||
|
keypadStyle = KEYPAD_STYLE_URL;
|
||||||
|
break;
|
||||||
|
case kEditBoxInputModeSingleLine:
|
||||||
|
bSingleLineEnabled = true;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
keypadStyle = KEYPAD_STYLE_NORMAL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool bTextPrediction = true;
|
||||||
|
switch (m_eEditBoxInputFlag)
|
||||||
|
{
|
||||||
|
case kEditBoxInputFlagPassword:
|
||||||
|
keypadStyle = KEYPAD_STYLE_PASSWORD;
|
||||||
|
break;
|
||||||
|
case kEditBoxInputFlagSensitive:
|
||||||
|
bTextPrediction = false;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
((CCOspForm *)CCOspApplication::GetInstance()->getCCOspForm())->ShowKeypad(
|
||||||
|
keypadStyle,
|
||||||
|
keypadCategory,
|
||||||
|
bSingleLineEnabled,
|
||||||
|
bTextPrediction,
|
||||||
|
m_nMaxLength,
|
||||||
|
editBoxCallbackFunc,
|
||||||
|
(void*)this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCEditBoxImplTizen::closeKeyboard()
|
void CCEditBoxImplTizen::closeKeyboard()
|
||||||
{
|
{
|
||||||
|
((CCOspForm *)CCOspApplication::GetInstance()->getCCOspForm())->CloseKeypad();
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_CC_EXT_END
|
NS_CC_EXT_END
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
Copyright (c) 2010-2012 cocos2d-x.org
|
Copyright (c) 2010-2012 cocos2d-x.org
|
||||||
Copyright (c) 2012 James Chen
|
Copyright (c) 2012 James Chen
|
||||||
|
Copyright (c) 2013 Lee, Jae-Hong
|
||||||
|
|
||||||
http://www.cocos2d-x.org
|
http://www.cocos2d-x.org
|
||||||
|
|
||||||
|
@ -42,7 +43,7 @@ class CCEditBoxImplTizen : public CCEditBoxImpl
|
||||||
public:
|
public:
|
||||||
CCEditBoxImplTizen(CCEditBox* pEditText);
|
CCEditBoxImplTizen(CCEditBox* pEditText);
|
||||||
virtual ~CCEditBoxImplTizen();
|
virtual ~CCEditBoxImplTizen();
|
||||||
|
|
||||||
virtual bool initWithSize(const CCSize& size);
|
virtual bool initWithSize(const CCSize& size);
|
||||||
virtual void setFont(const char* pFontName, int fontSize);
|
virtual void setFont(const char* pFontName, int fontSize);
|
||||||
virtual void setFontColor(const ccColor3B& color);
|
virtual void setFontColor(const ccColor3B& color);
|
||||||
|
@ -54,30 +55,30 @@ public:
|
||||||
virtual int getMaxLength();
|
virtual int getMaxLength();
|
||||||
virtual void setReturnType(KeyboardReturnType returnType);
|
virtual void setReturnType(KeyboardReturnType returnType);
|
||||||
virtual bool isEditing();
|
virtual bool isEditing();
|
||||||
|
|
||||||
virtual void setText(const char* pText);
|
virtual void setText(const char* pText);
|
||||||
virtual const char* getText(void);
|
virtual const char* getText(void);
|
||||||
virtual void setPlaceHolder(const char* pText);
|
virtual void setPlaceHolder(const char* pText);
|
||||||
virtual void setPosition(const CCPoint& pos);
|
virtual void setPosition(const CCPoint& pos);
|
||||||
virtual void setVisible(bool visible);
|
virtual void setVisible(bool visible);
|
||||||
virtual void setContentSize(const CCSize& size);
|
virtual void setContentSize(const CCSize& size);
|
||||||
virtual void setAnchorPoint(const CCPoint& anchorPoint);
|
virtual void setAnchorPoint(const CCPoint& anchorPoint);
|
||||||
virtual void visit(void);
|
virtual void visit(void);
|
||||||
virtual void onEnter(void);
|
virtual void onEnter(void);
|
||||||
virtual void doAnimationWhenKeyboardMove(float duration, float distance);
|
virtual void doAnimationWhenKeyboardMove(float duration, float distance);
|
||||||
virtual void openKeyboard();
|
virtual void openKeyboard();
|
||||||
virtual void closeKeyboard();
|
virtual void closeKeyboard();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CCLabelTTF* m_pLabel;
|
CCLabelTTF* m_pLabel;
|
||||||
CCLabelTTF* m_pLabelPlaceHolder;
|
CCLabelTTF* m_pLabelPlaceHolder;
|
||||||
EditBoxInputMode m_eEditBoxInputMode;
|
EditBoxInputMode m_eEditBoxInputMode;
|
||||||
EditBoxInputFlag m_eEditBoxInputFlag;
|
EditBoxInputFlag m_eEditBoxInputFlag;
|
||||||
KeyboardReturnType m_eKeyboardReturnType;
|
KeyboardReturnType m_eKeyboardReturnType;
|
||||||
|
|
||||||
std::string m_strText;
|
std::string m_strText;
|
||||||
std::string m_strPlaceHolder;
|
std::string m_strPlaceHolder;
|
||||||
|
|
||||||
ccColor3B m_colText;
|
ccColor3B m_colText;
|
||||||
ccColor3B m_colPlaceHolder;
|
ccColor3B m_colPlaceHolder;
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
#endif
|
#endif
|
||||||
#include "TableViewTest/TableViewTestScene.h"
|
#include "TableViewTest/TableViewTestScene.h"
|
||||||
|
|
||||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN)
|
||||||
#include "EditBoxTest/EditBoxTest.h"
|
#include "EditBoxTest/EditBoxTest.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ enum
|
||||||
TEST_CCCONTROLBUTTON,
|
TEST_CCCONTROLBUTTON,
|
||||||
TEST_COCOSBUILDER,
|
TEST_COCOSBUILDER,
|
||||||
TEST_HTTPCLIENT,
|
TEST_HTTPCLIENT,
|
||||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN)
|
||||||
TEST_EDITBOX,
|
TEST_EDITBOX,
|
||||||
#endif
|
#endif
|
||||||
TEST_TABLEVIEW,
|
TEST_TABLEVIEW,
|
||||||
|
@ -39,7 +39,7 @@ static const std::string testsName[TEST_MAX_COUNT] =
|
||||||
#if (CC_TARGET_PLATFORM != CC_PLATFORM_EMSCRIPTEN)
|
#if (CC_TARGET_PLATFORM != CC_PLATFORM_EMSCRIPTEN)
|
||||||
"HttpClientTest",
|
"HttpClientTest",
|
||||||
#endif
|
#endif
|
||||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN)
|
||||||
"EditBoxTest",
|
"EditBoxTest",
|
||||||
#endif
|
#endif
|
||||||
"TableViewTest"
|
"TableViewTest"
|
||||||
|
@ -109,7 +109,7 @@ void ExtensionsMainLayer::menuCallback(CCObject* pSender)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN)
|
||||||
case TEST_EDITBOX:
|
case TEST_EDITBOX:
|
||||||
{
|
{
|
||||||
runEditBoxTest();
|
runEditBoxTest();
|
||||||
|
|
Loading…
Reference in New Issue