issue #2430:move EditBox enum into class

This commit is contained in:
minggo 2013-07-26 17:45:01 +08:00
parent 0b3ed85914
commit a7c1904eb8
18 changed files with 220 additions and 193 deletions

View File

@ -41,4 +41,24 @@ const Control::State CCControlStateHighlighted = Control::State::HIGH_LIGHTED;
const Control::State CCControlStateDisabled = Control::State::DISABLED; const Control::State CCControlStateDisabled = Control::State::DISABLED;
const Control::State CCControlStateSelected = Control::State::SELECTED; const Control::State CCControlStateSelected = Control::State::SELECTED;
const EditBox::EditBox::KeyboardReturnType kKeyboardReturnTypeDefault = EditBox::EditBox::KeyboardReturnType::DEFAULT;
const EditBox::EditBox::KeyboardReturnType kKeyboardReturnTypeDone = EditBox::EditBox::KeyboardReturnType::DONE;
const EditBox::EditBox::KeyboardReturnType kKeyboardReturnTypeSend = EditBox::EditBox::KeyboardReturnType::SEND;
const EditBox::EditBox::KeyboardReturnType kKeyboardReturnTypeSearch = EditBox::EditBox::KeyboardReturnType::SEARCH;
const EditBox::EditBox::KeyboardReturnType kKeyboardReturnTypeGo = EditBox::EditBox::KeyboardReturnType::GO;
const EditBox::InputMode kEditBoxInputModeAny = EditBox::InputMode::ANY;
const EditBox::InputMode kEditBoxInputModeEmailAddr = EditBox::InputMode::EMAIL_ADDRESS;
const EditBox::InputMode kEditBoxInputModeNumeric = EditBox::InputMode::NUMERIC;
const EditBox::InputMode kEditBoxInputModePhoneNumber = EditBox::InputMode::PHONE_NUMBER;
const EditBox::InputMode kEditBoxInputModeUrl = EditBox::InputMode::URL;
const EditBox::InputMode kEditBoxInputModeDecimal = EditBox::InputMode::DECIMAL;
const EditBox::InputMode kEditBoxInputModeSingleLine = EditBox::InputMode::SINGLE_LINE;
const EditBox::InputFlag kEditBoxInputFlagPassword = EditBox::InputFlag::PASSWORD;
const EditBox::InputFlag kEditBoxInputFlagSensitive = EditBox::InputFlag::SENSITIVE;
const EditBox::InputFlag kEditBoxInputFlagInitialCapsWord = EditBox::InputFlag::INITIAL_CAPS_WORD;
const EditBox::InputFlag kEditBoxInputFlagInitialCapsSentence = EditBox::InputFlag::INITIAL_CAPS_SENTENCE;
const EditBox::InputFlag kEditBoxInputFlagInitialCapsAllCharacters = EditBox::InputFlag::INTIAL_CAPS_ALL_CHARACTERS;
NS_CC_EXT_END NS_CC_EXT_END

View File

