* A different control interface has been created for the editable text controls.
The text label doesn't need to implement the methods AddDecoration(),
TextChanged(), MaxLengthReached() and InputStyleChanged().
Change-Id: I803729d7d502b03923bae5744af887d8cfe84b57
Signed-off-by: Victor Cebollada <v.cebollada@samsung.com>
#include <dali-toolkit-test-suite-utils.h>
#include <dali-toolkit/dali-toolkit.h>
#include <dali-toolkit/internal/text/text-controller.h>
+#include <dali-toolkit/internal/text/text-control-interface.h>
+#include <dali-toolkit/internal/text/text-editable-control-interface.h>
using namespace Dali;
using namespace Toolkit;
const Size CONTROL_SIZE( 300.f, 60.f );
-class ControlImpl : public ControlInterface
+class ControlImpl : public ControlInterface, public Text::EditableControlInterface
{
public:
ControlImpl()
ToolkitTestApplication application;
// Creates a text controller.
- ControlImpl controlImpl;
- ControllerPtr controller = Controller::New( controlImpl );
+ ControllerPtr controller = Controller::New();
DALI_TEST_CHECK( controller );
ToolkitTestApplication application;
// Creates a text controller.
- ControlImpl controlImpl;
- ControllerPtr controller = Controller::New( controlImpl );
+ ControllerPtr controller = Controller::New();
DALI_TEST_CHECK( controller );
ToolkitTestApplication application;
// Creates a text controller.
- ControlImpl controlImpl;
- ControllerPtr controller = Controller::New( controlImpl );
+ ControllerPtr controller = Controller::New();
std::string text;
ImfManager::ImfEventData imfEvent;
ToolkitTestApplication application;
// Creates a text controller.
- ControlImpl controlImpl;
- ControllerPtr controller = Controller::New( controlImpl );
+ ControllerPtr controller = Controller::New();
DALI_TEST_CHECK( controller );
{
Actor self = Self();
- mController = Text::Controller::New( *this );
+ mController = Text::Controller::New( this, this );
mDecorator = Text::Decorator::New( *mController,
*mController );
mRenderer = Backend::Get().NewRenderer( mRenderingBackend );
}
- EnableClipping( true, size );
+ EnableClipping( size );
RenderText( updateTextType );
}
return mController->KeyEvent( event );
}
-void TextEditor::AddDecoration( Actor& actor, bool needsClipping )
-{
- if( actor )
- {
- if( needsClipping )
- {
- mClippingDecorationActors.push_back( actor );
- }
- else
- {
- Self().Add( actor );
- }
- }
-}
-
void TextEditor::RequestTextRelayout()
{
RelayoutRequest();
mTextChangedSignal.Emit( handle );
}
+void TextEditor::MaxLengthReached()
+{
+ // Nothing to do as TextEditor doesn't emit a max length reached signal.
+}
+
void TextEditor::InputStyleChanged( Text::InputStyle::Mask inputStyleMask )
{
Dali::Toolkit::TextEditor handle( GetOwner() );
mInputStyleChangedSignal.Emit( handle, editorInputStyleMask );
}
-void TextEditor::MaxLengthReached()
+void TextEditor::AddDecoration( Actor& actor, bool needsClipping )
{
- // Nothing to do as TextEditor doesn't emit a max length reached signal.
+ if( actor )
+ {
+ if( needsClipping )
+ {
+ mClippingDecorationActors.push_back( actor );
+ }
+ else
+ {
+ Self().Add( actor );
+ }
+ }
}
void TextEditor::OnStageConnect( Dali::Actor actor )
}
}
-void TextEditor::EnableClipping( bool clipping, const Vector2& size )
+void TextEditor::EnableClipping( const Vector2& size )
{
- if( clipping )
+ // Not worth to created clip actor if width or height is equal to zero.
+ if( size.width > Math::MACHINE_EPSILON_1000 && size.height > Math::MACHINE_EPSILON_1000 )
{
- // Not worth to created clip actor if width or height is equal to zero.
- if( size.width > Math::MACHINE_EPSILON_1000 && size.height > Math::MACHINE_EPSILON_1000 )
+ if( !mClipper )
{
- if( !mClipper )
- {
- Actor self = Self();
+ Actor self = Self();
- mClipper = Clipper::New( size );
- self.Add( mClipper->GetRootActor() );
- self.Add( mClipper->GetImageView() );
- }
- else if ( mClipper )
- {
- mClipper->Refresh( size );
- }
+ mClipper = Clipper::New( size );
+ self.Add( mClipper->GetRootActor() );
+ self.Add( mClipper->GetImageView() );
+ }
+ else if ( mClipper )
+ {
+ mClipper->Refresh( size );
}
- }
- else
- {
- // Note - this will automatically remove the root actor & the image view
- mClipper.Reset();
}
}
-#ifndef __DALI_TOOLKIT_INTERNAL_TEXT_EDITOR_H__
-#define __DALI_TOOLKIT_INTERNAL_TEXT_EDITOR_H__
+#ifndef DALI_TOOLKIT_INTERNAL_TEXT_EDITOR_H
+#define DALI_TOOLKIT_INTERNAL_TEXT_EDITOR_H
/*
* Copyright (c) 2016 Samsung Electronics Co., Ltd.
#include <dali-toolkit/internal/text/clipping/text-clipper.h>
#include <dali-toolkit/internal/text/decorator/text-decorator.h>
#include <dali-toolkit/internal/text/text-control-interface.h>
+#include <dali-toolkit/internal/text/text-editable-control-interface.h>
#include <dali-toolkit/internal/text/text-controller.h>
#include <dali-toolkit/internal/text/rendering/text-renderer.h>
/**
* @brief A control which renders a long text string with styles.
*/
-class TextEditor : public Control, public Text::ControlInterface
+class TextEditor : public Control, public Text::ControlInterface, public Text::EditableControlInterface
{
public:
// From ControlInterface
/**
- * @copydoc Text::ControlInterface::AddDecoration()
- */
- virtual void AddDecoration( Actor& actor, bool needsClipping );
-
- /**
* @copydoc Text::ControlInterface::RequestTextRelayout()
*/
virtual void RequestTextRelayout();
+// From EditableControlInterface
+
/**
* @copydoc Text::ControlInterface::TextChanged()
*/
*/
virtual void InputStyleChanged( Text::InputStyle::Mask inputStyleMask );
+ /**
+ * @copydoc Text::ControlInterface::AddDecoration()
+ */
+ virtual void AddDecoration( Actor& actor, bool needsClipping );
+
private: // Implementation
/**
/**
* @brief Enable or disable clipping.
*
- * @param[in] clipping True if clipping should be enabled.
* @param[in] size The area to clip within.
*/
- void EnableClipping( bool clipping, const Vector2& size );
+ void EnableClipping( const Vector2& size );
/**
* @brief Callback when keyboard is shown/hidden.
} // namespace Dali
-#endif // __DALI_TOOLKIT_INTERNAL_TEXT_EDITOR_H__
+#endif // DALI_TOOLKIT_INTERNAL_TEXT_EDITOR_H
{
Actor self = Self();
- mController = Text::Controller::New( *this );
+ mController = Text::Controller::New( this, this );
// When using the vector-based rendering, the size of the GLyphs are different
TextAbstraction::GlyphType glyphType = (Text::RENDERING_VECTOR_BASED == mRenderingBackend) ? TextAbstraction::VECTOR_GLYPH : TextAbstraction::BITMAP_GLYPH;
mRenderer = Backend::Get().NewRenderer( mRenderingBackend );
}
- EnableClipping( ( Dali::Toolkit::TextField::EXCEED_POLICY_CLIP == mExceedPolicy ), size );
+ EnableClipping( size );
RenderText( updateTextType );
}
return mController->KeyEvent( event );
}
-void TextField::AddDecoration( Actor& actor, bool needsClipping )
-{
- if( actor )
- {
- if( needsClipping )
- {
- mClippingDecorationActors.push_back( actor );
- }
- else
- {
- Self().Add( actor );
- }
- }
-}
-
void TextField::RequestTextRelayout()
{
RelayoutRequest();
mTextChangedSignal.Emit( handle );
}
+void TextField::MaxLengthReached()
+{
+ Dali::Toolkit::TextField handle( GetOwner() );
+ mMaxLengthReachedSignal.Emit( handle );
+}
+
void TextField::InputStyleChanged( Text::InputStyle::Mask inputStyleMask )
{
Dali::Toolkit::TextField handle( GetOwner() );
mInputStyleChangedSignal.Emit( handle, fieldInputStyleMask );
}
+void TextField::AddDecoration( Actor& actor, bool needsClipping )
+{
+ if( actor )
+ {
+ if( needsClipping )
+ {
+ mClippingDecorationActors.push_back( actor );
+ }
+ else
+ {
+ Self().Add( actor );
+ }
+ }
+}
+
void TextField::OnStageConnect( Dali::Actor actor )
{
if ( mHasBeenStaged )
}
}
-void TextField::MaxLengthReached()
-{
- Dali::Toolkit::TextField handle( GetOwner() );
- mMaxLengthReachedSignal.Emit( handle );
-}
-
ImfManager::ImfCallbackData TextField::OnImfEvent( Dali::ImfManager& imfManager, const ImfManager::ImfEventData& imfEvent )
{
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField::OnImfEvent %p eventName %d\n", mController.Get(), imfEvent.eventName );
}
}
-void TextField::EnableClipping( bool clipping, const Vector2& size )
+void TextField::EnableClipping( const Vector2& size )
{
- if( clipping )
+ if( Dali::Toolkit::TextField::EXCEED_POLICY_CLIP == mExceedPolicy )
{
// Not worth to created clip actor if width or height is equal to zero.
if( size.width > Math::MACHINE_EPSILON_1000 && size.height > Math::MACHINE_EPSILON_1000 )
-#ifndef __DALI_TOOLKIT_INTERNAL_TEXT_FIELD_H__
-#define __DALI_TOOLKIT_INTERNAL_TEXT_FIELD_H__
+#ifndef DALI_TOOLKIT_INTERNAL_TEXT_FIELD_H
+#define DALI_TOOLKIT_INTERNAL_TEXT_FIELD_H
/*
* Copyright (c) 2016 Samsung Electronics Co., Ltd.
#include <dali-toolkit/internal/text/clipping/text-clipper.h>
#include <dali-toolkit/internal/text/decorator/text-decorator.h>
#include <dali-toolkit/internal/text/text-control-interface.h>
+#include <dali-toolkit/internal/text/text-editable-control-interface.h>
#include <dali-toolkit/internal/text/text-controller.h>
#include <dali-toolkit/internal/text/rendering/text-renderer.h>
/**
* @brief A control which renders a short text string.
*/
-class TextField : public Control, public Text::ControlInterface
+class TextField : public Control, public Text::ControlInterface, public Text::EditableControlInterface
{
public:
// From ControlInterface
/**
- * @copydoc Text::ControlInterface::AddDecoration()
- */
- virtual void AddDecoration( Actor& actor, bool needsClipping );
-
- /**
* @copydoc Text::ControlInterface::RequestTextRelayout()
*/
virtual void RequestTextRelayout();
+// From EditableControlInterface
+
/**
* @copydoc Text::ControlInterface::TextChanged()
*/
*/
virtual void InputStyleChanged( Text::InputStyle::Mask inputStyleMask );
+ /**
+ * @copydoc Text::ControlInterface::AddDecoration()
+ */
+ virtual void AddDecoration( Actor& actor, bool needsClipping );
+
private: // Implementation
/**
/**
* @brief Enable or disable clipping.
*
- * @param[in] clipping True if clipping should be enabled.
* @param[in] size The area to clip within.
*/
- void EnableClipping( bool clipping, const Vector2& size );
+ void EnableClipping( const Vector2& size );
/**
* @brief Callback when keyboard is shown/hidden.
} // namespace Dali
-#endif // __DALI_TOOLKIT_INTERNAL_TEXT_FIELD_H__
+#endif // DALI_TOOLKIT_INTERNAL_TEXT_FIELD_H
{
Actor self = Self();
- mController = Text::Controller::New( *this );
+ mController = Text::Controller::New( this );
// When using the vector-based rendering, the size of the GLyphs are different
TextAbstraction::GlyphType glyphType = (Text::RENDERING_VECTOR_BASED == mRenderingBackend) ? TextAbstraction::VECTOR_GLYPH : TextAbstraction::BITMAP_GLYPH;
}
}
-void TextLabel::AddDecoration( Actor& actor, bool needsClipping )
-{
- // TextLabel does not show decorations
-}
-
void TextLabel::OnStageConnection( int depth )
{
// Call the Control::OnStageConnection() to set the depth of the background.
// The depth of the text renderer is set in the RenderText() called from OnRelayout().
}
-void TextLabel::TextChanged()
-{
- // TextLabel does not provide a signal for this.
-}
-
-void TextLabel::MaxLengthReached()
-{
- // Pure Virtual from TextController Interface, only needed when inputting text
-}
-
-void TextLabel::InputStyleChanged( Text::InputStyle::Mask inputStyleMask )
-{
- // TextLabel does not provide a signal for this.
-}
-
void TextLabel::ScrollingFinished()
{
// Pure Virtual from TextScroller Interface
-#ifndef __DALI_TOOLKIT_INTERNAL_TEXT_LABEL_H__
-#define __DALI_TOOLKIT_INTERNAL_TEXT_LABEL_H__
+#ifndef DALI_TOOLKIT_INTERNAL_TEXT_LABEL_H
+#define DALI_TOOLKIT_INTERNAL_TEXT_LABEL_H
/*
* Copyright (c) 2016 Samsung Electronics Co., Ltd.
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/public-api/controls/text-controls/text-label.h>
+#include <dali-toolkit/internal/text/text-control-interface.h>
#include <dali-toolkit/internal/text/text-controller.h>
#include <dali-toolkit/internal/text/text-scroller-interface.h>
#include <dali-toolkit/internal/text/rendering/text-renderer.h>
virtual float GetHeightForWidth( float width );
/**
- * @copydoc Text::ControlInterface::AddDecoration()
- */
- virtual void AddDecoration( Actor& actor, bool needsClipping );
-
- /**
* @copydoc Control::OnStageConnection()
*/
virtual void OnStageConnection( int depth );
+// From ControlInterface
+
/**
* @copydoc Text::ControlInterface::RequestTextRelayout()
*/
virtual void RequestTextRelayout();
- /**
- * @copydoc Text::ControlInterface::TextChanged()
- */
- virtual void TextChanged();
-
- /**
- * @copydoc Text::ControlInterface::MaxLengthReached()
- */
- virtual void MaxLengthReached();
-
- /**
- * @copydoc Text::ControlInterface::InputStyleChanged()
- */
- virtual void InputStyleChanged( Text::InputStyle::Mask inputStyleMask );
-
private: // from TextScroller
/**
} // namespace Dali
-#endif // __DALI_TOOLKIT_INTERNAL_TEXT_LABEL_H__
+#endif // DALI_TOOLKIT_INTERNAL_TEXT_LABEL_H
$(toolkit_src_dir)/text/property-string-parser.cpp \
$(toolkit_src_dir)/text/segmentation.cpp \
$(toolkit_src_dir)/text/shaper.cpp \
- $(toolkit_src_dir)/text/text-control-interface.cpp \
$(toolkit_src_dir)/text/text-controller.cpp \
$(toolkit_src_dir)/text/text-controller-impl.cpp \
$(toolkit_src_dir)/text/text-effects-style.cpp \
+++ /dev/null
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include <dali-toolkit/internal/text/text-control-interface.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace Text
-{
-
-ControlInterface::ControlInterface()
-{
-}
-
-ControlInterface::~ControlInterface()
-{
-}
-
-} // namespace Text
-
-} // namespace Toolkit
-
-} // namespace Dali
-#ifndef __DALI_TOOLKIT_TEXT_CONTROL_INTERFACE_H__
-#define __DALI_TOOLKIT_TEXT_CONTROL_INTERFACE_H__
+#ifndef DALI_TOOLKIT_TEXT_CONTROL_INTERFACE_H
+#define DALI_TOOLKIT_TEXT_CONTROL_INTERFACE_H
/*
* Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
*/
-// INTERNAL INCLUDES
-#include <dali-toolkit/internal/text/input-style.h>
-
namespace Dali
{
-class Actor;
-
namespace Toolkit
{
public:
/**
- * @brief Constructor.
- */
- ControlInterface();
-
- /**
* @brief Virtual destructor.
*/
- virtual ~ControlInterface();
-
- /**
- * @brief Add a decoration.
- *
- * @param[in] decoration The actor displaying a decoration.
- * @param[in] needsClipping Whether the actor needs clipping.
- */
- virtual void AddDecoration( Actor& actor, bool needsClipping ) = 0;
+ virtual ~ControlInterface()
+ {}
/**
* @brief Called to request a text relayout.
*/
virtual void RequestTextRelayout() = 0;
-
- /**
- * @brief Called to signal that text has been inserted or deleted.
- */
- virtual void TextChanged() = 0;
-
- /**
- * @brief Called when the number of characters to be inserted exceeds the maximum limit
- */
- virtual void MaxLengthReached() = 0;
-
- /**
- * @brief Called to signal that input style has been changed.
- *
- * @param[in] inputStyleMask Mask with the bits of the input style that has changed.
- */
- virtual void InputStyleChanged( InputStyle::Mask inputStyleMask ) = 0;
};
} // namespace Text
} // namespace Dali
-#endif // __DALI_TOOLKIT_TEXT_CONTROL_INTERFACE_H__
+#endif // DALI_TOOLKIT_TEXT_CONTROL_INTERFACE_H
#include <dali-toolkit/internal/text/multi-language-support.h>
#include <dali-toolkit/internal/text/segmentation.h>
#include <dali-toolkit/internal/text/shaper.h>
+#include <dali-toolkit/internal/text/text-control-interface.h>
#include <dali-toolkit/internal/text/text-run-container.h>
namespace
void Controller::Impl::RequestRelayout()
{
- mControlInterface.RequestTextRelayout();
+ if( NULL != mControlInterface )
+ {
+ mControlInterface->RequestTextRelayout();
+ }
}
} // namespace Text
-#ifndef __DALI_TOOLKIT_TEXT_CONTROLLER_IMPL_H__
-#define __DALI_TOOLKIT_TEXT_CONTROLLER_IMPL_H__
+#ifndef DALI_TOOLKIT_TEXT_CONTROLLER_IMPL_H
+#define DALI_TOOLKIT_TEXT_CONTROLLER_IMPL_H
/*
* Copyright (c) 2016 Samsung Electronics Co., Ltd.
struct Controller::Impl
{
- Impl( ControlInterface& controlInterface )
+ Impl( ControlInterface* controlInterface,
+ EditableControlInterface* editableControlInterface )
: mControlInterface( controlInterface ),
+ mEditableControlInterface( editableControlInterface ),
mLogicalModel(),
mVisualModel(),
mFontDefaults( NULL ),
public:
- ControlInterface& mControlInterface; ///< Reference to the text controller.
+ ControlInterface* mControlInterface; ///< Reference to the text controller.
+ EditableControlInterface* mEditableControlInterface; ///< Reference to the editable text controller.
LogicalModelPtr mLogicalModel; ///< Pointer to the logical model.
VisualModelPtr mVisualModel; ///< Pointer to the visual model.
FontDefaults* mFontDefaults; ///< Avoid allocating this when the user does not specify a font.
} // namespace Dali
-#endif // __DALI_TOOLKIT_TEXT_CONTROLLER_H__
+#endif // DALI_TOOLKIT_TEXT_CONTROLLER_H
#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.
-#ifndef __DALI_TOOLKIT_TEXT_CONTROLLER_H__
-#define __DALI_TOOLKIT_TEXT_CONTROLLER_H__
+#ifndef DALI_TOOLKIT_TEXT_CONTROLLER_H
+#define DALI_TOOLKIT_TEXT_CONTROLLER_H
/*
* Copyright (c) 2016 Samsung Electronics Co., Ltd.
#include <dali-toolkit/devel-api/controls/text-controls/text-selection-popup-callback-interface.h>
#include <dali-toolkit/internal/text/decorator/text-decorator.h>
#include <dali-toolkit/internal/text/layouts/layout-engine.h>
-#include <dali-toolkit/internal/text/text-control-interface.h>
namespace Dali
{
{
class Controller;
+class ControlInterface;
+class EditableControlInterface;
class View;
typedef IntrusivePtr<Controller> ControllerPtr;
-typedef Dali::Toolkit::Text::ControlInterface ControlInterface;
/**
* @brief A Text Controller is used by UI Controls which display text.
/**
* @brief Create a new instance of a Controller.
*
- * @param[in] controlInterface An interface used to request a text relayout.
* @return A pointer to a new Controller.
*/
- static ControllerPtr New( ControlInterface& controlInterface );
+ static ControllerPtr New();
+
+ /**
+ * @brief Create a new instance of a Controller.
+ *
+ * @param[in] controlInterface The control's interface.
+ *
+ * @return A pointer to a new Controller.
+ */
+ static ControllerPtr New( ControlInterface* controlInterface );
+
+ /**
+ * @brief Create a new instance of a Controller.
+ *
+ * @param[in] controlInterface The control's interface.
+ * @param[in] editableControlInterface The editable control's interface.
+ *
+ * @return A pointer to a new Controller.
+ */
+ static ControllerPtr New( ControlInterface* controlInterface,
+ EditableControlInterface* editableControlInterface );
public: // Configure the text controller.
/**
* @brief Private constructor.
*/
- Controller( ControlInterface& controlInterface );
+ Controller();
+
+ /**
+ * @brief Private constructor.
+ */
+ Controller( ControlInterface* controlInterface );
+
+ /**
+ * @brief Private constructor.
+ */
+ Controller( ControlInterface* controlInterface,
+ EditableControlInterface* editableControlInterface );
// Undefined
Controller( const Controller& handle );
} // namespace Dali
-#endif // __DALI_TOOLKIT_TEXT_CONTROLLER_H__
+#endif // DALI_TOOLKIT_TEXT_CONTROLLER_H
--- /dev/null
+#ifndef DALI_TOOLKIT_TEXT_EDITABLE_CONTROL_INTERFACE_H
+#define DALI_TOOLKIT_TEXT_EDITABLE_CONTROL_INTERFACE_H
+
+/*
+ * Copyright (c) 2016 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/text/input-style.h>
+
+namespace Dali
+{
+
+class Actor;
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+/**
+ * @brief An interface that the Text::Controller uses to notify about text changes and add decoration to the text control.
+ */
+class EditableControlInterface
+{
+public:
+
+ /**
+ * @brief Virtual destructor.
+ */
+ virtual ~EditableControlInterface()
+ {}
+
+ /**
+ * @brief Called to signal that text has been inserted or deleted.
+ */
+ virtual void TextChanged() = 0;
+
+ /**
+ * @brief Called when the number of characters to be inserted exceeds the maximum limit
+ */
+ virtual void MaxLengthReached() = 0;
+
+ /**
+ * @brief Called to signal that input style has been changed.
+ *
+ * @param[in] inputStyleMask Mask with the bits of the input style that has changed.
+ */
+ virtual void InputStyleChanged( InputStyle::Mask inputStyleMask ) = 0;
+
+ /**
+ * @brief Add a decoration.
+ *
+ * @param[in] decoration The actor displaying a decoration.
+ * @param[in] needsClipping Whether the actor needs clipping.
+ */
+ virtual void AddDecoration( Actor& actor, bool needsClipping ) = 0;
+};
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_TEXT_EDITABLE_CONTROL_INTERFACE_H