*
*/
-#include <dali/dali.h>
-
+// CLASS HEADER
#include <dali-toolkit/internal/controls/text-input/text-input-impl.h>
-#include <dali-toolkit/internal/controls/text-view/text-processor.h>
-#include <dali-toolkit/public-api/controls/buttons/push-button.h>
-#include <dali-toolkit/public-api/controls/alignment/alignment.h>
-#include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
-
-#include <dali/integration-api/debug.h>
+// EXTERNAL INCLUDES
#include <math.h>
#include <sstream>
#include <algorithm>
+#include <dali/public-api/adaptor-framework/virtual-keyboard.h>
+#include <dali/public-api/animation/constraints.h>
+#include <dali/public-api/common/stage.h>
+#include <dali/public-api/events/key-event.h>
+#include <dali/public-api/events/touch-event.h>
+#include <dali/public-api/object/type-registry.h>
+#include <dali/public-api/object/property-notification.h>
+#include <dali/integration-api/debug.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/controls/text-view/text-processor.h>
+#include <dali-toolkit/public-api/controls/buttons/push-button.h>
+#include <dali-toolkit/public-api/controls/alignment/alignment.h>
+#include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
-using namespace std;
using namespace Dali;
// Local Data
// Private Internal methods
-void TextInput::OnHandlePan(Actor actor, PanGesture gesture)
+void TextInput::OnHandlePan(Actor actor, const PanGesture& gesture)
{
switch (gesture.state)
{
return false;
}
-void TextInput::OnDoubleTap(Dali::Actor actor, Dali::TapGesture tap)
+void TextInput::OnDoubleTap(Dali::Actor actor, const Dali::TapGesture& tap)
{
// If text exists then select nearest word.
if ( !mStyledText.empty())
}
// TODO: Change the function name to be more general.
-void TextInput::OnTextTap(Dali::Actor actor, Dali::TapGesture tap)
+void TextInput::OnTextTap(Dali::Actor actor, const Dali::TapGesture& tap)
{
DALI_LOG_INFO( gLogFilter, Debug::General, "OnTap mPreEditFlag[%s] mEditOnTouch[%s] mEditModeActive[%s] ", (mPreEditFlag)?"true":"false"
, (mEditOnTouch)?"true":"false"
}
}
-void TextInput::OnLongPress(Dali::Actor actor, Dali::LongPressGesture longPress)
+void TextInput::OnLongPress(Dali::Actor actor, const Dali::LongPressGesture& longPress)
{
DALI_LOG_INFO( gLogFilter, Debug::General, "OnLongPress\n" );
{
// Some text is selected so erase it before adding space.
DeleteHighlightedText( true );
- update = true;
}
mCursorPosition = mCursorPosition + InsertAt(Text(keyString), mCursorPosition, 0);
TextInput::HighlightInfo TextInput::CalculateHighlightInfo()
{
// At the moment there is no public API to modify the block alignment option.
- const bool blockAlignEnabled = true;
mNewHighlightInfo.mQuadList.clear(); // clear last quad information.
float rowTop = rowBottom - rowSize.height;
// Still selected, and block-align mode then set rowRight to max, so it can be clamped afterwards
- if(charSelected && blockAlignEnabled)
+ if(charSelected)
{
rowRight = std::numeric_limits<float>::max();
}
if( charSelected )
{
// if block-align mode then set rowLeft to min, so it can be clamped afterwards
- rowLeft = blockAlignEnabled ? 0.0f : charInfo.mPosition.x - mTextLayoutInfo.mScrollOffset.x;
+ rowLeft = 0.0f;
rowRight = ( charInfo.mPosition.x - mTextLayoutInfo.mScrollOffset.x ) + charInfo.mSize.width;
selectionState = SelectionStarted;
}
mNewHighlightInfo.Clamp2D( topLeft, bottomRight );
// For block-align align Further Clamp quads to max left and right extents
- if(blockAlignEnabled)
- {
// BlockAlign: Will adjust highlight to block:
// i.e.
// H[ello] (top row right = max of all rows right)
// [is some]
// [text]
// (common in regular text editors/web browser selection)
-
mNewHighlightInfo.Clamp2D( Vector2(maxRowLeft, topLeft.y), Vector2(maxRowRight, bottomRight.y ) );
- }
// Finally clamp quads again so they don't exceed the boundry of the control.
const Vector3& controlSize = GetControlSize();
++closestIndex;
}
}
- else if( closestIndex == numeric_limits<std::size_t>::max() ) // -1 RTL (after last arabic character on line)
+ else if( closestIndex == std::numeric_limits<std::size_t>::max() ) // -1 RTL (after last arabic character on line)
{
closestIndex = mTextLayoutInfo.mCharacterVisualToLogicalMap.size();
}