@ -131,25 +131,35 @@ CC_DEPRECATED_ATTRIBUTE typedef AttachmentType CCAttachmentType;
#define kCCScrollViewDirectionHorizontal kScrollViewDirectionHorizontal #define kCCScrollViewDirectionHorizontal kScrollViewDirectionHorizontal
#define kCCScrollViewDirectionVertical kScrollViewDirectionVertical #define kCCScrollViewDirectionVertical kScrollViewDirectionVertical
#define kCCScrollViewDirectionBoth kScrollViewDirectionBoth #define kCCScrollViewDirectionBoth kScrollViewDirectionBoth
#define kCCKeyboardReturnTypeDefault kKeyboardReturnTypeDefault
#define kCCKeyboardReturnTypeDone kKeyboardReturnTypeDone
#define kCCKeyboardReturnTypeSend kKeyboardReturnTypeSend
#define kCCKeyboardReturnTypeSearch kKeyboardReturnTypeSearch
#define kCCKeyboardReturnTypeGo kKeyboardReturnTypeGo
#define kCCEditBoxInputModeAny kEditBoxInputModeAny CC_DEPRECATED_ATTRIBUTE extern const EditBox::EditBox::KeyboardReturnType kKeyboardReturnTypeDefault;
#define kCCEditBoxInputModeEmailAddr kEditBoxInputModeEmailAddr CC_DEPRECATED_ATTRIBUTE extern const EditBox::EditBox::KeyboardReturnType kKeyboardReturnTypeDone;
#define kCCEditBoxInputModeNumeric kEditBoxInputModeNumeric CC_DEPRECATED_ATTRIBUTE extern const EditBox::EditBox::KeyboardReturnType kKeyboardReturnTypeSend;
#define kCCEditBoxInputModePhoneNumber kEditBoxInputModePhoneNumber CC_DEPRECATED_ATTRIBUTE extern const EditBox::EditBox::KeyboardReturnType kKeyboardReturnTypeSearch;
#define kCCEditBoxInputModeUrl kEditBoxInputModeUrl CC_DEPRECATED_ATTRIBUTE extern const EditBox::EditBox::KeyboardReturnType kKeyboardReturnTypeGo;
#define kCCEditBoxInputModeDecimal kEditBoxInputModeDecimal
#define kCCEditBoxInputModeSingleLine kEditBoxInputModeSingleLine CC_DEPRECATED_ATTRIBUTE extern const EditBox::InputMode kEditBoxInputModeAny;
CC_DEPRECATED_ATTRIBUTE extern const EditBox::InputMode kEditBoxInputModeEmailAddr;
CC_DEPRECATED_ATTRIBUTE extern const EditBox::InputMode kEditBoxInputModeNumeric;
CC_DEPRECATED_ATTRIBUTE extern const EditBox::InputMode kEditBoxInputModePhoneNumber;
CC_DEPRECATED_ATTRIBUTE extern const EditBox::InputMode kEditBoxInputModeUrl;
CC_DEPRECATED_ATTRIBUTE extern const EditBox::InputMode kEditBoxInputModeDecimal;
CC_DEPRECATED_ATTRIBUTE extern const EditBox::InputMode kEditBoxInputModeSingleLine;
CC_DEPRECATED_ATTRIBUTE extern const EditBox::InputFlag kEditBoxInputFlagPassword;
CC_DEPRECATED_ATTRIBUTE extern const EditBox::InputFlag kEditBoxInputFlagSensitive;
CC_DEPRECATED_ATTRIBUTE extern const EditBox::InputFlag kEditBoxInputFlagInitialCapsWord;
CC_DEPRECATED_ATTRIBUTE extern const EditBox::InputFlag kEditBoxInputFlagInitialCapsSentence;
CC_DEPRECATED_ATTRIBUTE extern const EditBox::InputFlag kEditBoxInputFlagInitialCapsAllCharacters;
CC_DEPRECATED_ATTRIBUTE typedef EditBox::EditBox::KeyboardReturnType KeyboardReturnType;
CC_DEPRECATED_ATTRIBUTE typedef EditBox::InputMode EditBoxInputMode;
CC_DEPRECATED_ATTRIBUTE typedef EditBox::InputFlag EditBoxInputFlag;
#define kCCControlStepperPartMinus kControlStepperPartMinus #define kCCControlStepperPartMinus kControlStepperPartMinus
#define kCCControlStepperPartPlus kControlStepperPartPlus #define kCCControlStepperPartPlus kControlStepperPartPlus
#define kCCControlStepperPartNone kControlStepperPartNone #define kCCControlStepperPartNone kControlStepperPartNone
CC_DEPRECATED_ATTRIBUTE extern const Control::EventType CCControlEventTouchDown; CC_DEPRECATED_ATTRIBUTE extern const Control::EventType CCControlEventTouchDown;
CC_DEPRECATED_ATTRIBUTE extern const Control::EventType CCControlEventTouchDragInside; CC_DEPRECATED_ATTRIBUTE extern const Control::EventType CCControlEventTouchDragInside;
CC_DEPRECATED_ATTRIBUTE extern const Control::EventType CCControlEventTouchDragOutside; CC_DEPRECATED_ATTRIBUTE extern const Control::EventType CCControlEventTouchDragOutside;

View File

