mirror of https://github.com/axmolengine/axmol.git
issue #2430:move EditBox enum into class
This commit is contained in:
parent
0b3ed85914
commit
a7c1904eb8
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -1 +1 @@
|
|||
b719069e8b815e75ee76fa6f7030a04aa9b85ed9
|
||||
fca740660ab4437f598bbf3c6db8841bd82ca4e8
|
Loading…
Reference in New Issue