#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 )
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
{
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.