@ -31,9 +31,9 @@ NS_CC_EXT_BEGIN
EditBox::EditBox(void) EditBox::EditBox(void)
: _editBoxImpl(NULL) : _editBoxImpl(NULL)
, _delegate(NULL) , _delegate(NULL)
, _editBoxInputMode(kEditBoxInputModeSingleLine) , _editBoxInputMode(EditBox::InputMode::SINGLE_LINE)
, _editBoxInputFlag(kEditBoxInputFlagInitialCapsAllCharacters) , _editBoxInputFlag(EditBox::InputFlag::INTIAL_CAPS_ALL_CHARACTERS)
, _keyboardReturnType(kKeyboardReturnTypeDefault) , _keyboardReturnType(KeyboardReturnType::DEFAULT)
, _fontSize(-1) , _fontSize(-1)
, _placeholderFontSize(-1) , _placeholderFontSize(-1)
, _colText(Color3B::WHITE) , _colText(Color3B::WHITE)
@ -233,7 +233,7 @@ const char* EditBox::getPlaceHolder(void)
return _placeHolder.c_str(); return _placeHolder.c_str();
} }
void EditBox::setInputMode(EditBoxInputMode inputMode) void EditBox::setInputMode(EditBox::InputMode inputMode)
{ {
_editBoxInputMode = inputMode; _editBoxInputMode = inputMode;
if (_editBoxImpl != NULL) if (_editBoxImpl != NULL)
@ -257,7 +257,7 @@ int EditBox::getMaxLength()
return _maxLength; return _maxLength;
} }
void EditBox::setInputFlag(EditBoxInputFlag inputFlag) void EditBox::setInputFlag(EditBox::InputFlag inputFlag)
{ {
_editBoxInputFlag = inputFlag; _editBoxInputFlag = inputFlag;
if (_editBoxImpl != NULL) if (_editBoxImpl != NULL)
@ -266,7 +266,7 @@ void EditBox::setInputFlag(EditBoxInputFlag inputFlag)
} }
} }
void EditBox::setReturnType(KeyboardReturnType returnType) void EditBox::setReturnType(EditBox::KeyboardReturnType returnType)
{ {
if (_editBoxImpl != NULL) if (_editBoxImpl != NULL)
{ {

View File

@ -32,98 +32,6 @@
NS_CC_EXT_BEGIN NS_CC_EXT_BEGIN
enum KeyboardReturnType {
kKeyboardReturnTypeDefault = 0,
kKeyboardReturnTypeDone,
kKeyboardReturnTypeSend,
kKeyboardReturnTypeSearch,
kKeyboardReturnTypeGo
};
/**
* \brief The EditBoxInputMode defines the type of text that the user is allowed
* to enter.
*/
enum EditBoxInputMode
{
/**
* The user is allowed to enter any text, including line breaks.
*/
kEditBoxInputModeAny = 0,
/**
* The user is allowed to enter an e-mail address.
*/
kEditBoxInputModeEmailAddr,
/**
* The user is allowed to enter an integer value.
*/
kEditBoxInputModeNumeric,
/**
* The user is allowed to enter a phone number.
*/
kEditBoxInputModePhoneNumber,
/**
* The user is allowed to enter a URL.
*/
kEditBoxInputModeUrl,
/**
* The user is allowed to enter a real number value.
* This extends kEditBoxInputModeNumeric by allowing a decimal point.
*/
kEditBoxInputModeDecimal,
/**
* The user is allowed to enter any text, except for line breaks.
*/
kEditBoxInputModeSingleLine
};
/**
* \brief The EditBoxInputFlag defines how the input text is displayed/formatted.
*/
enum EditBoxInputFlag
{
/**
* Indicates that the text entered is confidential data that should be
* obscured whenever possible. This implies EDIT_BOX_INPUT_FLAG_SENSITIVE.
*/
kEditBoxInputFlagPassword = 0,
/**
* Indicates that the text entered is sensitive data that the
* implementation must never store into a dictionary or table for use
* in predictive, auto-completing, or other accelerated input schemes.
* A credit card number is an example of sensitive data.
*/
kEditBoxInputFlagSensitive,
/**
* This flag is a hint to the implementation that during text editing,
* the initial letter of each word should be capitalized.
*/
kEditBoxInputFlagInitialCapsWord,
/**
* This flag is a hint to the implementation that during text editing,
* the initial letter of each sentence should be capitalized.
*/
kEditBoxInputFlagInitialCapsSentence,
/**
* Capitalize all characters automatically.
*/
kEditBoxInputFlagInitialCapsAllCharacters
};
class EditBox; class EditBox;
class EditBoxImpl; class EditBoxImpl;
@ -173,6 +81,95 @@ class EditBox
, public IMEDelegate , public IMEDelegate
{ {
public: public:
enum class KeyboardReturnType
{
DEFAULT,
DONE,
SEND,
SEARCH,
GO
};
/**
* \brief The EditBox::InputMode defines the type of text that the user is allowed
* to enter.
*/
enum class InputMode
{
/**
* The user is allowed to enter any text, including line breaks.
*/
ANY,
/**
* The user is allowed to enter an e-mail address.
*/
EMAIL_ADDRESS,
/**
* The user is allowed to enter an integer value.
*/
NUMERIC,
/**
* The user is allowed to enter a phone number.
*/
PHONE_NUMBER,
/**
* The user is allowed to enter a URL.
*/
URL,
/**
* The user is allowed to enter a real number value.
* This extends kEditBoxInputModeNumeric by allowing a decimal point.
*/
DECIMAL,
/**
* The user is allowed to enter any text, except for line breaks.
*/
SINGLE_LINE,
};
/**
* \brief The EditBox::InputFlag defines how the input text is displayed/formatted.
*/
enum class InputFlag
{
/**
* Indicates that the text entered is confidential data that should be
* obscured whenever possible. This implies EDIT_BOX_INPUT_FLAG_SENSITIVE.
*/
PASSWORD,
/**
* Indicates that the text entered is sensitive data that the
* implementation must never store into a dictionary or table for use
* in predictive, auto-completing, or other accelerated input schemes.
* A credit card number is an example of sensitive data.
*/
SENSITIVE,
/**
* This flag is a hint to the implementation that during text editing,
* the initial letter of each word should be capitalized.
*/
INITIAL_CAPS_WORD,
/**
* This flag is a hint to the implementation that during text editing,
* the initial letter of each sentence should be capitalized.
*/
INITIAL_CAPS_SENTENCE,
/**
* Capitalize all characters automatically.
*/
INTIAL_CAPS_ALL_CHARACTERS,
};
/** /**
* create a edit box with size. * create a edit box with size.
* @return An autorelease pointer of EditBox, you don't need to release it only if you retain it again. * @return An autorelease pointer of EditBox, you don't need to release it only if you retain it again.
@ -310,9 +307,9 @@ public:
/** /**
* Set the input mode of the edit box. * Set the input mode of the edit box.
* @param inputMode One of the EditBoxInputMode constants. * @param inputMode One of the EditBox::InputMode constants.
*/ */
void setInputMode(EditBoxInputMode inputMode); void setInputMode(InputMode inputMode);
/** /**
* Sets the maximum input length of the edit box. * Sets the maximum input length of the edit box.
@ -332,15 +329,15 @@ public:
/** /**
* Set the input flags that are to be applied to the edit box. * Set the input flags that are to be applied to the edit box.
* @param inputFlag One of the EditBoxInputFlag constants. * @param inputFlag One of the EditBox::InputFlag constants.
*/ */
void setInputFlag(EditBoxInputFlag inputFlag); void setInputFlag(InputFlag inputFlag);
/** /**
* Set the return type that are to be applied to the edit box. * Set the return type that are to be applied to the edit box.
* @param returnType One of the KeyboardReturnType constants. * @param returnType One of the EditBox::KeyboardReturnType constants.
*/ */
void setReturnType(KeyboardReturnType returnType); void setReturnType(EditBox::KeyboardReturnType returnType);
/* override functions */ /* override functions */
virtual void setPosition(const Point& pos); virtual void setPosition(const Point& pos);
@ -362,9 +359,9 @@ protected:
EditBoxImpl* _editBoxImpl; EditBoxImpl* _editBoxImpl;
EditBoxDelegate* _delegate; EditBoxDelegate* _delegate;
EditBoxInputMode _editBoxInputMode; InputMode _editBoxInputMode;
EditBoxInputFlag _editBoxInputFlag; InputFlag _editBoxInputFlag;
KeyboardReturnType _keyboardReturnType; EditBox::KeyboardReturnType _keyboardReturnType;
std::string _text; std::string _text;
std::string _placeHolder; std::string _placeHolder;

View File

@ -44,11 +44,11 @@ public:
virtual void setFontColor(const Color3B& color) = 0; virtual void setFontColor(const Color3B& color) = 0;
virtual void setPlaceholderFont(const char* pFontName, int fontSize) = 0; virtual void setPlaceholderFont(const char* pFontName, int fontSize) = 0;
virtual void setPlaceholderFontColor(const Color3B& color) = 0; virtual void setPlaceholderFontColor(const Color3B& color) = 0;
virtual void setInputMode(EditBoxInputMode inputMode) = 0; virtual void setInputMode(EditBox::InputMode inputMode) = 0;
virtual void setInputFlag(EditBoxInputFlag inputFlag) = 0; virtual void setInputFlag(EditBox::InputFlag inputFlag) = 0;
virtual void setMaxLength(int maxLength) = 0; virtual void setMaxLength(int maxLength) = 0;
virtual int getMaxLength() = 0; virtual int getMaxLength() = 0;
virtual void setReturnType(KeyboardReturnType returnType) = 0; virtual void setReturnType(EditBox::KeyboardReturnType returnType) = 0;
virtual bool isEditing() = 0; virtual bool isEditing() = 0;
virtual void setText(const char* pText) = 0; virtual void setText(const char* pText) = 0;

View File

@ -43,9 +43,9 @@ EditBoxImplAndroid::EditBoxImplAndroid(EditBox* pEditText)
: EditBoxImpl(pEditText) : EditBoxImpl(pEditText)
, _label(NULL) , _label(NULL)
, _labelPlaceHolder(NULL) , _labelPlaceHolder(NULL)
, _editBoxInputMode(kEditBoxInputModeSingleLine) , _editBoxInputMode(EditBox::InputMode::SINGLE_LINE)
, _editBoxInputFlag(kEditBoxInputFlagInitialCapsAllCharacters) , _editBoxInputFlag(EditBox::InputFlag::INTIAL_CAPS_ALL_CHARACTERS)
, _keyboardReturnType(kKeyboardReturnTypeDefault) , _keyboardReturnType(EditBox::EditBox::KeyboardReturnType::DEFAULT)
, _colText(Color3B::WHITE) , _colText(Color3B::WHITE)
, _colPlaceHolder(Color3B::GRAY) , _colPlaceHolder(Color3B::GRAY)
, _maxLength(-1) , _maxLength(-1)
@ -120,7 +120,7 @@ void EditBoxImplAndroid::setPlaceholderFontColor(const Color3B& color)
_labelPlaceHolder->setColor(color); _labelPlaceHolder->setColor(color);
} }
void EditBoxImplAndroid::setInputMode(EditBoxInputMode inputMode) void EditBoxImplAndroid::setInputMode(EditBox::InputMode inputMode)
{ {
_editBoxInputMode = inputMode; _editBoxInputMode = inputMode;
} }
@ -135,12 +135,12 @@ int EditBoxImplAndroid::getMaxLength()
return _maxLength; return _maxLength;
} }
void EditBoxImplAndroid::setInputFlag(EditBoxInputFlag inputFlag) void EditBoxImplAndroid::setInputFlag(EditBox::InputFlag inputFlag)
{ {
_editBoxInputFlag = inputFlag; _editBoxInputFlag = inputFlag;
} }
void EditBoxImplAndroid::setReturnType(KeyboardReturnType returnType) void EditBoxImplAndroid::setReturnType(EditBox::KeyboardReturnType returnType)
{ {
_keyboardReturnType = returnType; _keyboardReturnType = returnType;
} }
@ -162,7 +162,7 @@ void EditBoxImplAndroid::setText(const char* pText)
std::string strToShow; std::string strToShow;
if (kEditBoxInputFlagPassword == _editBoxInputFlag) if (EditBox::InputFlag::PASSWORD == _editBoxInputFlag)
{ {
long length = cc_utf8_strlen(_text.c_str(), -1); long length = cc_utf8_strlen(_text.c_str(), -1);
for (long i = 0; i < length; i++) for (long i = 0; i < length; i++)
@ -289,9 +289,9 @@ void EditBoxImplAndroid::openKeyboard()
showEditTextDialogJNI( _placeHolder.c_str(), showEditTextDialogJNI( _placeHolder.c_str(),
_text.c_str(), _text.c_str(),
_editBoxInputMode, (int)_editBoxInputMode,
_editBoxInputFlag, (int)_editBoxInputFlag,
_keyboardReturnType, (int)_keyboardReturnType,
_maxLength, _maxLength,
editBoxCallbackFunc, editBoxCallbackFunc,
(void*)this ); (void*)this );

View File

@ -48,11 +48,11 @@ public:
virtual void setFontColor(const Color3B& color); virtual void setFontColor(const Color3B& color);
virtual void setPlaceholderFont(const char* pFontName, int fontSize); virtual void setPlaceholderFont(const char* pFontName, int fontSize);
virtual void setPlaceholderFontColor(const Color3B& color); virtual void setPlaceholderFontColor(const Color3B& color);
virtual void setInputMode(EditBoxInputMode inputMode); virtual void setInputMode(EditBox::InputMode inputMode);
virtual void setInputFlag(EditBoxInputFlag inputFlag); virtual void setInputFlag(EditBox::InputFlag inputFlag);
virtual void setMaxLength(int maxLength); virtual void setMaxLength(int maxLength);
virtual int getMaxLength(); virtual int getMaxLength();
virtual void setReturnType(KeyboardReturnType returnType); virtual void setReturnType(EditBox::KeyboardReturnType returnType);
virtual bool isEditing(); virtual bool isEditing();
virtual void setText(const char* pText); virtual void setText(const char* pText);
@ -71,9 +71,9 @@ public:
private: private:
LabelTTF* _label; LabelTTF* _label;
LabelTTF* _labelPlaceHolder; LabelTTF* _labelPlaceHolder;
EditBoxInputMode _editBoxInputMode; EditBox::InputMode _editBoxInputMode;
EditBoxInputFlag _editBoxInputFlag; EditBox::InputFlag _editBoxInputFlag;
KeyboardReturnType _keyboardReturnType; EditBox::KeyboardReturnType _keyboardReturnType;
std::string _text; std::string _text;
std::string _placeHolder; std::string _placeHolder;

View File

@ -79,11 +79,11 @@ public:
virtual void setFontColor(const Color3B& color); virtual void setFontColor(const Color3B& color);
virtual void setPlaceholderFont(const char* pFontName, int fontSize); virtual void setPlaceholderFont(const char* pFontName, int fontSize);
virtual void setPlaceholderFontColor(const Color3B& color); virtual void setPlaceholderFontColor(const Color3B& color);
virtual void setInputMode(EditBoxInputMode inputMode); virtual void setInputMode(EditBox::InputMode inputMode);
virtual void setInputFlag(EditBoxInputFlag inputFlag); virtual void setInputFlag(EditBox::InputFlag inputFlag);
virtual void setMaxLength(int maxLength); virtual void setMaxLength(int maxLength);
virtual int getMaxLength(); virtual int getMaxLength();
virtual void setReturnType(KeyboardReturnType returnType); virtual void setReturnType(EditBox::KeyboardReturnType returnType);
virtual bool isEditing(); virtual bool isEditing();
virtual void setText(const char* pText); virtual void setText(const char* pText);

View File

@ -394,26 +394,26 @@ void EditBoxImplIOS::setPlaceholderFontColor(const Color3B& color)
_labelPlaceHolder->setColor(color); _labelPlaceHolder->setColor(color);
} }
void EditBoxImplIOS::setInputMode(EditBoxInputMode inputMode) void EditBoxImplIOS::setInputMode(EditBox::InputMode inputMode)
{ {
switch (inputMode) switch (inputMode)
{ {
case kEditBoxInputModeEmailAddr: case EditBox::InputMode::EMAIL_ADDRESS:
_systemControl.textField.keyboardType = UIKeyboardTypeEmailAddress; _systemControl.textField.keyboardType = UIKeyboardTypeEmailAddress;
break; break;
case kEditBoxInputModeNumeric: case EditBox::InputMode::NUMERIC:
_systemControl.textField.keyboardType = UIKeyboardTypeNumbersAndPunctuation; _systemControl.textField.keyboardType = UIKeyboardTypeNumbersAndPunctuation;
break; break;
case kEditBoxInputModePhoneNumber: case EditBox::InputMode::PHONE_NUMBER:
_systemControl.textField.keyboardType = UIKeyboardTypePhonePad; _systemControl.textField.keyboardType = UIKeyboardTypePhonePad;
break; break;
case kEditBoxInputModeUrl: case EditBox::InputMode::URL:
_systemControl.textField.keyboardType = UIKeyboardTypeURL; _systemControl.textField.keyboardType = UIKeyboardTypeURL;
break; break;
case kEditBoxInputModeDecimal: case EditBox::InputMode::DECIMAL:
_systemControl.textField.keyboardType = UIKeyboardTypeDecimalPad; _systemControl.textField.keyboardType = UIKeyboardTypeDecimalPad;
break; break;
case kEditBoxInputModeSingleLine: case EditBox::InputMode::SINGLE_LINE:
_systemControl.textField.keyboardType = UIKeyboardTypeDefault; _systemControl.textField.keyboardType = UIKeyboardTypeDefault;
break; break;
default: default:
@ -432,23 +432,23 @@ int EditBoxImplIOS::getMaxLength()
return _maxTextLength; return _maxTextLength;
} }
void EditBoxImplIOS::setInputFlag(EditBoxInputFlag inputFlag) void EditBoxImplIOS::setInputFlag(EditBox::InputFlag inputFlag)
{ {
switch (inputFlag) switch (inputFlag)
{ {
case kEditBoxInputFlagPassword: case EditBox::InputFlag::PASSWORD:
_systemControl.textField.secureTextEntry = YES; _systemControl.textField.secureTextEntry = YES;
break; break;
case kEditBoxInputFlagInitialCapsWord: case EditBox::InputFlag::INITIAL_CAPS_WORD:
_systemControl.textField.autocapitalizationType = UITextAutocapitalizationTypeWords; _systemControl.textField.autocapitalizationType = UITextAutocapitalizationTypeWords;
break; break;
case kEditBoxInputFlagInitialCapsSentence: case EditBox::InputFlag::INITIAL_CAPS_SENTENCE:
_systemControl.textField.autocapitalizationType = UITextAutocapitalizationTypeSentences; _systemControl.textField.autocapitalizationType = UITextAutocapitalizationTypeSentences;
break; break;
case kEditBoxInputFlagInitialCapsAllCharacters: case EditBox::InputFlag::INTIAL_CAPS_ALL_CHARACTERS:
_systemControl.textField.autocapitalizationType = UITextAutocapitalizationTypeAllCharacters; _systemControl.textField.autocapitalizationType = UITextAutocapitalizationTypeAllCharacters;
break; break;
case kEditBoxInputFlagSensitive: case EditBox::InputFlag::SENSITIVE:
_systemControl.textField.autocorrectionType = UITextAutocorrectionTypeNo; _systemControl.textField.autocorrectionType = UITextAutocorrectionTypeNo;
break; break;
default: default:
@ -456,22 +456,22 @@ void EditBoxImplIOS::setInputFlag(EditBoxInputFlag inputFlag)
} }
} }
void EditBoxImplIOS::setReturnType(KeyboardReturnType returnType) void EditBoxImplIOS::setReturnType(EditBox::KeyboardReturnType returnType)
{ {
switch (returnType) { switch (returnType) {
case kKeyboardReturnTypeDefault: case EditBox::KeyboardReturnType::DEFAULT:
_systemControl.textField.returnKeyType = UIReturnKeyDefault; _systemControl.textField.returnKeyType = UIReturnKeyDefault;
break; break;
case kKeyboardReturnTypeDone: case EditBox::KeyboardReturnType::DONE:
_systemControl.textField.returnKeyType = UIReturnKeyDone; _systemControl.textField.returnKeyType = UIReturnKeyDone;
break; break;
case kKeyboardReturnTypeSend: case EditBox::KeyboardReturnType::SEND:
_systemControl.textField.returnKeyType = UIReturnKeySend; _systemControl.textField.returnKeyType = UIReturnKeySend;
break; break;
case kKeyboardReturnTypeSearch: case EditBox::KeyboardReturnType::SEARCH:
_systemControl.textField.returnKeyType = UIReturnKeySearch; _systemControl.textField.returnKeyType = UIReturnKeySearch;
break; break;
case kKeyboardReturnTypeGo: case EditBox::KeyboardReturnType::GO:
_systemControl.textField.returnKeyType = UIReturnKeyGo; _systemControl.textField.returnKeyType = UIReturnKeyGo;
break; break;
default: default:

View File

@ -78,11 +78,11 @@ public:
virtual void setFontColor(const Color3B& color); virtual void setFontColor(const Color3B& color);
virtual void setPlaceholderFont(const char* pFontName, int fontSize); virtual void setPlaceholderFont(const char* pFontName, int fontSize);
virtual void setPlaceholderFontColor(const Color3B& color); virtual void setPlaceholderFontColor(const Color3B& color);
virtual void setInputMode(EditBoxInputMode inputMode); virtual void setInputMode(EditBox::InputMode inputMode);
virtual void setInputFlag(EditBoxInputFlag inputFlag); virtual void setInputFlag(EditBox::InputFlag inputFlag);
virtual void setMaxLength(int maxLength); virtual void setMaxLength(int maxLength);
virtual int getMaxLength(); virtual int getMaxLength();
virtual void setReturnType(KeyboardReturnType returnType); virtual void setReturnType(EditBox::KeyboardReturnType returnType);
virtual bool isEditing(); virtual bool isEditing();
virtual void setText(const char* pText); virtual void setText(const char* pText);

View File

@ -298,7 +298,7 @@ void EditBoxImplMac::setPlaceholderFontColor(const Color3B& color)
// TODO need to be implemented. // TODO need to be implemented.
} }
void EditBoxImplMac::setInputMode(EditBoxInputMode inputMode) void EditBoxImplMac::setInputMode(EditBox::InputMode inputMode)
{ {
} }
@ -312,12 +312,12 @@ int EditBoxImplMac::getMaxLength()
return _maxTextLength; return _maxTextLength;
} }
void EditBoxImplMac::setInputFlag(EditBoxInputFlag inputFlag) void EditBoxImplMac::setInputFlag(EditBox::InputFlag inputFlag)
{ {
// TODO: NSSecureTextField // TODO: NSSecureTextField
} }
void EditBoxImplMac::setReturnType(KeyboardReturnType returnType) void EditBoxImplMac::setReturnType(EditBox::KeyboardReturnType returnType)
{ {
} }

View File

@ -44,8 +44,8 @@ EditBoxImplTizen::EditBoxImplTizen(EditBox* pEditText)
: EditBoxImpl(pEditText) : EditBoxImpl(pEditText)
, _label(NULL) , _label(NULL)
, _labelPlaceHolder(NULL) , _labelPlaceHolder(NULL)
, _editBoxInputMode(kEditBoxInputModeSingleLine) , _editBoxInputMode(EditBox::InputMode::SINGLE_LINE)
, _editBoxInputFlag(kEditBoxInputFlagInitialCapsAllCharacters) , _editBoxInputFlag(EditBox::InputFlag::INTIAL_CAPS_ALL_CHARACTERS)
, _keyboardReturnType(kKeyboardReturnTypeDefault) , _keyboardReturnType(kKeyboardReturnTypeDefault)
, _colText(Color3B::WHITE) , _colText(Color3B::WHITE)
, _colPlaceHolder(Color3B::GRAY) , _colPlaceHolder(Color3B::GRAY)
@ -118,7 +118,7 @@ void EditBoxImplTizen::setPlaceholderFontColor(const Color3B& color)
_labelPlaceHolder->setColor(color); _labelPlaceHolder->setColor(color);
} }
void EditBoxImplTizen::setInputMode(EditBoxInputMode inputMode) void EditBoxImplTizen::setInputMode(EditBox::InputMode inputMode)
{ {
_editBoxInputMode = inputMode; _editBoxInputMode = inputMode;
} }
@ -133,12 +133,12 @@ int EditBoxImplTizen::getMaxLength()
return _maxLength; return _maxLength;
} }
void EditBoxImplTizen::setInputFlag(EditBoxInputFlag inputFlag) void EditBoxImplTizen::setInputFlag(EditBox::InputFlag inputFlag)
{ {
_editBoxInputFlag = inputFlag; _editBoxInputFlag = inputFlag;
} }
void EditBoxImplTizen::setReturnType(KeyboardReturnType returnType) void EditBoxImplTizen::setReturnType(EditBox::KeyboardReturnType returnType)
{ {
_keyboardReturnType = returnType; _keyboardReturnType = returnType;
} }
@ -301,7 +301,7 @@ void EditBoxImplTizen::openKeyboard()
case kEditBoxInputModeUrl: case kEditBoxInputModeUrl:
keypadStyle = KEYPAD_STYLE_URL; keypadStyle = KEYPAD_STYLE_URL;
break; break;
case kEditBoxInputModeSingleLine: case EditBox::InputMode::SINGLE_LINE:
bSingleLineEnabled = true; bSingleLineEnabled = true;
break; break;
default: default:

