#include <dali-toolkit/internal/text/layouts/layout-parameters.h>
#include <dali-toolkit/internal/text/markup-processor.h>
#include <dali-toolkit/internal/text/text-controller-impl.h>
+#include <dali-toolkit/internal/text/text-editable-control-interface.h>
namespace
{
// public : Constructor.
-ControllerPtr Controller::New( ControlInterface& controlInterface )
+ControllerPtr Controller::New()
+{
+ return ControllerPtr( new Controller() );
+}
+
+ControllerPtr Controller::New( ControlInterface* controlInterface )
{
return ControllerPtr( new Controller( controlInterface ) );
}
+ControllerPtr Controller::New( ControlInterface* controlInterface,
+ EditableControlInterface* editableControlInterface )
+{
+ return ControllerPtr( new Controller( controlInterface,
+ editableControlInterface ) );
+}
+
// public : Configure the text controller.
void Controller::EnableTextInput( DecoratorPtr decorator )
{
DALI_LOG_INFO( gLogFilter, Debug::General, "Controller::SetAutoScrollEnabled[%s] SingleBox[%s]-> [%p]\n", (enable)?"true":"false", ( mImpl->mLayoutEngine.GetLayout() == LayoutEngine::SINGLE_LINE_BOX)?"true":"false", this );
- if ( mImpl->mLayoutEngine.GetLayout() == LayoutEngine::SINGLE_LINE_BOX )
+ if( mImpl->mLayoutEngine.GetLayout() == LayoutEngine::SINGLE_LINE_BOX )
{
- if ( enable )
+ if( enable )
{
DALI_LOG_INFO( gLogFilter, Debug::General, "Controller::SetAutoScrollEnabled for SINGLE_LINE_BOX\n" );
mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending |
REORDER );
}
- mImpl->mAutoScrollEnabled = enable;
+ mImpl->mIsAutoScrollEnabled = enable;
mImpl->RequestRelayout();
}
else
{
DALI_LOG_WARNING( "Attempted AutoScrolling on a non SINGLE_LINE_BOX, request ignored\n" );
- mImpl->mAutoScrollEnabled = false;
+ mImpl->mIsAutoScrollEnabled = false;
}
}
bool Controller::IsAutoScrollEnabled() const
{
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::IsAutoScrollEnabled[%s]\n", (mImpl->mAutoScrollEnabled)?"true":"false" );
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::IsAutoScrollEnabled[%s]\n", mImpl->mIsAutoScrollEnabled?"true":"false" );
- return mImpl->mAutoScrollEnabled;
+ return mImpl->mIsAutoScrollEnabled;
}
CharacterDirection Controller::GetAutoScrollDirection() const
mImpl->mEventData->mEventQueue.clear();
}
- // Do this last since it provides callbacks into application code
- mImpl->mControlInterface.TextChanged();
+ // Do this last since it provides callbacks into application code.
+ if( NULL != mImpl->mEditableControlInterface )
+ {
+ mImpl->mEditableControlInterface->TextChanged();
+ }
}
void Controller::GetText( std::string& text ) const
return mImpl->mVisualModel->GetShadowColor();
}
-void Controller::SetDefaultShadowProperties( const std::string& shadowProperties )
-{
- if( NULL == mImpl->mShadowDefaults )
- {
- mImpl->mShadowDefaults = new ShadowDefaults();
- }
-
- mImpl->mShadowDefaults->properties = shadowProperties;
-}
-
-const std::string& Controller::GetDefaultShadowProperties() const
-{
- if( NULL != mImpl->mShadowDefaults )
- {
- return mImpl->mShadowDefaults->properties;
- }
-
- return EMPTY_STRING;
-}
-
void Controller::SetUnderlineColor( const Vector4& color )
{
mImpl->mVisualModel->SetUnderlineColor( color );
return mImpl->mVisualModel->GetUnderlineHeight();
}
-void Controller::SetDefaultUnderlineProperties( const std::string& underlineProperties )
-{
- if( NULL == mImpl->mUnderlineDefaults )
- {
- mImpl->mUnderlineDefaults = new UnderlineDefaults();
- }
-
- mImpl->mUnderlineDefaults->properties = underlineProperties;
-}
-
-const std::string& Controller::GetDefaultUnderlineProperties() const
-{
- if( NULL != mImpl->mUnderlineDefaults )
- {
- return mImpl->mUnderlineDefaults->properties;
- }
-
- return EMPTY_STRING;
-}
-
void Controller::SetDefaultEmbossProperties( const std::string& embossProperties )
{
if( NULL == mImpl->mEmbossDefaults )
return mImpl->mEventData->mInputStyle.shadowProperties;
}
- return GetDefaultShadowProperties();
+ return EMPTY_STRING;
}
void Controller::SetInputUnderlineProperties( const std::string& underlineProperties )
return mImpl->mEventData->mInputStyle.underlineProperties;
}
- return GetDefaultUnderlineProperties();
+ return EMPTY_STRING;
}
void Controller::SetInputEmbossProperties( const std::string& embossProperties )
Controller::UpdateTextType Controller::Relayout( const Size& size )
{
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->Controller::Relayout %p size %f,%f, autoScroll[%s]\n", this, size.width, size.height, (mImpl->mAutoScrollEnabled)?"true":"false" );
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->Controller::Relayout %p size %f,%f, autoScroll[%s]\n", this, size.width, size.height, mImpl->mIsAutoScrollEnabled ?"true":"false" );
UpdateTextType updateTextType = NONE_UPDATED;
return updateTextType;
}
+void Controller::RequestRelayout()
+{
+ mImpl->RequestRelayout();
+}
+
// public : Input style change signals.
bool Controller::IsInputStyleChangedSignalsQueueEmpty()
{
const InputStyle::Mask mask = *it;
- // Emit the input style changed signal.
- mImpl->mControlInterface.InputStyleChanged( mask );
+ if( NULL != mImpl->mEditableControlInterface )
+ {
+ // Emit the input style changed signal.
+ mImpl->mEditableControlInterface->InputStyleChanged( mask );
+ }
}
mImpl->mEventData->mInputStyleChangedQueue.Clear();
mImpl->RequestRelayout();
}
- if( textChanged )
+ if( textChanged &&
+ ( NULL != mImpl->mEditableControlInterface ) )
{
// Do this last since it provides callbacks into application code
- mImpl->mControlInterface.TextChanged();
+ mImpl->mEditableControlInterface->TextChanged();
}
return true;
ImfManager::ImfCallbackData callbackData( ( retrieveText || retrieveCursor ), cursorPosition, text, false );
- if( requestRelayout )
+ if( requestRelayout &&
+ ( NULL != mImpl->mEditableControlInterface ) )
{
// Do this last since it provides callbacks into application code
- mImpl->mControlInterface.TextChanged();
+ mImpl->mEditableControlInterface->TextChanged();
}
return callbackData;
void Controller::AddDecoration( Actor& actor, bool needsClipping )
{
- mImpl->mControlInterface.AddDecoration( actor, needsClipping );
+ if( NULL != mImpl->mEditableControlInterface )
+ {
+ mImpl->mEditableControlInterface->AddDecoration( actor, needsClipping );
+ }
}
void Controller::DecorationEvent( HandleType handleType, HandleState state, float x, float y )
mImpl->mEventData->mScrollAfterDelete = true;
mImpl->RequestRelayout();
- mImpl->mControlInterface.TextChanged();
+
+ if( NULL != mImpl->mEditableControlInterface )
+ {
+ mImpl->mEditableControlInterface->TextChanged();
+ }
break;
}
case Toolkit::TextSelectionPopup::COPY:
mImpl->ResetImfManager();
- // Do this last since it provides callbacks into application code
- mImpl->mControlInterface.MaxLengthReached();
+ if( NULL != mImpl->mEditableControlInterface )
+ {
+ // Do this last since it provides callbacks into application code
+ mImpl->mEditableControlInterface->MaxLengthReached();
+ }
}
}
mImpl->ChangeState( EventData::EDITING );
mImpl->RequestRelayout();
- // Do this last since it provides callbacks into application code
- mImpl->mControlInterface.TextChanged();
+ if( NULL != mImpl->mEditableControlInterface )
+ {
+ // Do this last since it provides callbacks into application code
+ mImpl->mEditableControlInterface->TextChanged();
+ }
}
bool Controller::RemoveText( int cursorOffset,
// private : Private contructors & copy operator.
-Controller::Controller( ControlInterface& controlInterface )
+Controller::Controller()
: mImpl( NULL )
{
- mImpl = new Controller::Impl( controlInterface );
+ mImpl = new Controller::Impl( NULL, NULL );
+}
+
+Controller::Controller( ControlInterface* controlInterface )
+{
+ mImpl = new Controller::Impl( controlInterface, NULL );
+}
+
+Controller::Controller( ControlInterface* controlInterface,
+ EditableControlInterface* editableControlInterface )
+{
+ mImpl = new Controller::Impl( controlInterface,
+ editableControlInterface );
}
// The copy constructor and operator are left unimplemented.