case Toolkit::DummyControl::Property::FOCUS_VISUAL:
case Toolkit::DummyControl::Property::LABEL_VISUAL:
{
- Property::Map* map = value.GetMap();
+ const Property::Map* map = value.GetMap();
if( map != NULL )
{
VisualFactory visualFactory = VisualFactory::Get();
{
if( value.GetType() == Property::MAP )
{
- Property::Map* map = value.GetMap();
+ const Property::Map* map = value.GetMap();
const Property::Map& mapref = *map;
NewAnimator( mapref, element ); // Merge the map into element
}
const Property::Value& value = array.GetElementAt(i);
if( value.GetType() == Property::MAP )
{
- Property::Map* map = value.GetMap();
+ const Property::Map* map = value.GetMap();
NewAnimator( *map, *element );
outputAnimationData.Add( element );
}
{
if( value.GetType() == Property::MAP )
{
- Property::Map* valueMap = value.GetMap();
+ const Property::Map* valueMap = value.GetMap();
buttonImpl.mPressTransitionData.Clear();
NewAnimation( *valueMap, buttonImpl.mPressTransitionData );
}
else if( value.GetType() == Property::ARRAY )
{
- Property::Array* valueArray = value.GetArray();
+ const Property::Array* valueArray = value.GetArray();
buttonImpl.mPressTransitionData.Clear();
NewAnimation( *valueArray, buttonImpl.mPressTransitionData );
}
DALI_TEST_EQUALS( textEditor.GetProperty( DevelTextEditor::Property::SELECTED_TEXT_END ).Get<int>(), 5, TEST_LOCATION );
END_TEST;
-}
\ No newline at end of file
+}
+
+int UtcDaliTextEditorEnableEditing(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliTextEditorEnableEditing ");
+
+ TextEditor textEditor = TextEditor::New();
+
+ application.GetScene().Add( textEditor );
+
+ textEditor.SetProperty( Actor::Property::SIZE, Vector2( 300.f, 50.f ) );
+ textEditor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
+ textEditor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
+
+ // Avoid a crash when core load gl resources.
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+
+ application.SendNotification();
+ application.Render();
+
+ textEditor.SetKeyInputFocus();
+ textEditor.SetProperty( DevelTextEditor::Property::ENABLE_EDITING, false );
+ application.ProcessEvent( GenerateKey( "D", "", "D", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "D", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( textEditor.GetProperty( TextEditor::Property::TEXT ).Get<std::string>(), "", TEST_LOCATION );
+ DALI_TEST_EQUALS( textEditor.GetProperty( DevelTextEditor::Property::ENABLE_EDITING ).Get<bool>(), false, TEST_LOCATION );
+
+ textEditor.SetKeyInputFocus();
+ textEditor.SetProperty( DevelTextEditor::Property::ENABLE_EDITING, true );
+ application.ProcessEvent( GenerateKey( "D", "", "D", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "D", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( textEditor.GetProperty( TextEditor::Property::TEXT ).Get<std::string>(), "D", TEST_LOCATION );
+ DALI_TEST_EQUALS( textEditor.GetProperty( DevelTextEditor::Property::ENABLE_EDITING ).Get<bool>(), true, TEST_LOCATION );
+
+ END_TEST;
+}
END_TEST;
}
+
+int UtcDaliTextFieldEnableEditing(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliTextFieldEnableEditing ");
+
+ TextField textField = TextField::New();
+
+ application.GetScene().Add( textField );
+
+ textField.SetProperty( Actor::Property::SIZE, Vector2( 300.f, 50.f ) );
+ textField.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
+ textField.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
+
+ // Avoid a crash when core load gl resources.
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+
+ application.SendNotification();
+ application.Render();
+
+ textField.SetKeyInputFocus();
+ textField.SetProperty( DevelTextField::Property::ENABLE_EDITING, false );
+ application.ProcessEvent( GenerateKey( "D", "", "D", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "D", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( textField.GetProperty( TextField::Property::TEXT ).Get<std::string>(), "", TEST_LOCATION );
+ DALI_TEST_EQUALS( textField.GetProperty( DevelTextField::Property::ENABLE_EDITING ).Get<bool>(), false, TEST_LOCATION );
+
+
+ textField.SetKeyInputFocus();
+ textField.SetProperty( DevelTextField::Property::ENABLE_EDITING, true );
+ application.ProcessEvent( GenerateKey( "D", "", "D", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "D", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( textField.GetProperty( TextField::Property::TEXT ).Get<std::string>(), "D", TEST_LOCATION );
+ DALI_TEST_EQUALS( textField.GetProperty( DevelTextField::Property::ENABLE_EDITING ).Get<bool>(), true, TEST_LOCATION );
+
+ END_TEST;
+}
tet_infoline( "Ensure first value is a map and contains the right item" );
const Property::Value mapValue1 = contentArray->GetElementAt( 0 );
- Property::Map* map1 = mapValue1.GetMap();
+ const Property::Map* map1 = mapValue1.GetMap();
DALI_TEST_CHECK( map1 );
Property::Value* urlValue = map1->Find( ImageVisual::Property::URL );
DALI_TEST_CHECK( urlValue );
tet_infoline( "Ensure second value is a map and contains the right item" );
const Property::Value mapValue2 = contentArray->GetElementAt( 1 );
- Property::Map* map2 = mapValue2.GetMap();
+ const Property::Map* map2 = mapValue2.GetMap();
DALI_TEST_CHECK( map2 );
Property::Value* textValue = map2->Find( TextVisual::Property::TEXT );
DALI_TEST_CHECK( textValue );
}
else
{
- Property::Array* array = value.GetArray();
+ const Property::Array* array = value.GetArray();
if(array)
{
const unsigned int arraySize = array->Size();
* @details Name "selectedTextEnd", type Property::INTEGER.
*/
SELECTED_TEXT_END,
+
+ /**
+ * @brief The Editable state of control.
+ * @details Name "editable", type Property::BOOL.
+ */
+ ENABLE_EDITING,
};
} // namespace Property
*/
SELECTED_TEXT_END,
-};
+ /**
+ * @brief The Editable state of control.
+ * @details Name "editable", type Property::BOOL.
+ */
+ ENABLE_EDITING,
+};
} // namespace Property
/**
JsonParserState::JsonParserState(TreeNode* _root)
: mRoot(_root), mCurrent(_root),
- mErrorDescription(NULL), mErrorNewLine(0), mErrorColumn(0), mErrorPosition(0),
+ mErrorDescription(nullptr), mErrorNewLine(0), mErrorColumn(0), mErrorPosition(0),
mNumberOfParsedChars(0), mNumberOfCreatedNodes(0), mFirstParse(false),
mState(STATE_START)
{
- if(_root == NULL)
+ if(_root == nullptr)
{
mFirstParse = true;
}
TreeNode* JsonParserState::CreateNewNode(const char* name, TreeNode::NodeType type)
{
- TreeNode* node = NULL;
+ TreeNode* node = nullptr;
node = TreeNodeManipulator::NewTreeNode();
TreeNodeManipulator modifyNew(node);
modifyNew.SetType(type);
modifyNew.SetName(name);
- if(mRoot == NULL)
+ if(mRoot == nullptr)
{
mRoot = node;
mCurrent = TreeNodeManipulator(mRoot);
TreeNode* JsonParserState::NewNode(const char* name, TreeNode::NodeType type)
{
- TreeNode* node = NULL;
+ TreeNode* node = nullptr;
if(mFirstParse)
{
if(name)
{
const TreeNode* found = mCurrent.GetChild(name);
- if( NULL != found )
+ if( nullptr != found )
{
node = const_cast<TreeNode*>(found);
}
else
{
// if root node
- if( mCurrent.GetParent() == NULL )
+ if( mCurrent.GetParent() == nullptr )
{
node = mRoot;
}
if (static_cast<unsigned char>(*mIter) < '\x20')
{
static_cast<void>( Error("Control characters not allowed in strings") );
- return NULL;
+ return nullptr;
}
else if (*mIter == '\\' && AtLeast(2))
{
if( !AtLeast(6) )
{
static_cast<void>( Error("Bad unicode codepoint; not enough characters") );
- return NULL;
+ return nullptr;
}
if ( !HexStringToUnsignedInteger(&(*(mIter + 2)), &(*(mIter + 6)), codepoint) )
{
static_cast<void>( Error("Bad unicode codepoint") );
- return NULL;
+ return nullptr;
}
if (codepoint <= 0x7F)
default:
{
static_cast<void>( Error("Unrecognized escape sequence") );
- return NULL;
+ return nullptr;
}
}
} // ParseString()
+bool JsonParserState::HandleStartState(const char* name, const char currentChar)
+{
+ if( '{' == currentChar )
+ {
+ NewNode(name, TreeNode::OBJECT);
+ mState = STATE_OBJECT;
+ }
+ else if( '[' == currentChar )
+ {
+ NewNode(name, TreeNode::ARRAY);
+ mState = STATE_VALUE;
+ }
+ else
+ {
+ return Error("Json must start with object {} or array []");
+ }
+
+ AdvanceSkipWhiteSpace(1);
+ return true;
+}
+
+bool JsonParserState::HandleObjectState(const char currentChar, const char lastCharacter)
+{
+ if( '}' == currentChar )
+ {
+ if(',' == lastCharacter)
+ {
+ return Error("Unexpected comma");
+ }
+
+ if( !UpToParent() )
+ {
+ return false;
+ }
+ mState = STATE_VALUE;
+ }
+ else if ( '"' == currentChar )
+ {
+ mState = STATE_KEY;
+ }
+ else
+ {
+ return Error("Unexpected character");
+ }
+
+ AdvanceSkipWhiteSpace(1);
+ return true;
+}
+
+bool JsonParserState::HandleKeyState(char*& name)
+{
+ name = EncodeString();
+ if( nullptr == name )
+ {
+ return false;
+ }
+ if( !ParseWhiteSpace() )
+ {
+ return false;
+ }
+ if( ':' != Char())
+ {
+ return Error("Expected ':'");
+ }
+ if( !ParseWhiteSpace() )
+ {
+ return false;
+ }
+ mState = STATE_VALUE;
+
+ AdvanceSkipWhiteSpace(1);
+ return true;
+}
+
+bool JsonParserState::HandleCharacterQuote(char*& name)
+{
+ Advance(1);
+ NewNode(name, TreeNode::STRING);
+ if( char* value = EncodeString() )
+ {
+ mCurrent.SetString(value);
+ }
+ else
+ {
+ return false;
+ }
+ if( !UpToParent() )
+ {
+ return false;
+ }
+ AdvanceSkipWhiteSpace(0);
+ return true;
+}
+
+bool JsonParserState::HandleCharacterNumberOrHyphen(const char* name)
+{
+ NewNode(name, TreeNode::IS_NULL);
+ if( !ParseNumber() )
+ {
+ return false;
+ }
+ if( !UpToParent() )
+ {
+ return false;
+ }
+ AdvanceSkipWhiteSpace(0);
+ return true;
+}
+
+bool JsonParserState::HandleValueState(char*& name, const char currentChar, const char lastCharacter)
+{
+ bool handled = true;
+
+ if( '"' == currentChar )
+ {
+ handled = HandleCharacterQuote(name);
+ }
+ else if( IsNumber(currentChar) || currentChar == '-' )
+ {
+ handled = HandleCharacterNumberOrHyphen(name);
+ }
+ else if( '{' == currentChar )
+ {
+ handled = HandleCharacterBracesStart(name, lastCharacter);
+ }
+ else if( '}' == currentChar )
+ {
+ handled = HandleCharacterBracesEnd(lastCharacter);
+ }
+ else if( '[' == currentChar )
+ {
+ handled = HandleCharacterSquareBracketStart(name);
+ }
+ else if( ']' == currentChar )
+ {
+ handled = HandleCharacterSquareBracketEnd(lastCharacter);
+ }
+ else if( 't' == currentChar )
+ {
+ handled = HandleCharacterLowercaseT(name);
+ }
+ else if( 'n' == currentChar )
+ {
+ handled = HandleCharacterLowercaseN(name);
+ }
+ else if( 'f' == currentChar)
+ {
+ handled = HandleCharacterLowercaseF(name);
+ }
+ else if( ',' == currentChar )
+ {
+ handled = HandleCharacterComma(name);
+ }
+ else
+ {
+ handled = Error("Unexpected character");
+ }
+
+ if(handled)
+ {
+ name = nullptr;
+ }
+
+ return handled;
+}
+
bool JsonParserState::ParseJson(VectorChar& source)
{
Reset();
mIter = source.begin();
mEnd = source.end();
- char* name = NULL;
+ char* name = nullptr;
char currentChar = 0;
char lastCharacter = 0;
{
case STATE_START:
{
- if( '{' == currentChar )
- {
- NewNode(name, TreeNode::OBJECT);
- mState = STATE_OBJECT;
- }
- else if( '[' == currentChar )
+ if(!HandleStartState(name, currentChar))
{
- NewNode(name, TreeNode::ARRAY);
- mState = STATE_VALUE;
- }
- else
- {
- return Error("Json must start with object {} or array []");
+ return false;
}
-
- AdvanceSkipWhiteSpace(1);
break;
}
case STATE_OBJECT:
{
- if( '}' == currentChar )
+ if(!HandleObjectState(currentChar, lastCharacter))
{
- if(',' == lastCharacter)
- {
- return Error("Unexpected comma");
- }
-
- if( !UpToParent() )
- {
- return false;
- }
- mState = STATE_VALUE;
- }
- else if ( '"' == currentChar )
- {
- mState = STATE_KEY;
- }
- else
- {
- return Error("Unexpected character");
+ return false;
}
-
- AdvanceSkipWhiteSpace(1);
break;
}
case STATE_KEY:
{
- name = EncodeString();
- if( NULL == name )
+ if(!HandleKeyState(name))
{
return false;
}
- if( !ParseWhiteSpace() )
- {
- return false;
- }
- if( ':' != Char())
- {
- return Error("Expected ':'");
- }
- if( !ParseWhiteSpace() )
- {
- return false;
- }
- mState = STATE_VALUE;
-
- AdvanceSkipWhiteSpace(1);
break;
}
case STATE_VALUE:
{
- if( '"' == currentChar )
+ if(!HandleValueState(name, currentChar, lastCharacter))
{
- Advance(1);
- NewNode(name, TreeNode::STRING);
- if( char* value = EncodeString() )
- {
- mCurrent.SetString(value);
- }
- else
- {
- return false;
- }
- if( !UpToParent() )
- {
- return false;
- }
- AdvanceSkipWhiteSpace(0);
- }
- else if( IsNumber(currentChar) || currentChar == '-' )
- {
- NewNode(name, TreeNode::IS_NULL);
- if( !ParseNumber() )
- {
- return false;
- }
- if( !UpToParent() )
- {
- return false;
- }
- AdvanceSkipWhiteSpace(0);
- }
- else if( '{' == currentChar )
- {
- if( '}' == lastCharacter )
- {
- return Error("Expected a comma");
- }
- else
- {
- NewNode(name, TreeNode::OBJECT);
- mState = STATE_OBJECT;
- AdvanceSkipWhiteSpace(1);
- }
- }
- else if( '}' == currentChar )
- {
- if(',' == lastCharacter)
- {
- return Error("Expected another value");
- }
-
- if(mCurrent.GetType() != TreeNode::OBJECT)
- {
- return Error("Mismatched array definition");
- }
-
- if(mCurrent.GetParent() == NULL)
- {
- mState = STATE_END;
- }
- else
- {
- if( !UpToParent() )
- {
- return false;
- }
- }
- AdvanceSkipWhiteSpace(1);
- }
- else if( '[' == currentChar )
- {
- NewNode(name, TreeNode::ARRAY);
- mState = STATE_VALUE;
- AdvanceSkipWhiteSpace(1);
- }
- else if( ']' == currentChar )
- {
- if(',' == lastCharacter)
- {
- return Error("Expected a value");
- }
-
- if(mCurrent.GetType() != TreeNode::ARRAY)
- {
- return Error("Mismatched braces in object definition");
- }
-
- if(mCurrent.GetParent() == NULL)
- {
- mState = STATE_END;
- }
- else
- {
- if( !UpToParent() )
- {
- return false;
- }
- }
- AdvanceSkipWhiteSpace(1);
- }
- else if( 't' == currentChar )
- {
- NewNode(name, TreeNode::BOOLEAN);
- if( !ParseTrue() )
- {
- return false;
- }
- if( !UpToParent() )
- {
- return false;
- }
- AdvanceSkipWhiteSpace(0);
- }
- else if( 'n' == currentChar )
- {
- NewNode(name, TreeNode::IS_NULL);
- if( !ParseNULL() )
- {
- return false;
- }
- if( !UpToParent() )
- {
- return false;
- }
- AdvanceSkipWhiteSpace(0);
- }
- else if( 'f' == currentChar)
- {
- NewNode(name, TreeNode::BOOLEAN);
- if( !ParseFalse() )
- {
- return false;
- }
- if( !UpToParent() )
- {
- return false;
- }
- AdvanceSkipWhiteSpace(0);
- }
- else if( ',' == currentChar )
- {
- if( 0 == mCurrent.Size() )
- {
- return Error("Missing Value");
- }
-
- if(mCurrent.GetType() == TreeNode::OBJECT)
- {
- mState = STATE_OBJECT; // to get '"' in '"key":val'
- }
- else if(mCurrent.GetType() == TreeNode::ARRAY)
- {
- mState = STATE_VALUE; // array so just get next value
- }
- else
- {
- return Error("Unexpected character");
- }
- AdvanceSkipWhiteSpace(1);
- }
- else
- {
- return Error("Unexpected character");
+ return false;
}
-
- name = NULL;
-
break;
} // case STATE_VALUE
case STATE_END:
} // ParseJson
-
void JsonParserState::Reset()
{
mCurrent = TreeNodeManipulator(mRoot);
- mErrorDescription = NULL;
+ mErrorDescription = nullptr;
mErrorNewLine = 0;
mErrorColumn = 0;
mErrorPosition = 0;
}
+bool JsonParserState::HandleCharacterBracesStart(const char* name, const char lastCharacter)
+{
+ if( '}' == lastCharacter )
+ {
+ return Error("Expected a comma");
+ }
+ else
+ {
+ NewNode(name, TreeNode::OBJECT);
+ mState = STATE_OBJECT;
+ AdvanceSkipWhiteSpace(1);
+ }
+ return true;
+}
+
+bool JsonParserState::HandleCharacterBracesEnd(const char lastCharacter)
+{
+ if(',' == lastCharacter)
+ {
+ return Error("Expected another value");
+ }
+
+ if(mCurrent.GetType() != TreeNode::OBJECT)
+ {
+ return Error("Mismatched array definition");
+ }
+
+ if(mCurrent.GetParent() == nullptr)
+ {
+ mState = STATE_END;
+ }
+ else
+ {
+ if( !UpToParent() )
+ {
+ return false;
+ }
+ }
+ AdvanceSkipWhiteSpace(1);
+ return true;
+}
+
+bool JsonParserState::HandleCharacterSquareBracketStart(const char* name)
+{
+ NewNode(name, TreeNode::ARRAY);
+ mState = STATE_VALUE;
+ AdvanceSkipWhiteSpace(1);
+ return true;
+}
+
+bool JsonParserState::HandleCharacterSquareBracketEnd(const char lastCharacter)
+{
+ if(',' == lastCharacter)
+ {
+ return Error("Expected a value");
+ }
+
+ if(mCurrent.GetType() != TreeNode::ARRAY)
+ {
+ return Error("Mismatched braces in object definition");
+ }
+
+ if(mCurrent.GetParent() == nullptr)
+ {
+ mState = STATE_END;
+ }
+ else
+ {
+ if( !UpToParent() )
+ {
+ return false;
+ }
+ }
+ AdvanceSkipWhiteSpace(1);
+ return true;
+}
+
+bool JsonParserState::HandleCharacterLowercaseT(const char* name)
+{
+ NewNode(name, TreeNode::BOOLEAN);
+ if( !ParseTrue() )
+ {
+ return false;
+ }
+ if( !UpToParent() )
+ {
+ return false;
+ }
+ AdvanceSkipWhiteSpace(0);
+ return true;
+}
+
+bool JsonParserState::HandleCharacterLowercaseN(const char* name)
+{
+ NewNode(name, TreeNode::IS_NULL);
+ if( !ParseNULL() )
+ {
+ return false;
+ }
+ if( !UpToParent() )
+ {
+ return false;
+ }
+ AdvanceSkipWhiteSpace(0);
+ return true;
+}
+
+bool JsonParserState::HandleCharacterLowercaseF(const char* name)
+{
+ NewNode(name, TreeNode::BOOLEAN);
+ if( !ParseFalse() )
+ {
+ return false;
+ }
+ if( !UpToParent() )
+ {
+ return false;
+ }
+ AdvanceSkipWhiteSpace(0);
+ return true;
+}
+
+bool JsonParserState::HandleCharacterComma(const char* name)
+{
+ if( 0 == mCurrent.Size() )
+ {
+ return Error("Missing Value");
+ }
+
+ if(mCurrent.GetType() == TreeNode::OBJECT)
+ {
+ mState = STATE_OBJECT; // to get '"' in '"key":val'
+ }
+ else if(mCurrent.GetType() == TreeNode::ARRAY)
+ {
+ mState = STATE_VALUE; // array so just get next value
+ }
+ else
+ {
+ return Error("Unexpected character");
+ }
+ AdvanceSkipWhiteSpace(1);
+ return true;
+}
} // namespace Internal
#define DALI_JSON_PARSE_STATE_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Internal
{
-/*
+/**
* A safer std::advance()
*/
template <typename IteratorType,typename EndIteratorType>
return n;
}
-/*
+/**
* Maintains parser state machine
*
* If a NULL root node is passed in the constructor then a faster non merging parse is performed (the first pass).
class JsonParserState
{
public:
- /*
+ /**
* Constructor
* @param tree Tree to start with, pass NULL if no existing tree
*/
explicit JsonParserState(TreeNode* tree);
- /*
+ /**
* Parse json source
* The source is modified in place
* @param source The vector buffer to parse
*/
bool ParseJson(VectorChar& source);
- /*
+ /**
* Get the root node
* @return The root TreeNode
*/
TreeNode* GetRoot();
- /*
+ /**
* Get the error description of the last parse
* @return The error description or NULL if no error
*/
const char* GetErrorDescription() { return mErrorDescription; }
- /*
+ /**
* Get the error line number
* @return The line number of the error
*/
int GetErrorLineNumber() { return mErrorNewLine; }
- /*
+ /**
* Get the error column
* @return The error column
*/
int GetErrorColumn() { return mErrorColumn; }
- /*
+ /**
* Get the error position
* @return The error position
*/
int GetErrorPosition() { return mErrorPosition; }
- /*
+ /**
* Get the size of the string data that has been parsed
* @return The size of string data
*/
int GetParsedStringSize() { return mNumberOfParsedChars; };
- /*
+ /**
* Get the number of nodes created
* @return The number of nodes
*/
int mNumberOfCreatedNodes; ///< The number of nodes created
bool mFirstParse; ///< Flag if first parse
- /*
+ /**
* The current parse state
*/
enum State
JsonParserState(const JsonParserState&);
const JsonParserState& operator=(const JsonParserState&);
- /*
+ /**
* Parse over white space
* Increments the current position
* @return true if no parse errors
*/
bool ParseWhiteSpace();
- /*
+ /**
* Parse over a number, setting the current node if found
* Increments the current position. Sets error data if parse error.
* @return true if found, false if parse error
*/
bool ParseNumber();
- /*
+ /**
* Parse over a symbol
* Increments the current position. Sets error data if parse error.
* @return true if found, false if parse error
*/
bool ParseSymbol(const std::string& symbol);
- /*
+ /**
* Parse over 'true' symbol, setting the current node if found
* Increments the current position. Sets error data if parse error.
* @return true if found, false if parse error
*/
bool ParseTrue();
- /*
+ /**
* Parse over 'false' symbol, setting the current node if found
* Increments the current position. Sets error data if parse error.
* @return true if found, false if parse error
*/
bool ParseFalse();
- /*
+ /**
* Parse over 'null' symbol, setting the current node if found
* Increments the current position. Sets error data if parse error.
* @return true if found, false if parse error
*/
bool ParseNULL();
- /*
+ /**
* Parse over a string from the current position and insert escaped
* control characters in place in the string and a null terminator.
* This function works from and modifes the current buffer position.
*/
char* EncodeString();
- /*
+ /**
* Create a new node with name and type
*/
TreeNode* CreateNewNode(const char* name, TreeNode::NodeType type);
- /*
+ /**
* Create a new node if first parse, else check if the node already
* exists and set it to a new type
*/
TreeNode* NewNode(const char* name, TreeNode::NodeType type);
- /*
+ /**
* Set error meta data
* @returns always false.
*/
bool Error(const char* description);
- /*
+ /**
* Reset state for another parse
*/
void Reset();
- /*
+ /**
* Set current to its parent
* @return true if we had a parent, false and error otherwise
*/
return true;
}
- /*
+ /**
* Get the current character
*/
inline char Char()
return *mIter;
}
- /*
+ /**
* @return True if there are at least n character left
*/
inline bool AtLeast(int n)
return (mEnd - mIter) > n;
}
- /*
+ /**
* @return True if at the end of the data to parse
*/
inline bool AtEnd()
return mEnd == mIter;
}
- /*
+ /**
* Advance current position by n characters or stop at mEnd
*/
inline void Advance(int n)
mErrorColumn += c;
}
- /*
+ /**
* Advance by n charaters and return true if we reached the end
*/
inline bool AdvanceEnded(int n)
return mEnd == mIter;
}
- /*
+ /**
* Advance by at least n characters (stopping at mEnd) and skip any whitespace after n.
*/
inline void AdvanceSkipWhiteSpace(int n)
static_cast<void>( ParseWhiteSpace() );
}
- /*
+ /**
* Increment new line counters
*/
inline void NewLine()
mErrorColumn = 0;
}
+ /**
+ * @brief Called by ParseJson if we are in STATE_START.
+ *
+ * @param[in] name The current name
+ * @param[in] currentChar The current character being parsed
+ * @return true if successfully parsed
+ */
+ bool HandleStartState(const char* name, const char currentChar);
+
+ /**
+ * @brief Called by ParseJson if we are in STATE_OBJECT.
+ *
+ * @param[in] currentChar The current character being parsed
+ * @param[in] lastCharacter The last character we parsed
+ * @return true if successfully parsed
+ */
+ bool HandleObjectState(const char currentChar, const char lastCharacter);
+
+ /**
+ * @brief Called by ParseJson if we are in STATE_KEY.
+ *
+ * @param[in/out] name A reference to the name variable
+ * @return true if successfully parsed
+ */
+ bool HandleKeyState(char*& name);
+
+ /**
+ * @brief Called by ParseJson if we are in STATE_VALUE.
+ *
+ * @param[in/out] name A reference to the name variable
+ * @param[in] currentChar The current character being parsed
+ * @param[in] lastCharacter The last character we parsed
+ * @return true if successfully parsed
+ */
+ bool HandleValueState(char*& name, const char currentChar, const char lastCharacter);
+
+ /**
+ * @brief Called by HandleValueState to parse a '"' character.
+ *
+ * @param[in] name The current name
+ * @return true if successfully parsed
+ */
+ bool HandleCharacterQuote(char*& name);
+
+ /**
+ * @brief Called by HandleValueState to parse a number or hyphen character.
+ *
+ * @param[in] name The current name
+ * @return true if successfully parsed
+ */
+ bool HandleCharacterNumberOrHyphen(const char* name);
+
+ /**
+ * @brief Called by HandleValueState to parse a '{' character.
+ *
+ * @param[in] name The current name
+ * @param[in] lastCharacter The last character we parsed
+ * @return true if successfully parsed
+ */
+ bool HandleCharacterBracesStart(const char* name, const char lastCharacter);
+
+ /**
+ * @brief Called by HandleValueState to parse a '}' character.
+ *
+ * @param[in] lastCharacter The last character we parsed
+ * @return true if successfully parsed
+ */
+ bool HandleCharacterBracesEnd(const char lastCharacter);
+
+ /**
+ * @brief Called by HandleValueState to parse a '[' character.
+ *
+ * @param[in] name The current name
+ * @return true if successfully parsed
+ */
+ bool HandleCharacterSquareBracketStart(const char* name);
+
+ /**
+ * @brief Called by HandleValueState to parse a ']' character.
+ *
+ * @param[in] lastCharacter The last character we parsed
+ * @return true if successfully parsed
+ */
+ bool HandleCharacterSquareBracketEnd(const char lastCharacter);
+
+ /**
+ * @brief Called by HandleValueState to parse a 't' character.
+ *
+ * @param[in] name The current name
+ * @return true if successfully parsed
+ */
+ bool HandleCharacterLowercaseT(const char* name);
+
+ /**
+ * @brief Called by HandleValueState to parse a 'n' character.
+ *
+ * @param[in] name The current name
+ * @return true if successfully parsed
+ */
+ bool HandleCharacterLowercaseN(const char* name);
+
+ /**
+ * @brief Called by HandleValueState to parse a 'f' character.
+ *
+ * @param[in] name The current name
+ * @return true if successfully parsed
+ */
+ bool HandleCharacterLowercaseF(const char* name);
+
+ /**
+ * @brief Called by HandleValueState to parse a ',' character.
+ *
+ * @param[in] name The current name
+ * @return true if successfully parsed
+ */
+ bool HandleCharacterComma(const char* name);
};
else
{
// if its not a string then get a Property::Map from the property if possible.
- Property::Map *map = value.GetMap();
+ const Property::Map *map = value.GetMap();
if( map && !map->Empty() ) // Empty map results in current visual removal.
{
DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "CreateVisualsForComponent Using Map(%d)\n", index );
else
{
// Get a Property::Map from the property if possible.
- Property::Map* setPropertyMap = value.GetMap();
+ const Property::Map* setPropertyMap = value.GetMap();
if( setPropertyMap )
{
- TextVisual::ConvertStringKeysToIndexKeys( *setPropertyMap );
- GetImplementation( button ).MergeWithExistingLabelProperties( *setPropertyMap, outTextVisualProperties );
+ Property::Map indexKeys = TextVisual::ConvertStringKeysToIndexKeys( *setPropertyMap );
+ GetImplementation( button ).MergeWithExistingLabelProperties( indexKeys, outTextVisualProperties );
}
}
}
case Toolkit::ToggleButton::Property::TOOLTIPS:
{
- Property::Array* tipArray = value.GetArray();
+ const Property::Array* tipArray = value.GetArray();
if( tipArray )
{
std::vector<std::string> tips;
{
bool withTransitions=true;
const Property::Value* valuePtr=&value;
- Property::Map* map = value.GetMap();
+ const Property::Map* map = value.GetMap();
if(map)
{
Property::Value* value2 = map->Find("withTransitions");
case Toolkit::ImageView::Property::IMAGE:
{
std::string imageUrl;
- Property::Map* map;
+ const Property::Map* map;
if( value.Get( imageUrl ) )
{
impl.SetImage( imageUrl, ImageDimensions() );
else // Does this code make text-visual can be accepted as visual?
{
// if its not a string then get a Property::Map from the property if possible.
- Property::Map *map = value.GetMap();
+ const Property::Map *map = value.GetMap();
if( map && !map->Empty() ) // Empty map results in current visual removal.
{
progressVisual = visualFactory.CreateVisual( *map );
}
case Toolkit::ScrollBar::Property::SCROLL_POSITION_INTERVALS:
{
- Property::Array* array = value.GetArray();
+ const Property::Array* array = value.GetArray();
if( array )
{
Dali::Vector<float> positions;
{
const Property::Value& element = layouts.GetElementAt( arrayIdx );
- Property::Map* layout = element.GetMap();
+ const Property::Map* layout = element.GetMap();
if( layout != NULL )
{
for( unsigned int mapIdx = 0, mapCount = (*layout).Count(); mapIdx < mapCount; ++mapIdx )
}
case Toolkit::ScrollView::Property::SCROLL_MODE:
{
- Property::Map* map = value.GetMap();
+ const Property::Map* map = value.GetMap();
if( map )
{
scrollViewImpl.SetScrollMode( *map );
void(TableView::*funcFit)(unsigned int),
const Property::Value& value )
{
- Property::Map* map = value.GetMap();
+ const Property::Map* map = value.GetMap();
if( map )
{
unsigned int index(0);
DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextEditor, "maxLength", INTEGER, MAX_LENGTH )
DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextEditor, "selectedTextStart", INTEGER, SELECTED_TEXT_START )
DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextEditor, "selectedTextEnd", INTEGER, SELECTED_TEXT_END )
+DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextEditor, "enableEditing", BOOLEAN, ENABLE_EDITING )
DALI_SIGNAL_REGISTRATION( Toolkit, TextEditor, "textChanged", SIGNAL_TEXT_CHANGED )
DALI_SIGNAL_REGISTRATION( Toolkit, TextEditor, "inputStyleChanged", SIGNAL_INPUT_STYLE_CHANGED )
}
break;
}
+ case Toolkit::DevelTextEditor::Property::ENABLE_EDITING:
+ {
+ const bool editable = value.Get< bool >();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p ENABLE_EDITING %d\n", impl.mController.Get(), editable );
+ impl.SetEditable( editable );
+ break;
+ }
} // switch
} // texteditor
}
value = static_cast<int>(range.second);
break;
}
+ case Toolkit::DevelTextEditor::Property::ENABLE_EDITING:
+ {
+ value = impl.IsEditable();
+ break;
+ }
} //switch
}
void TextEditor::OnKeyInputFocusGained()
{
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor::OnKeyInputFocusGained %p\n", mController.Get() );
- if ( mInputMethodContext )
+ if ( mInputMethodContext && IsEditable() )
{
mInputMethodContext.StatusChangedSignal().Connect( this, &TextEditor::KeyboardStatusChanged );
void TextEditor::OnTap( const TapGesture& gesture )
{
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor::OnTap %p\n", mController.Get() );
- if ( mInputMethodContext )
+ if ( mInputMethodContext && IsEditable() )
{
mInputMethodContext.Activate();
}
void TextEditor::OnLongPress( const LongPressGesture& gesture )
{
- if ( mInputMethodContext )
+ if ( mInputMethodContext && IsEditable() )
{
mInputMethodContext.Activate();
}
}
}
+bool TextEditor::IsEditable() const
+{
+ return mController->IsEditable();
+}
+
+void TextEditor::SetEditable( bool editable )
+{
+ mController->SetEditable(editable);
+ if ( mInputMethodContext && !editable )
+ {
+ mInputMethodContext.Deactivate();
+ }
+}
+
TextEditor::TextEditor()
: Control( ControlBehaviour( CONTROL_BEHAVIOUR_DEFAULT ) ),
mAnimationPeriod( 0.0f, 0.0f ),
*/
void AddDecoration( Actor& actor, bool needsClipping ) override;
-
// From SelectableControlInterface
public:
/**
*/
Uint32Pair GetTextSelectionRange() const override;
+ /**
+ * @copydoc Text::EditableControlInterface::IsEditable()
+ */
+ bool IsEditable() const override;
+
+ /**
+ * @copydoc Text::EditableControlInterface::SetEditable()
+ */
+ void SetEditable( bool editable ) override;
+
private: // Implementation
/**
DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextField, "renderingBackend", INTEGER, RENDERING_BACKEND )
DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextField, "selectedTextStart", INTEGER, SELECTED_TEXT_START )
DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextField, "selectedTextEnd", INTEGER, SELECTED_TEXT_END )
+DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextField, "enableEditing", BOOLEAN, ENABLE_EDITING )
DALI_SIGNAL_REGISTRATION( Toolkit, TextField, "textChanged", SIGNAL_TEXT_CHANGED )
DALI_SIGNAL_REGISTRATION( Toolkit, TextField, "maxLengthReached", SIGNAL_MAX_LENGTH_REACHED )
}
break;
}
+ case Toolkit::DevelTextField::Property::ENABLE_EDITING:
+ {
+ const bool editable = value.Get< bool >();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p ENABLE_EDITING %d\n", impl.mController.Get(), editable );
+ impl.SetEditable( editable );
+ break;
+ }
} // switch
} // textfield
}
value = static_cast<int>(range.second);
break;
}
+ case Toolkit::DevelTextField::Property::ENABLE_EDITING:
+ {
+ value = impl.IsEditable();
+ break;
+ }
} //switch
}
void TextField::OnKeyInputFocusGained()
{
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField::OnKeyInputFocusGained %p\n", mController.Get() );
- if ( mInputMethodContext )
+ if ( mInputMethodContext && IsEditable() )
{
mInputMethodContext.ApplyOptions( mInputMethodOptions );
void TextField::OnTap( const TapGesture& gesture )
{
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField::OnTap %p\n", mController.Get() );
- if ( mInputMethodContext )
+ if ( mInputMethodContext && IsEditable() )
{
mInputMethodContext.Activate();
}
void TextField::OnLongPress( const LongPressGesture& gesture )
{
- if ( mInputMethodContext )
+ if ( mInputMethodContext && IsEditable() )
{
mInputMethodContext.Activate();
}
RelayoutRequest();
}
+bool TextField::IsEditable() const
+{
+ return mController->IsEditable();
+}
+
+void TextField::SetEditable( bool editable )
+{
+ mController->SetEditable(editable);
+ if ( mInputMethodContext && !editable )
+ {
+ mInputMethodContext.Deactivate();
+ }
+}
+
void TextField::TextChanged()
{
Dali::Toolkit::TextField handle( GetOwner() );
*/
void AddDecoration( Actor& actor, bool needsClipping ) override;
-
// From SelectableControlInterface
public:
/**
*/
Uint32Pair GetTextSelectionRange() const override;
+ /**
+ * @copydoc Text::EditableControlInterface::IsEditable()
+ */
+ bool IsEditable() const override;
+
+ /**
+ * @copydoc Text::EditableControlInterface::SetEditable()
+ */
+ void SetEditable( bool editable ) override;
+
private: // Implementation
/**
Toolkit::Control control = mControl.GetHandle();
if( control )
{
- Property::Map* properties = value.GetMap();
+ const Property::Map* properties = value.GetMap();
if( properties )
{
const Property::Map::SizeType count = properties->Count();
Property::Type type = value.GetType();
if( type == Property::MAP )
{
- Property::Map* map = value.GetMap();
+ const Property::Map* map = value.GetMap();
if( map )
{
mContentTextVisual.Merge( *map );
}
else if( type == Property::MAP )
{
- Property::Map* map = value.GetMap();
+ const Property::Map* map = value.GetMap();
if( map )
{
const Property::Map::SizeType count = map->Count();
void VideoView::Play()
{
- if( mOverlayRenderer )
- {
- Self().AddRenderer( mOverlayRenderer );
- }
-
mVideoPlayer.Play();
mIsPlay = true;
}
void VideoView::EmitSignalFinish()
{
- if( mOverlayRenderer )
- {
- Self().RemoveRenderer( mOverlayRenderer );
- }
-
if ( !mFinishedSignal.Empty() )
{
Dali::Toolkit::VideoView handle( GetOwner() );
mOverlayRenderer = Renderer::New( geometry, shader );
mOverlayRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::OFF );
}
+ Self().AddRenderer( mOverlayRenderer );
if( mIsPlay )
{
}
else
{
- Property::Array* array = value.GetArray();
+ const Property::Array* array = value.GetArray();
if( array )
{
const unsigned int arraySize = array->Size();
mHorizontalScrollingEnabled( false ),
mVerticalScrollingEnabled( false ),
mSmoothHandlePanEnabled( false ),
- mIsHighlightBoxActive( false )
+ mIsHighlightBoxActive( false ),
+ mHidePrimaryCursorAndGrabHandle( false )
{
mQuadVertexFormat[ "aPosition" ] = Property::VECTOR2;
mHighlightShader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER );
if( mPrimaryCursor )
{
const CursorImpl& cursor = mCursor[PRIMARY_CURSOR];
- mPrimaryCursorVisible = ( ( mControlSize.width - ( cursor.position.x + mCursorWidth ) > -Math::MACHINE_EPSILON_1000 ) &&
+ mPrimaryCursorVisible = (!mHidePrimaryCursorAndGrabHandle) && ( ( mControlSize.width - ( cursor.position.x + mCursorWidth ) > -Math::MACHINE_EPSILON_1000 ) &&
( cursor.position.x > -Math::MACHINE_EPSILON_1000 ) &&
( mControlSize.height - ( cursor.position.y + cursor.cursorHeight ) > -Math::MACHINE_EPSILON_1000 ) &&
( cursor.position.y > -Math::MACHINE_EPSILON_1000 ) );
grabHandle.verticallyVisible = ( ( ( mControlSize.height - grabHandle.lineHeight ) - grabHandle.position.y > -Math::MACHINE_EPSILON_1000 ) &&
( grabHandle.position.y > -Math::MACHINE_EPSILON_1000 ) );
- const bool isVisible = grabHandle.horizontallyVisible && grabHandle.verticallyVisible;
+ const bool isVisible = grabHandle.horizontallyVisible && grabHandle.verticallyVisible && (!mHidePrimaryCursorAndGrabHandle);
if( isVisible )
{
CreateGrabHandle();
bool mVerticalScrollingEnabled : 1; ///< Whether the vertical scrolling is enabled.
bool mSmoothHandlePanEnabled : 1; ///< Whether to pan smoothly the handles.
bool mIsHighlightBoxActive : 1; ///< Whether the highlight box is active.
+ bool mHidePrimaryCursorAndGrabHandle : 1; ///< Whether the primary cursor and grab are hidden always.
};
DecoratorPtr Decorator::New( ControllerInterface& controller,
return static_cast<int>( mImpl->mCursorWidth );
}
+void Decorator::SetEditable( bool editable )
+{
+ mImpl->mHidePrimaryCursorAndGrabHandle = !editable;
+ mImpl->Relayout( mImpl->mControlSize );
+}
/** Handles **/
void Decorator::SetHandleActive( HandleType handleType, bool active )
*/
void SetScrollSpeed( float speed );
+ /**
+ * @brief Sets Editable mode decoration.
+ *
+ * If this set to false, Primary cursor and grab will always be hidden.
+ *
+ * @param[in] isEditable enable or disable Editing.
+ */
+ void SetEditable( bool isEditable );
+
/**
* @brief Retrieves the scroll speed.
*
mIsPlaceholderElideEnabled( false ),
mPlaceholderEllipsisFlag( false ),
mShiftSelectionFlag( true ),
- mUpdateAlignment( false )
+ mUpdateAlignment( false ),
+ mEditingEnabled( true )
{
}
return range;
}
+bool Controller::Impl::IsEditable() const
+{
+ return mEventData && mEventData->mEditingEnabled;
+}
+
+void Controller::Impl::SetEditable( bool editable )
+{
+ if( mEventData)
+ {
+ mEventData->mEditingEnabled = editable;
+ }
+}
+
void Controller::Impl::RetrieveSelection( std::string& selectedText, bool deleteAfterRetrieval )
{
if( mEventData->mLeftSelectionPosition == mEventData->mRightSelectionPosition )
* If EDITING_WITH_POPUP : SELECT & SELECT_ALL
*/
+ bool isEditable = IsEditable();
TextSelectionPopup::Buttons buttonsToShow = TextSelectionPopup::NONE;
if( EventData::SELECTING == mEventData->mState )
{
- buttonsToShow = TextSelectionPopup::Buttons( TextSelectionPopup::CUT | TextSelectionPopup::COPY );
+ buttonsToShow = TextSelectionPopup::Buttons( TextSelectionPopup::COPY );
+ if(isEditable)
+ {
+ buttonsToShow = TextSelectionPopup::Buttons( buttonsToShow | TextSelectionPopup::CUT );
+ }
if( !IsClipboardEmpty() )
{
- buttonsToShow = TextSelectionPopup::Buttons ( ( buttonsToShow | TextSelectionPopup::PASTE ) );
+ if(isEditable)
+ {
+ buttonsToShow = TextSelectionPopup::Buttons ( ( buttonsToShow | TextSelectionPopup::PASTE ) );
+ }
buttonsToShow = TextSelectionPopup::Buttons ( ( buttonsToShow | TextSelectionPopup::CLIPBOARD ) );
}
if( !IsClipboardEmpty() )
{
- buttonsToShow = TextSelectionPopup::Buttons ( ( buttonsToShow | TextSelectionPopup::PASTE ) );
+ if(isEditable)
+ {
+ buttonsToShow = TextSelectionPopup::Buttons ( ( buttonsToShow | TextSelectionPopup::PASTE ) );
+ }
buttonsToShow = TextSelectionPopup::Buttons ( ( buttonsToShow | TextSelectionPopup::CLIPBOARD ) );
}
}
{
if ( !IsClipboardEmpty() )
{
- buttonsToShow = TextSelectionPopup::Buttons ( ( buttonsToShow | TextSelectionPopup::PASTE ) );
+ if(isEditable)
+ {
+ buttonsToShow = TextSelectionPopup::Buttons ( ( buttonsToShow | TextSelectionPopup::PASTE ) );
+ }
buttonsToShow = TextSelectionPopup::Buttons ( ( buttonsToShow | TextSelectionPopup::CLIPBOARD ) );
}
}
bool mPlaceholderEllipsisFlag : 1; ///< True if the text controller sets the placeholder ellipsis.
bool mShiftSelectionFlag : 1; ///< True if the text selection using Shift key is enabled.
bool mUpdateAlignment : 1; ///< True if the whole text needs to be full aligned..
+ bool mEditingEnabled : 1; ///< True if the editing is enabled, false otherwise.
};
struct ModifyEvent
Uint32Pair GetTextSelectionRange() const;
/**
+ * @copydoc Text::EditableControlInterface::IsEditable()
+ */
+ bool IsEditable() const;
+
+ /**
+ * @copydoc Text::EditableControlInterface::SetEditable()
+ */
+ void SetEditable( bool editable );
+
+ /**
* @brief Retrieves the selected text. It removes the text if the @p deleteAfterRetrieval parameter is @e true.
*
* @param[out] selectedText The selected text encoded in utf8.
else
{
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::KeyEvent %p keyString %s\n", this, keyString.c_str() );
+ if (!IsEditable()) return false;
if( !keyString.empty() )
{
}
}
+bool Controller::IsEditable() const
+{
+ return mImpl->IsEditable();
+}
+
+void Controller::SetEditable( bool editable )
+{
+ mImpl->SetEditable( editable );
+ if(mImpl->mEventData && mImpl->mEventData->mDecorator)
+ {
+ mImpl->mEventData->mDecorator->SetEditable( editable );
+ }
+}
+
void Controller::DecorationEvent( HandleType handleType, HandleState state, float x, float y )
{
DALI_ASSERT_DEBUG( mImpl->mEventData && "Unexpected DecorationEvent" );
{
case Toolkit::TextSelectionPopup::CUT:
{
+ if (!IsEditable()) return;
mImpl->SendSelectionToClipboard( true ); // Synchronous call to modify text
mImpl->mOperationsPending = ALL_OPERATIONS;
return;
}
+ if (!IsEditable()) return;
+
mImpl->mEventData->mCheckScrollAmount = true;
// The natural size needs to be re-calculated.
return removed;
}
+ if (!IsEditable()) return false;
+
// InputMethodContext is no longer handling key-events
mImpl->ClearPreEditFlag();
Uint32Pair GetTextSelectionRange() const;
/**
+ * @copydoc Text::EditableControlInterface::IsEditable()
+ */
+ virtual bool IsEditable() const;
+
+ /**
+ * @copydoc Text::EditableControlInterface::SetEditable()
+ */
+ virtual void SetEditable( bool editable );
+
+ /**
* @brief Event received from input method context
*
* @param[in] inputMethodContext The input method context.
* @param[in] needsClipping Whether the actor needs clipping.
*/
virtual void AddDecoration( Actor& actor, bool needsClipping ) = 0;
+
+ /**
+ * @brief Editable status (on/off).
+ *
+ * @return true if it can be edit, else false.
+ */
+ virtual bool IsEditable() const = 0;
+
+ /**
+ * @brief Change the editable status (on/off) .
+ *
+ * @param[in] editable The editable status.
+ */
+ virtual void SetEditable( bool editable ) = 0;
};
} // namespace Text
}
case Toolkit::DevelImageVisual::Property::PLAY_RANGE:
{
- Property::Array* array = value.GetArray();
+ const Property::Array* array = value.GetArray();
if( array )
{
mAnimationData.playRange = *array;
}
case DevelAnimatedVectorImageVisual::Action::UPDATE_PROPERTY:
{
- Property::Map* map = attributes.GetMap();
+ const Property::Map* map = attributes.GetMap();
if( map )
{
DoSetProperties( *map );
{
case DevelArcVisual::Action::UPDATE_PROPERTY:
{
- Property::Map* map = attributes.GetMap();
+ const Property::Map* map = attributes.GetMap();
if( map )
{
DoSetProperties( *map );
{
case DevelColorVisual::Action::UPDATE_PROPERTY:
{
- Property::Map* map = attributes.GetMap();
+ const Property::Map* map = attributes.GetMap();
if( map )
{
DoSetProperties( *map );
}
case Property::ARRAY:
{
- Property::Array* offsetArray = value->GetArray();
+ const Property::Array* offsetArray = value->GetArray();
if( offsetArray )
{
unsigned int numStop = offsetArray->Count();
return TextVisualPtr;
}
-void TextVisual::ConvertStringKeysToIndexKeys( Property::Map& propertyMap )
+Property::Map TextVisual::ConvertStringKeysToIndexKeys( const Property::Map& propertyMap )
{
Property::Map outMap;
outMap.Insert( indexKey, keyValue.second );
}
- propertyMap = outMap;
+ return outMap;
}
float TextVisual::GetHeightForWidth( float width )
/**
* @brief Converts all strings keys in property map to index keys. Property Map can then be merged correctly.
- * @param[in,out] propertyMap containing string keys or a mix of strings and indexes. Will be changed to index keys.
+ * @param[in] propertyMap containing string keys or a mix of strings and indexes.
+ * @return Property::Map containing index keys.
*/
- static void ConvertStringKeysToIndexKeys( Property::Map& propertyMap );
+ static Property::Map ConvertStringKeysToIndexKeys( const Property::Map& propertyMap );
/**
* @brief Retrieve the text's controller.
const Property::Value& element = array.GetElementAt( arrayIdx );
// Expect each child to be an object representing an animator:
- Property::Map* map = element.GetMap();
+ const Property::Map* map = element.GetMap();
if( map != NULL )
{
TransitionData::Animator* animator = ConvertMap( *map );
{
bool valid = true;
Vector4 controlPoints;
- Property::Array *array = value.GetArray();
+ const Property::Array* array = value.GetArray();
if( array && array->Count() >= 4 )
{
for( size_t vecIdx = 0; vecIdx < 4; ++vecIdx )
{
- Property::Value& v = array->GetElementAt(vecIdx);
+ const Property::Value& v = array->GetElementAt(vecIdx);
if( v.GetType() == Property::FLOAT )
{
controlPoints[vecIdx] = v.Get<float>();
}
else
{
- Property::Array* array = value.GetArray();
+ const Property::Array* array = value.GetArray();
if( array && array->Size() == 2 )
{
Toolkit::Visual::Transform::Policy::Type xPolicy = static_cast< Toolkit::Visual::Transform::Policy::Type >( -1 ); // Assign an invalid value so definitely changes
*/
enum ControlBehaviour
{
- CONTROL_BEHAVIOUR_DEFAULT = 0, ///< Default behaviour: Size negotiation is enabled & listens to Style Change signal, but doesn't receive event callbacks. @SINCE_1_2_10
-
- REQUIRES_KEYBOARD_NAVIGATION_SUPPORT = 1 << (CustomActorImpl::ACTOR_FLAG_COUNT + 0), ///< True if needs to support keyboard navigation @SINCE_1_0.0
-
- DISABLE_STYLE_CHANGE_SIGNALS = 1 << (CustomActorImpl::ACTOR_FLAG_COUNT + 1), ///< True if control should not monitor style change signals @SINCE_1_2_10
+ CONTROL_BEHAVIOUR_DEFAULT = 0, ///< Default behaviour: Size negotiation is enabled & listens to Style Change signal, but doesn't receive event callbacks. @SINCE_1_2_10
+ NOT_IN_USE_1 = 1 << (CustomActorImpl::ACTOR_FLAG_COUNT + 0),
+ REQUIRES_KEYBOARD_NAVIGATION_SUPPORT = 1 << (CustomActorImpl::ACTOR_FLAG_COUNT + 1), ///< True if needs to support keyboard navigation @SINCE_1_0.0
+ DISABLE_STYLE_CHANGE_SIGNALS = 1 << (CustomActorImpl::ACTOR_FLAG_COUNT + 2), ///< True if control should not monitor style change signals @SINCE_1_2_10
LAST_CONTROL_BEHAVIOUR_FLAG
};
{
const unsigned int TOOLKIT_MAJOR_VERSION = 1;
const unsigned int TOOLKIT_MINOR_VERSION = 9;
-const unsigned int TOOLKIT_MICRO_VERSION = 31;
+const unsigned int TOOLKIT_MICRO_VERSION = 32;
const char* const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
Name: dali2-toolkit
Summary: Dali 3D engine Toolkit
-Version: 1.9.31
+Version: 1.9.32
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-3-Clause and MIT