View File

@ -49,11 +49,11 @@ public:
virtual void setFontColor(const Color3B& color); virtual void setFontColor(const Color3B& color);
virtual void setPlaceholderFont(const char* pFontName, int fontSize); virtual void setPlaceholderFont(const char* pFontName, int fontSize);
virtual void setPlaceholderFontColor(const Color3B& color); virtual void setPlaceholderFontColor(const Color3B& color);
virtual void setInputMode(EditBoxInputMode inputMode); virtual void setInputMode(EditBox::InputMode inputMode);
virtual void setInputFlag(EditBoxInputFlag inputFlag); virtual void setInputFlag(EditBox::InputFlag inputFlag);
virtual void setMaxLength(int maxLength); virtual void setMaxLength(int maxLength);
virtual int getMaxLength(); virtual int getMaxLength();
virtual void setReturnType(KeyboardReturnType returnType); virtual void setReturnType(EditBox::KeyboardReturnType returnType);
virtual bool isEditing(); virtual bool isEditing();
virtual void setText(const char* pText); virtual void setText(const char* pText);
@ -72,9 +72,9 @@ public:
private: private:
LabelTTF* _label; LabelTTF* _label;
LabelTTF* _labelPlaceHolder; LabelTTF* _labelPlaceHolder;
EditBoxInputMode _editBoxInputMode; EditBox::InputMode _editBoxInputMode;
EditBoxInputFlag _editBoxInputFlag; EditBox::InputFlag _editBoxInputFlag;
KeyboardReturnType _keyboardReturnType; EditBox::KeyboardReturnType _keyboardReturnType;
std::string _text; std::string _text;
std::string _placeHolder; std::string _placeHolder;

