From a7c1904eb82d2243ad4d70dc746d519ccb5b03b5 Mon Sep 17 00:00:00 2001 From: minggo Date: Fri, 26 Jul 2013 17:45:01 +0800 Subject: [PATCH] issue #2430:move EditBox enum into class --- extensions/CCDeprecated-ext.cpp | 20 ++ extensions/CCDeprecated-ext.h | 36 ++-- extensions/GUI/CCEditBox/CCEditBox.cpp | 12 +- extensions/GUI/CCEditBox/CCEditBox.h | 199 +++++++++--------- extensions/GUI/CCEditBox/CCEditBoxImpl.h | 6 +- .../GUI/CCEditBox/CCEditBoxImplAndroid.cpp | 20 +- .../GUI/CCEditBox/CCEditBoxImplAndroid.h | 12 +- extensions/GUI/CCEditBox/CCEditBoxImplIOS.h | 6 +- extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm | 38 ++-- extensions/GUI/CCEditBox/CCEditBoxImplMac.h | 6 +- extensions/GUI/CCEditBox/CCEditBoxImplMac.mm | 6 +- .../GUI/CCEditBox/CCEditBoxImplTizen.cpp | 12 +- extensions/GUI/CCEditBox/CCEditBoxImplTizen.h | 12 +- extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp | 10 +- extensions/GUI/CCEditBox/CCEditBoxImplWin.h | 12 +- .../EditBoxTest/EditBoxTest.cpp | 2 +- .../bindings/js/jsb_cocos2d_extension.js | 2 +- .../LuaCocos2d.cpp.REMOVED.git-id | 2 +- 18 files changed, 220 insertions(+), 193 deletions(-) diff --git a/extensions/CCDeprecated-ext.cpp b/extensions/CCDeprecated-ext.cpp index af5ffd07dc..6c3c4be2d3 100644 --- a/extensions/CCDeprecated-ext.cpp +++ b/extensions/CCDeprecated-ext.cpp @@ -41,4 +41,24 @@ const Control::State CCControlStateHighlighted = Control::State::HIGH_LIGHTED; const Control::State CCControlStateDisabled = Control::State::DISABLED; 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 diff --git a/extensions/CCDeprecated-ext.h b/extensions/CCDeprecated-ext.h index 77e8255b56..245cb1b80d 100644 --- a/extensions/CCDeprecated-ext.h +++ b/extensions/CCDeprecated-ext.h @@ -131,25 +131,35 @@ CC_DEPRECATED_ATTRIBUTE typedef AttachmentType CCAttachmentType; #define kCCScrollViewDirectionHorizontal kScrollViewDirectionHorizontal #define kCCScrollViewDirectionVertical kScrollViewDirectionVertical #define kCCScrollViewDirectionBoth kScrollViewDirectionBoth -#define kCCKeyboardReturnTypeDefault kKeyboardReturnTypeDefault -#define kCCKeyboardReturnTypeDone kKeyboardReturnTypeDone -#define kCCKeyboardReturnTypeSend kKeyboardReturnTypeSend -#define kCCKeyboardReturnTypeSearch kKeyboardReturnTypeSearch -#define kCCKeyboardReturnTypeGo kKeyboardReturnTypeGo -#define kCCEditBoxInputModeAny kEditBoxInputModeAny -#define kCCEditBoxInputModeEmailAddr kEditBoxInputModeEmailAddr -#define kCCEditBoxInputModeNumeric kEditBoxInputModeNumeric -#define kCCEditBoxInputModePhoneNumber kEditBoxInputModePhoneNumber -#define kCCEditBoxInputModeUrl kEditBoxInputModeUrl -#define kCCEditBoxInputModeDecimal kEditBoxInputModeDecimal -#define kCCEditBoxInputModeSingleLine kEditBoxInputModeSingleLine +CC_DEPRECATED_ATTRIBUTE extern const EditBox::EditBox::KeyboardReturnType kKeyboardReturnTypeDefault; +CC_DEPRECATED_ATTRIBUTE extern const EditBox::EditBox::KeyboardReturnType kKeyboardReturnTypeDone; +CC_DEPRECATED_ATTRIBUTE extern const EditBox::EditBox::KeyboardReturnType kKeyboardReturnTypeSend; +CC_DEPRECATED_ATTRIBUTE extern const EditBox::EditBox::KeyboardReturnType kKeyboardReturnTypeSearch; +CC_DEPRECATED_ATTRIBUTE extern const EditBox::EditBox::KeyboardReturnType kKeyboardReturnTypeGo; + +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 kCCControlStepperPartPlus kControlStepperPartPlus #define kCCControlStepperPartNone kControlStepperPartNone - CC_DEPRECATED_ATTRIBUTE extern const Control::EventType CCControlEventTouchDown; CC_DEPRECATED_ATTRIBUTE extern const Control::EventType CCControlEventTouchDragInside; CC_DEPRECATED_ATTRIBUTE extern const Control::EventType CCControlEventTouchDragOutside; diff --git a/extensions/GUI/CCEditBox/CCEditBox.cpp b/extensions/GUI/CCEditBox/CCEditBox.cpp index 5353aebb0b..e87c8e2629 100644 --- a/extensions/GUI/CCEditBox/CCEditBox.cpp +++ b/extensions/GUI/CCEditBox/CCEditBox.cpp @@ -31,9 +31,9 @@ NS_CC_EXT_BEGIN EditBox::EditBox(void) : _editBoxImpl(NULL) , _delegate(NULL) -, _editBoxInputMode(kEditBoxInputModeSingleLine) -, _editBoxInputFlag(kEditBoxInputFlagInitialCapsAllCharacters) -, _keyboardReturnType(kKeyboardReturnTypeDefault) +, _editBoxInputMode(EditBox::InputMode::SINGLE_LINE) +, _editBoxInputFlag(EditBox::InputFlag::INTIAL_CAPS_ALL_CHARACTERS) +, _keyboardReturnType(KeyboardReturnType::DEFAULT) , _fontSize(-1) , _placeholderFontSize(-1) , _colText(Color3B::WHITE) @@ -233,7 +233,7 @@ const char* EditBox::getPlaceHolder(void) return _placeHolder.c_str(); } -void EditBox::setInputMode(EditBoxInputMode inputMode) +void EditBox::setInputMode(EditBox::InputMode inputMode) { _editBoxInputMode = inputMode; if (_editBoxImpl != NULL) @@ -257,7 +257,7 @@ int EditBox::getMaxLength() return _maxLength; } -void EditBox::setInputFlag(EditBoxInputFlag inputFlag) +void EditBox::setInputFlag(EditBox::InputFlag inputFlag) { _editBoxInputFlag = inputFlag; 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) { diff --git a/extensions/GUI/CCEditBox/CCEditBox.h b/extensions/GUI/CCEditBox/CCEditBox.h index 4d1151a137..2983ace003 100644 --- a/extensions/GUI/CCEditBox/CCEditBox.h +++ b/extensions/GUI/CCEditBox/CCEditBox.h @@ -32,98 +32,6 @@ 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 EditBoxImpl; @@ -173,6 +81,95 @@ class EditBox , public IMEDelegate { 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. * @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. - * @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. @@ -332,15 +329,15 @@ public: /** * 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. - * @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 */ virtual void setPosition(const Point& pos); @@ -362,9 +359,9 @@ protected: EditBoxImpl* _editBoxImpl; EditBoxDelegate* _delegate; - EditBoxInputMode _editBoxInputMode; - EditBoxInputFlag _editBoxInputFlag; - KeyboardReturnType _keyboardReturnType; + InputMode _editBoxInputMode; + InputFlag _editBoxInputFlag; + EditBox::KeyboardReturnType _keyboardReturnType; std::string _text; std::string _placeHolder; diff --git a/extensions/GUI/CCEditBox/CCEditBoxImpl.h b/extensions/GUI/CCEditBox/CCEditBoxImpl.h index 0cb83a847f..27f4de8ab8 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImpl.h +++ b/extensions/GUI/CCEditBox/CCEditBoxImpl.h @@ -44,11 +44,11 @@ public: virtual void setFontColor(const Color3B& color) = 0; virtual void setPlaceholderFont(const char* pFontName, int fontSize) = 0; virtual void setPlaceholderFontColor(const Color3B& color) = 0; - virtual void setInputMode(EditBoxInputMode inputMode) = 0; - virtual void setInputFlag(EditBoxInputFlag inputFlag) = 0; + virtual void setInputMode(EditBox::InputMode inputMode) = 0; + virtual void setInputFlag(EditBox::InputFlag inputFlag) = 0; virtual void setMaxLength(int maxLength) = 0; virtual int getMaxLength() = 0; - virtual void setReturnType(KeyboardReturnType returnType) = 0; + virtual void setReturnType(EditBox::KeyboardReturnType returnType) = 0; virtual bool isEditing() = 0; virtual void setText(const char* pText) = 0; diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp b/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp index 55e12a4206..02728a7fd4 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp +++ b/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp @@ -43,9 +43,9 @@ EditBoxImplAndroid::EditBoxImplAndroid(EditBox* pEditText) : EditBoxImpl(pEditText) , _label(NULL) , _labelPlaceHolder(NULL) -, _editBoxInputMode(kEditBoxInputModeSingleLine) -, _editBoxInputFlag(kEditBoxInputFlagInitialCapsAllCharacters) -, _keyboardReturnType(kKeyboardReturnTypeDefault) +, _editBoxInputMode(EditBox::InputMode::SINGLE_LINE) +, _editBoxInputFlag(EditBox::InputFlag::INTIAL_CAPS_ALL_CHARACTERS) +, _keyboardReturnType(EditBox::EditBox::KeyboardReturnType::DEFAULT) , _colText(Color3B::WHITE) , _colPlaceHolder(Color3B::GRAY) , _maxLength(-1) @@ -120,7 +120,7 @@ void EditBoxImplAndroid::setPlaceholderFontColor(const Color3B& color) _labelPlaceHolder->setColor(color); } -void EditBoxImplAndroid::setInputMode(EditBoxInputMode inputMode) +void EditBoxImplAndroid::setInputMode(EditBox::InputMode inputMode) { _editBoxInputMode = inputMode; } @@ -135,12 +135,12 @@ int EditBoxImplAndroid::getMaxLength() return _maxLength; } -void EditBoxImplAndroid::setInputFlag(EditBoxInputFlag inputFlag) +void EditBoxImplAndroid::setInputFlag(EditBox::InputFlag inputFlag) { _editBoxInputFlag = inputFlag; } -void EditBoxImplAndroid::setReturnType(KeyboardReturnType returnType) +void EditBoxImplAndroid::setReturnType(EditBox::KeyboardReturnType returnType) { _keyboardReturnType = returnType; } @@ -162,7 +162,7 @@ void EditBoxImplAndroid::setText(const char* pText) std::string strToShow; - if (kEditBoxInputFlagPassword == _editBoxInputFlag) + if (EditBox::InputFlag::PASSWORD == _editBoxInputFlag) { long length = cc_utf8_strlen(_text.c_str(), -1); for (long i = 0; i < length; i++) @@ -289,9 +289,9 @@ void EditBoxImplAndroid::openKeyboard() showEditTextDialogJNI( _placeHolder.c_str(), _text.c_str(), - _editBoxInputMode, - _editBoxInputFlag, - _keyboardReturnType, + (int)_editBoxInputMode, + (int)_editBoxInputFlag, + (int)_keyboardReturnType, _maxLength, editBoxCallbackFunc, (void*)this ); diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.h b/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.h index a85a6153f9..ae1b06c740 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.h +++ b/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.h @@ -48,11 +48,11 @@ public: virtual void setFontColor(const Color3B& color); virtual void setPlaceholderFont(const char* pFontName, int fontSize); virtual void setPlaceholderFontColor(const Color3B& color); - virtual void setInputMode(EditBoxInputMode inputMode); - virtual void setInputFlag(EditBoxInputFlag inputFlag); + virtual void setInputMode(EditBox::InputMode inputMode); + virtual void setInputFlag(EditBox::InputFlag inputFlag); virtual void setMaxLength(int maxLength); virtual int getMaxLength(); - virtual void setReturnType(KeyboardReturnType returnType); + virtual void setReturnType(EditBox::KeyboardReturnType returnType); virtual bool isEditing(); virtual void setText(const char* pText); @@ -71,9 +71,9 @@ public: private: LabelTTF* _label; LabelTTF* _labelPlaceHolder; - EditBoxInputMode _editBoxInputMode; - EditBoxInputFlag _editBoxInputFlag; - KeyboardReturnType _keyboardReturnType; + EditBox::InputMode _editBoxInputMode; + EditBox::InputFlag _editBoxInputFlag; + EditBox::KeyboardReturnType _keyboardReturnType; std::string _text; std::string _placeHolder; diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplIOS.h b/extensions/GUI/CCEditBox/CCEditBoxImplIOS.h index feaba09dc9..b38a45e1a9 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplIOS.h +++ b/extensions/GUI/CCEditBox/CCEditBoxImplIOS.h @@ -79,11 +79,11 @@ public: virtual void setFontColor(const Color3B& color); virtual void setPlaceholderFont(const char* pFontName, int fontSize); virtual void setPlaceholderFontColor(const Color3B& color); - virtual void setInputMode(EditBoxInputMode inputMode); - virtual void setInputFlag(EditBoxInputFlag inputFlag); + virtual void setInputMode(EditBox::InputMode inputMode); + virtual void setInputFlag(EditBox::InputFlag inputFlag); virtual void setMaxLength(int maxLength); virtual int getMaxLength(); - virtual void setReturnType(KeyboardReturnType returnType); + virtual void setReturnType(EditBox::KeyboardReturnType returnType); virtual bool isEditing(); virtual void setText(const char* pText); diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm b/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm index 73d6312860..0848178220 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm +++ b/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm @@ -394,26 +394,26 @@ void EditBoxImplIOS::setPlaceholderFontColor(const Color3B& color) _labelPlaceHolder->setColor(color); } -void EditBoxImplIOS::setInputMode(EditBoxInputMode inputMode) +void EditBoxImplIOS::setInputMode(EditBox::InputMode inputMode) { switch (inputMode) { - case kEditBoxInputModeEmailAddr: + case EditBox::InputMode::EMAIL_ADDRESS: _systemControl.textField.keyboardType = UIKeyboardTypeEmailAddress; break; - case kEditBoxInputModeNumeric: + case EditBox::InputMode::NUMERIC: _systemControl.textField.keyboardType = UIKeyboardTypeNumbersAndPunctuation; break; - case kEditBoxInputModePhoneNumber: + case EditBox::InputMode::PHONE_NUMBER: _systemControl.textField.keyboardType = UIKeyboardTypePhonePad; break; - case kEditBoxInputModeUrl: + case EditBox::InputMode::URL: _systemControl.textField.keyboardType = UIKeyboardTypeURL; break; - case kEditBoxInputModeDecimal: + case EditBox::InputMode::DECIMAL: _systemControl.textField.keyboardType = UIKeyboardTypeDecimalPad; break; - case kEditBoxInputModeSingleLine: + case EditBox::InputMode::SINGLE_LINE: _systemControl.textField.keyboardType = UIKeyboardTypeDefault; break; default: @@ -432,23 +432,23 @@ int EditBoxImplIOS::getMaxLength() return _maxTextLength; } -void EditBoxImplIOS::setInputFlag(EditBoxInputFlag inputFlag) +void EditBoxImplIOS::setInputFlag(EditBox::InputFlag inputFlag) { switch (inputFlag) { - case kEditBoxInputFlagPassword: + case EditBox::InputFlag::PASSWORD: _systemControl.textField.secureTextEntry = YES; break; - case kEditBoxInputFlagInitialCapsWord: + case EditBox::InputFlag::INITIAL_CAPS_WORD: _systemControl.textField.autocapitalizationType = UITextAutocapitalizationTypeWords; break; - case kEditBoxInputFlagInitialCapsSentence: + case EditBox::InputFlag::INITIAL_CAPS_SENTENCE: _systemControl.textField.autocapitalizationType = UITextAutocapitalizationTypeSentences; break; - case kEditBoxInputFlagInitialCapsAllCharacters: + case EditBox::InputFlag::INTIAL_CAPS_ALL_CHARACTERS: _systemControl.textField.autocapitalizationType = UITextAutocapitalizationTypeAllCharacters; break; - case kEditBoxInputFlagSensitive: + case EditBox::InputFlag::SENSITIVE: _systemControl.textField.autocorrectionType = UITextAutocorrectionTypeNo; break; default: @@ -456,22 +456,22 @@ void EditBoxImplIOS::setInputFlag(EditBoxInputFlag inputFlag) } } -void EditBoxImplIOS::setReturnType(KeyboardReturnType returnType) +void EditBoxImplIOS::setReturnType(EditBox::KeyboardReturnType returnType) { switch (returnType) { - case kKeyboardReturnTypeDefault: + case EditBox::KeyboardReturnType::DEFAULT: _systemControl.textField.returnKeyType = UIReturnKeyDefault; break; - case kKeyboardReturnTypeDone: + case EditBox::KeyboardReturnType::DONE: _systemControl.textField.returnKeyType = UIReturnKeyDone; break; - case kKeyboardReturnTypeSend: + case EditBox::KeyboardReturnType::SEND: _systemControl.textField.returnKeyType = UIReturnKeySend; break; - case kKeyboardReturnTypeSearch: + case EditBox::KeyboardReturnType::SEARCH: _systemControl.textField.returnKeyType = UIReturnKeySearch; break; - case kKeyboardReturnTypeGo: + case EditBox::KeyboardReturnType::GO: _systemControl.textField.returnKeyType = UIReturnKeyGo; break; default: diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplMac.h b/extensions/GUI/CCEditBox/CCEditBoxImplMac.h index 2a037ed246..bdab898ff2 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplMac.h +++ b/extensions/GUI/CCEditBox/CCEditBoxImplMac.h @@ -78,11 +78,11 @@ public: virtual void setFontColor(const Color3B& color); virtual void setPlaceholderFont(const char* pFontName, int fontSize); virtual void setPlaceholderFontColor(const Color3B& color); - virtual void setInputMode(EditBoxInputMode inputMode); - virtual void setInputFlag(EditBoxInputFlag inputFlag); + virtual void setInputMode(EditBox::InputMode inputMode); + virtual void setInputFlag(EditBox::InputFlag inputFlag); virtual void setMaxLength(int maxLength); virtual int getMaxLength(); - virtual void setReturnType(KeyboardReturnType returnType); + virtual void setReturnType(EditBox::KeyboardReturnType returnType); virtual bool isEditing(); virtual void setText(const char* pText); diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplMac.mm b/extensions/GUI/CCEditBox/CCEditBoxImplMac.mm index 30f68f53bb..0dfac0adc0 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplMac.mm +++ b/extensions/GUI/CCEditBox/CCEditBoxImplMac.mm @@ -298,7 +298,7 @@ void EditBoxImplMac::setPlaceholderFontColor(const Color3B& color) // 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; } -void EditBoxImplMac::setInputFlag(EditBoxInputFlag inputFlag) +void EditBoxImplMac::setInputFlag(EditBox::InputFlag inputFlag) { // TODO: NSSecureTextField } -void EditBoxImplMac::setReturnType(KeyboardReturnType returnType) +void EditBoxImplMac::setReturnType(EditBox::KeyboardReturnType returnType) { } diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplTizen.cpp b/extensions/GUI/CCEditBox/CCEditBoxImplTizen.cpp index c1e53a59a2..c5d6fda658 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplTizen.cpp +++ b/extensions/GUI/CCEditBox/CCEditBoxImplTizen.cpp @@ -44,8 +44,8 @@ EditBoxImplTizen::EditBoxImplTizen(EditBox* pEditText) : EditBoxImpl(pEditText) , _label(NULL) , _labelPlaceHolder(NULL) -, _editBoxInputMode(kEditBoxInputModeSingleLine) -, _editBoxInputFlag(kEditBoxInputFlagInitialCapsAllCharacters) +, _editBoxInputMode(EditBox::InputMode::SINGLE_LINE) +, _editBoxInputFlag(EditBox::InputFlag::INTIAL_CAPS_ALL_CHARACTERS) , _keyboardReturnType(kKeyboardReturnTypeDefault) , _colText(Color3B::WHITE) , _colPlaceHolder(Color3B::GRAY) @@ -118,7 +118,7 @@ void EditBoxImplTizen::setPlaceholderFontColor(const Color3B& color) _labelPlaceHolder->setColor(color); } -void EditBoxImplTizen::setInputMode(EditBoxInputMode inputMode) +void EditBoxImplTizen::setInputMode(EditBox::InputMode inputMode) { _editBoxInputMode = inputMode; } @@ -133,12 +133,12 @@ int EditBoxImplTizen::getMaxLength() return _maxLength; } -void EditBoxImplTizen::setInputFlag(EditBoxInputFlag inputFlag) +void EditBoxImplTizen::setInputFlag(EditBox::InputFlag inputFlag) { _editBoxInputFlag = inputFlag; } -void EditBoxImplTizen::setReturnType(KeyboardReturnType returnType) +void EditBoxImplTizen::setReturnType(EditBox::KeyboardReturnType returnType) { _keyboardReturnType = returnType; } @@ -301,7 +301,7 @@ void EditBoxImplTizen::openKeyboard() case kEditBoxInputModeUrl: keypadStyle = KEYPAD_STYLE_URL; break; - case kEditBoxInputModeSingleLine: + case EditBox::InputMode::SINGLE_LINE: bSingleLineEnabled = true; break; default: diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplTizen.h b/extensions/GUI/CCEditBox/CCEditBoxImplTizen.h index 0a69803d64..d369a10aa5 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplTizen.h +++ b/extensions/GUI/CCEditBox/CCEditBoxImplTizen.h @@ -49,11 +49,11 @@ public: virtual void setFontColor(const Color3B& color); virtual void setPlaceholderFont(const char* pFontName, int fontSize); virtual void setPlaceholderFontColor(const Color3B& color); - virtual void setInputMode(EditBoxInputMode inputMode); - virtual void setInputFlag(EditBoxInputFlag inputFlag); + virtual void setInputMode(EditBox::InputMode inputMode); + virtual void setInputFlag(EditBox::InputFlag inputFlag); virtual void setMaxLength(int maxLength); virtual int getMaxLength(); - virtual void setReturnType(KeyboardReturnType returnType); + virtual void setReturnType(EditBox::KeyboardReturnType returnType); virtual bool isEditing(); virtual void setText(const char* pText); @@ -72,9 +72,9 @@ public: private: LabelTTF* _label; LabelTTF* _labelPlaceHolder; - EditBoxInputMode _editBoxInputMode; - EditBoxInputFlag _editBoxInputFlag; - KeyboardReturnType _keyboardReturnType; + EditBox::InputMode _editBoxInputMode; + EditBox::InputFlag _editBoxInputFlag; + EditBox::KeyboardReturnType _keyboardReturnType; std::string _text; std::string _placeHolder; diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp b/extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp index af35f2f646..be95184355 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp +++ b/extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp @@ -40,8 +40,8 @@ EditBoxImplWin::EditBoxImplWin(EditBox* pEditText) : EditBoxImpl(pEditText) , _label(NULL) , _labelPlaceHolder(NULL) -, _editBoxInputMode(kEditBoxInputModeSingleLine) -, _editBoxInputFlag(kEditBoxInputFlagInitialCapsAllCharacters) +, _editBoxInputMode(EditBox::InputMode::SINGLE_LINE) +, _editBoxInputFlag(EditBox::InputFlag::INTIAL_CAPS_ALL_CHARACTERS) , _keyboardReturnType(kKeyboardReturnTypeDefault) , _colText(Color3B::WHITE) , _colPlaceHolder(Color3B::GRAY) @@ -113,7 +113,7 @@ void EditBoxImplWin::setPlaceholderFontColor(const Color3B& color) _labelPlaceHolder->setColor(color); } -void EditBoxImplWin::setInputMode(EditBoxInputMode inputMode) +void EditBoxImplWin::setInputMode(EditBox::InputMode inputMode) { _editBoxInputMode = inputMode; } @@ -128,12 +128,12 @@ int EditBoxImplWin::getMaxLength() return _maxLength; } -void EditBoxImplWin::setInputFlag(EditBoxInputFlag inputFlag) +void EditBoxImplWin::setInputFlag(EditBox::InputFlag inputFlag) { _editBoxInputFlag = inputFlag; } -void EditBoxImplWin::setReturnType(KeyboardReturnType returnType) +void EditBoxImplWin::setReturnType(EditBox::KeyboardReturnType returnType) { _keyboardReturnType = returnType; } diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplWin.h b/extensions/GUI/CCEditBox/CCEditBoxImplWin.h index 6df1e864e1..ce09eebf85 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplWin.h +++ b/extensions/GUI/CCEditBox/CCEditBoxImplWin.h @@ -48,11 +48,11 @@ public: virtual void setFontColor(const Color3B& color); virtual void setPlaceholderFont(const char* pFontName, int fontSize); virtual void setPlaceholderFontColor(const Color3B& color); - virtual void setInputMode(EditBoxInputMode inputMode); - virtual void setInputFlag(EditBoxInputFlag inputFlag); + virtual void setInputMode(EditBox::InputMode inputMode); + virtual void setInputFlag(EditBox::InputFlag inputFlag); virtual void setMaxLength(int maxLength); virtual int getMaxLength(); - virtual void setReturnType(KeyboardReturnType returnType); + virtual void setReturnType(EditBox::KeyboardReturnType returnType); virtual bool isEditing(); virtual void setText(const char* pText); @@ -71,9 +71,9 @@ private: LabelTTF* _label; LabelTTF* _labelPlaceHolder; - EditBoxInputMode _editBoxInputMode; - EditBoxInputFlag _editBoxInputFlag; - KeyboardReturnType _keyboardReturnType; + EditBox::InputMode _editBoxInputMode; + EditBox::InputFlag _editBoxInputFlag; + EditBox::KeyboardReturnType _keyboardReturnType; std::string _text; std::string _placeHolder; diff --git a/samples/Cpp/TestCpp/Classes/ExtensionsTest/EditBoxTest/EditBoxTest.cpp b/samples/Cpp/TestCpp/Classes/ExtensionsTest/EditBoxTest/EditBoxTest.cpp index 51168f33bd..d7c8b43cbf 100644 --- a/samples/Cpp/TestCpp/Classes/ExtensionsTest/EditBoxTest/EditBoxTest.cpp +++ b/samples/Cpp/TestCpp/Classes/ExtensionsTest/EditBoxTest/EditBoxTest.cpp @@ -64,7 +64,7 @@ EditBoxTest::EditBoxTest() _editPassword->setPlaceHolder("Password:"); _editPassword->setMaxLength(6); _editPassword->setInputFlag(kEditBoxInputFlagPassword); - _editPassword->setInputMode(kEditBoxInputModeSingleLine); + _editPassword->setInputMode(EditBox::InputMode::SINGLE_LINE); _editPassword->setDelegate(this); addChild(_editPassword); diff --git a/scripting/javascript/bindings/js/jsb_cocos2d_extension.js b/scripting/javascript/bindings/js/jsb_cocos2d_extension.js index b5f1411212..3272bc7765 100644 --- a/scripting/javascript/bindings/js/jsb_cocos2d_extension.js +++ b/scripting/javascript/bindings/js/jsb_cocos2d_extension.js @@ -45,7 +45,7 @@ cc.KEYBOARD_RETURNTYPE_SEARCH = 3; 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 * @type Number */ diff --git a/scripting/lua/cocos2dx_support/LuaCocos2d.cpp.REMOVED.git-id b/scripting/lua/cocos2dx_support/LuaCocos2d.cpp.REMOVED.git-id index 8fb5b810c5..aa7b94103e 100644 --- a/scripting/lua/cocos2dx_support/LuaCocos2d.cpp.REMOVED.git-id +++ b/scripting/lua/cocos2dx_support/LuaCocos2d.cpp.REMOVED.git-id @@ -1 +1 @@ -b719069e8b815e75ee76fa6f7030a04aa9b85ed9 \ No newline at end of file +fca740660ab4437f598bbf3c6db8841bd82ca4e8 \ No newline at end of file