View File

@ -40,8 +40,8 @@ EditBoxImplWin::EditBoxImplWin(EditBox* pEditText)
: EditBoxImpl(pEditText) : EditBoxImpl(pEditText)
, _label(NULL) , _label(NULL)
, _labelPlaceHolder(NULL) , _labelPlaceHolder(NULL)
, _editBoxInputMode(kEditBoxInputModeSingleLine) , _editBoxInputMode(EditBox::InputMode::SINGLE_LINE)
, _editBoxInputFlag(kEditBoxInputFlagInitialCapsAllCharacters) , _editBoxInputFlag(EditBox::InputFlag::INTIAL_CAPS_ALL_CHARACTERS)
, _keyboardReturnType(kKeyboardReturnTypeDefault) , _keyboardReturnType(kKeyboardReturnTypeDefault)
, _colText(Color3B::WHITE) , _colText(Color3B::WHITE)
, _colPlaceHolder(Color3B::GRAY) , _colPlaceHolder(Color3B::GRAY)
@ -113,7 +113,7 @@ void EditBoxImplWin::setPlaceholderFontColor(const Color3B& color)
_labelPlaceHolder->setColor(color); _labelPlaceHolder->setColor(color);
} }
void EditBoxImplWin::setInputMode(EditBoxInputMode inputMode) void EditBoxImplWin::setInputMode(EditBox::InputMode inputMode)
{ {
_editBoxInputMode = inputMode; _editBoxInputMode = inputMode;
} }
@ -128,12 +128,12 @@ int EditBoxImplWin::getMaxLength()
return _maxLength; return _maxLength;
} }
void EditBoxImplWin::setInputFlag(EditBoxInputFlag inputFlag) void EditBoxImplWin::setInputFlag(EditBox::InputFlag inputFlag)
{ {
_editBoxInputFlag = inputFlag; _editBoxInputFlag = inputFlag;
} }
void EditBoxImplWin::setReturnType(KeyboardReturnType returnType) void EditBoxImplWin::setReturnType(EditBox::KeyboardReturnType returnType)
{ {
_keyboardReturnType = returnType; _keyboardReturnType = returnType;
} }

View File

@ -48,11 +48,11 @@ public:
virtual void setFontColor(const Color3B& color); virtual void setFontColor(const Color3B& color);
virtual void setPlaceholderFont(const char* pFontName, int fontSize); virtual void setPlaceholderFont(const char* pFontName, int fontSize);
virtual void setPlaceholderFontColor(const Color3B& color); virtual void setPlaceholderFontColor(const Color3B& color);
virtual void setInputMode(EditBoxInputMode inputMode); virtual void setInputMode(EditBox::InputMode inputMode);
virtual void setInputFlag(EditBoxInputFlag inputFlag); virtual void setInputFlag(EditBox::InputFlag inputFlag);
virtual void setMaxLength(int maxLength); virtual void setMaxLength(int maxLength);
virtual int getMaxLength(); virtual int getMaxLength();
virtual void setReturnType(KeyboardReturnType returnType); virtual void setReturnType(EditBox::KeyboardReturnType returnType);
virtual bool isEditing(); virtual bool isEditing();
virtual void setText(const char* pText); virtual void setText(const char* pText);
@ -71,9 +71,9 @@ private:
LabelTTF* _label; LabelTTF* _label;
LabelTTF* _labelPlaceHolder; LabelTTF* _labelPlaceHolder;
EditBoxInputMode _editBoxInputMode; EditBox::InputMode _editBoxInputMode;
EditBoxInputFlag _editBoxInputFlag; EditBox::InputFlag _editBoxInputFlag;
KeyboardReturnType _keyboardReturnType; EditBox::KeyboardReturnType _keyboardReturnType;
std::string _text; std::string _text;
std::string _placeHolder; std::string _placeHolder;

View File

@ -64,7 +64,7 @@ EditBoxTest::EditBoxTest()
_editPassword->setPlaceHolder("Password:"); _editPassword->setPlaceHolder("Password:");
_editPassword->setMaxLength(6); _editPassword->setMaxLength(6);
_editPassword->setInputFlag(kEditBoxInputFlagPassword); _editPassword->setInputFlag(kEditBoxInputFlagPassword);
_editPassword->setInputMode(kEditBoxInputModeSingleLine); _editPassword->setInputMode(EditBox::InputMode::SINGLE_LINE);
_editPassword->setDelegate(this); _editPassword->setDelegate(this);
addChild(_editPassword); addChild(_editPassword);

View File

@ -45,7 +45,7 @@ cc.KEYBOARD_RETURNTYPE_SEARCH = 3;
cc.KEYBOARD_RETURNTYPE_GO = 4; cc.KEYBOARD_RETURNTYPE_GO = 4;
/** /**
* The EditBoxInputMode defines the type of text that the user is allowed * to enter. * The EditBox::InputMode defines the type of text that the user is allowed * to enter.
* @constant * @constant
* @type Number * @type Number
*/ */

View File

@ -1 +1 @@
b719069e8b815e75ee76fa6f7030a04aa9b85ed9 fca740660ab4437f598bbf3c6db8841bd82ca4e8