${toolkit_src_dir}/text/text-controller-impl-event-handler.cpp
${toolkit_src_dir}/text/text-controller-impl-model-updater.cpp
${toolkit_src_dir}/text/text-controller-input-font-handler.cpp
+ ${toolkit_src_dir}/text/text-controller-input-properties.cpp
${toolkit_src_dir}/text/text-controller-placeholder-handler.cpp
${toolkit_src_dir}/text/text-controller-relayouter.cpp
${toolkit_src_dir}/text/text-controller-text-updater.cpp
if(mEventData)
{
mEventData->mEditingEnabled = editable;
+
+ if(mEventData->mDecorator)
+ {
+ mEventData->mDecorator->SetEditable(editable);
+ }
}
}
return actor;
}
+void Controller::Impl::RelayoutForNewLineSize()
+{
+ // relayout all characters
+ mTextUpdateInfo.mCharacterIndex = 0;
+ mTextUpdateInfo.mNumberOfCharactersToRemove = mTextUpdateInfo.mPreviousNumberOfCharacters;
+ mTextUpdateInfo.mNumberOfCharactersToAdd = mModel->mLogicalModel->mText.Count();
+ mOperationsPending = static_cast<OperationsMask>(mOperationsPending | LAYOUT);
+
+ //remove selection
+ if(mEventData && mEventData->mState == EventData::SELECTING)
+ {
+ ChangeState(EventData::EDITING);
+ }
+
+ RequestRelayout();
+}
+
+bool Controller::Impl::IsInputStyleChangedSignalsQueueEmpty()
+{
+ return (NULL == mEventData) || (0u == mEventData->mInputStyleChangedQueue.Count());
+}
+
+void Controller::Impl::ProcessInputStyleChangedSignals()
+{
+ if(mEventData)
+ {
+ if(mEditableControlInterface)
+ {
+ // Emit the input style changed signal for each mask
+ std::for_each(mEventData->mInputStyleChangedQueue.begin(),
+ mEventData->mInputStyleChangedQueue.end(),
+ [&](const auto mask) { mEditableControlInterface->InputStyleChanged(mask); } );
+ }
+
+ mEventData->mInputStyleChangedQueue.Clear();
+ }
+}
+
+void Controller::Impl::ScrollBy(Vector2 scroll)
+{
+ if(mEventData && (fabs(scroll.x) > Math::MACHINE_EPSILON_0 || fabs(scroll.y) > Math::MACHINE_EPSILON_0))
+ {
+ const Vector2& layoutSize = mModel->mVisualModel->GetLayoutSize();
+ const Vector2 currentScroll = mModel->mScrollPosition;
+
+ scroll.x = -scroll.x;
+ scroll.y = -scroll.y;
+
+ if(fabs(scroll.x) > Math::MACHINE_EPSILON_0)
+ {
+ mModel->mScrollPosition.x += scroll.x;
+ ClampHorizontalScroll(layoutSize);
+ }
+
+ if(fabs(scroll.y) > Math::MACHINE_EPSILON_0)
+ {
+ mModel->mScrollPosition.y += scroll.y;
+ ClampVerticalScroll(layoutSize);
+ }
+
+ if(mModel->mScrollPosition != currentScroll)
+ {
+ mEventData->mDecorator->UpdatePositions(mModel->mScrollPosition - currentScroll);
+ RequestRelayout();
+ }
+ }
+}
+
+float Controller::Impl::GetHorizontalScrollPosition()
+{
+ // Scroll values are negative internally so we convert them to positive numbers
+ return mEventData ? -mModel->mScrollPosition.x : 0.0f;
+}
+
+float Controller::Impl::GetVerticalScrollPosition()
+{
+ // Scroll values are negative internally so we convert them to positive numbers
+ return mEventData ? -mModel->mScrollPosition.y : 0.0f;
+}
+
void Controller::Impl::CopyUnderlinedFromLogicalToVisualModels(bool shouldClearPreUnderlineRuns)
{
//Underlined character runs for markup-processor
*/
Actor CreateBackgroundActor();
+ /**
+ * @brief fill needed relayout parameters when line size is changed & request relayout.
+ */
+ void RelayoutForNewLineSize();
+
+ /**
+ * @copydoc Controller::IsInputStyleChangedSignalsQueueEmpty
+ */
+ bool IsInputStyleChangedSignalsQueueEmpty();
+
+ /**
+ * @copydoc Controller::ProcessInputStyleChangedSignals
+ */
+ void ProcessInputStyleChangedSignals();
+
+ /**
+ * @copydoc Controller::ScrollBy()
+ */
+ void ScrollBy(Vector2 scroll);
+
+ /**
+ * @copydoc Controller::GetHorizontalScrollPosition()
+ */
+ float GetHorizontalScrollPosition();
+
+ /**
+ * @copydoc Controller::GetVerticalScrollPosition()
+ */
+ float GetVerticalScrollPosition();
+
+
public:
/**
* @brief Gets implementation from the controller handle.
--- /dev/null
+/*
+ * Copyright (c) 2021 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-controller-input-properties.h>
+
+// EXTERNAL INCLUDES
+//#include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
+//#include <dali/devel-api/adaptor-framework/window-devel.h>
+//#include <dali/integration-api/debug.h>
+#include <memory.h>
+#include <cmath>
+#include <limits>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/devel-api/text/text-enumerations-devel.h>
+#include <dali-toolkit/internal/text/text-controller-event-handler.h>
+#include <dali-toolkit/internal/text/text-controller-impl.h>
+#include <dali-toolkit/internal/text/text-controller-input-font-handler.h>
+#include <dali-toolkit/internal/text/text-controller-placeholder-handler.h>
+#include <dali-toolkit/internal/text/text-controller-relayouter.h>
+#include <dali-toolkit/internal/text/text-controller-text-updater.h>
+#include <dali-toolkit/internal/text/text-editable-control-interface.h>
+
+namespace
+{
+const std::string EMPTY_STRING("");
+}
+
+namespace Dali::Toolkit::Text
+{
+
+void Controller::InputProperties::SetInputColor(Controller& controller, const Vector4& color)
+{
+ if(controller.mImpl->mEventData)
+ {
+ controller.mImpl->mEventData->mInputStyle.textColor = color;
+ controller.mImpl->mEventData->mInputStyle.isDefaultColor = false;
+
+ if(EventData::SELECTING == controller.mImpl->mEventData->mState || EventData::EDITING == controller.mImpl->mEventData->mState || EventData::INACTIVE == controller.mImpl->mEventData->mState)
+ {
+ if(EventData::SELECTING == controller.mImpl->mEventData->mState)
+ {
+ const bool handlesCrossed = controller.mImpl->mEventData->mLeftSelectionPosition > controller.mImpl->mEventData->mRightSelectionPosition;
+
+ // Get start and end position of selection
+ const CharacterIndex startOfSelectedText = handlesCrossed ? controller.mImpl->mEventData->mRightSelectionPosition : controller.mImpl->mEventData->mLeftSelectionPosition;
+ const Length lengthOfSelectedText = (handlesCrossed ? controller.mImpl->mEventData->mLeftSelectionPosition : controller.mImpl->mEventData->mRightSelectionPosition) - startOfSelectedText;
+
+ // Add the color run.
+ const VectorBase::SizeType numberOfRuns = controller.mImpl->mModel->mLogicalModel->mColorRuns.Count();
+ controller.mImpl->mModel->mLogicalModel->mColorRuns.Resize(numberOfRuns + 1u);
+
+ ColorRun& colorRun = *(controller.mImpl->mModel->mLogicalModel->mColorRuns.Begin() + numberOfRuns);
+ colorRun.color = color;
+ colorRun.characterRun.characterIndex = startOfSelectedText;
+ colorRun.characterRun.numberOfCharacters = lengthOfSelectedText;
+
+ controller.mImpl->mTextUpdateInfo.mCharacterIndex = startOfSelectedText;
+ controller.mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = lengthOfSelectedText;
+ controller.mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = lengthOfSelectedText;
+ }
+ else
+ {
+ controller.mImpl->mTextUpdateInfo.mCharacterIndex = 0;
+ controller.mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = controller.mImpl->mTextUpdateInfo.mPreviousNumberOfCharacters;
+ controller.mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = controller.mImpl->mModel->mLogicalModel->mText.Count();
+ }
+
+ // Request to relayout.
+ controller.mImpl->mOperationsPending = static_cast<OperationsMask>(controller.mImpl->mOperationsPending | COLOR);
+ controller.mImpl->RequestRelayout();
+ }
+ }
+}
+
+const Vector4& Controller::InputProperties::GetInputColor(const Controller& controller)
+{
+ // Return event text input color if we have it, otherwise just return the default text's color
+ return controller.mImpl->mEventData ? controller.mImpl->mEventData->mInputStyle.textColor : controller.mImpl->mTextColor;
+}
+
+void Controller::InputProperties::SetInputLineSpacing(Controller& controller, float lineSpacing)
+{
+ if(controller.mImpl->mEventData)
+ {
+ controller.mImpl->mEventData->mInputStyle.lineSpacing = lineSpacing;
+ controller.mImpl->mEventData->mInputStyle.isLineSpacingDefined = true;
+ }
+}
+
+float Controller::InputProperties::GetInputLineSpacing(const Controller& controller)
+{
+ return controller.mImpl->mEventData ? controller.mImpl->mEventData->mInputStyle.lineSpacing : 0.0f;
+}
+
+void Controller::InputProperties::SetInputShadowProperties(Controller& controller, const std::string& shadowProperties)
+{
+ if(controller.mImpl->mEventData)
+ {
+ controller.mImpl->mEventData->mInputStyle.shadowProperties = shadowProperties;
+ }
+}
+
+const std::string& Controller::InputProperties::GetInputShadowProperties(const Controller& controller)
+{
+ return controller.mImpl->mEventData ? controller.mImpl->mEventData->mInputStyle.shadowProperties : EMPTY_STRING;
+}
+
+void Controller::InputProperties::SetInputUnderlineProperties(Controller& controller, const std::string& underlineProperties)
+{
+ if(controller.mImpl->mEventData)
+ {
+ controller.mImpl->mEventData->mInputStyle.underlineProperties = underlineProperties;
+ }
+}
+
+const std::string& Controller::InputProperties::GetInputUnderlineProperties(const Controller& controller)
+{
+ return controller.mImpl->mEventData ? controller.mImpl->mEventData->mInputStyle.underlineProperties : EMPTY_STRING;
+}
+
+void Controller::InputProperties::SetInputEmbossProperties(Controller& controller, const std::string& embossProperties)
+{
+ if(controller.mImpl->mEventData)
+ {
+ controller.mImpl->mEventData->mInputStyle.embossProperties = embossProperties;
+ }
+}
+
+const std::string& Controller::InputProperties::GetInputEmbossProperties(const Controller& controller)
+{
+ return controller.mImpl->mEventData ? controller.mImpl->mEventData->mInputStyle.embossProperties : controller.GetDefaultEmbossProperties();
+}
+
+void Controller::InputProperties::SetInputOutlineProperties(Controller& controller, const std::string& outlineProperties)
+{
+ if(controller.mImpl->mEventData)
+ {
+ controller.mImpl->mEventData->mInputStyle.outlineProperties = outlineProperties;
+ }
+}
+
+const std::string& Controller::InputProperties::GetInputOutlineProperties(const Controller& controller)
+{
+ return controller.mImpl->mEventData ? controller.mImpl->mEventData->mInputStyle.outlineProperties : controller.GetDefaultOutlineProperties();
+}
+
+void Controller::InputProperties::SetInputModePassword(Controller& controller, bool passwordInput)
+{
+ if(controller.mImpl->mEventData)
+ {
+ controller.mImpl->mEventData->mPasswordInput = passwordInput;
+ }
+}
+
+bool Controller::InputProperties::IsInputModePassword(Controller& controller)
+{
+ return controller.mImpl->mEventData && controller.mImpl->mEventData->mPasswordInput;
+}
+
+} // namespace Dali::Toolkit::Text
--- /dev/null
+#ifndef DALI_TOOLKIT_TEXT_CONTROLLER_INPUT_PROPERTIES_H
+#define DALI_TOOLKIT_TEXT_CONTROLLER_INPUT_PROPERTIES_H
+
+/*
+ * Copyright (c) 2021 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.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/input-method-context.h>
+#include <dali/public-api/events/gesture.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/text/text-controller.h>
+//#include <dali-toolkit/devel-api/controls/text-controls/text-label-devel.h>
+//#include <dali-toolkit/devel-api/controls/text-controls/text-selection-popup-callback-interface.h>
+//#include <dali-toolkit/devel-api/text/text-enumerations-devel.h>
+//#include <dali-toolkit/internal/text/decorator/text-decorator.h>
+//#include <dali-toolkit/internal/text/hidden-text.h>
+//#include <dali-toolkit/internal/text/input-filter.h>
+//#include <dali-toolkit/internal/text/layouts/layout-engine.h>
+//#include <dali-toolkit/internal/text/text-anchor-control-interface.h>
+//#include <dali-toolkit/internal/text/text-model-interface.h>
+//#include <dali-toolkit/internal/text/text-selectable-control-interface.h>
+//#include <dali-toolkit/public-api/text/text-enumerations.h>
+
+namespace Dali::Toolkit::Text
+{
+struct Controller::InputProperties
+{
+ static void SetInputColor(Controller& controller, const Vector4& color);
+
+ static const Vector4& GetInputColor(const Controller& controller);
+
+ static void SetInputLineSpacing(Controller& controller, float lineSpacing);
+
+ static float GetInputLineSpacing(const Controller& controller);
+
+ static void SetInputShadowProperties(Controller& controller, const std::string& shadowProperties);
+
+ static const std::string& GetInputShadowProperties(const Controller& controller);
+
+ static void SetInputUnderlineProperties(Controller& controller, const std::string& underlineProperties);
+
+ static const std::string& GetInputUnderlineProperties(const Controller& controller);
+
+ static void SetInputEmbossProperties(Controller& controller, const std::string& embossProperties);
+
+ static const std::string& GetInputEmbossProperties(const Controller& controller);
+
+ static void SetInputOutlineProperties(Controller& controller, const std::string& outlineProperties);
+
+ static const std::string& GetInputOutlineProperties(const Controller& controller);
+
+ static void SetInputModePassword(Controller& controller, bool passwordInput);
+
+ static bool IsInputModePassword(Controller& controller);
+};
+
+
+} // namespace Dali::Toolkit::Text
+
+#endif // DALI_TOOLKIT_TEXT_CONTROLLER_INPUT_PROPERTIES_H
#include <dali-toolkit/internal/text/text-controller-event-handler.h>
#include <dali-toolkit/internal/text/text-controller-impl.h>
#include <dali-toolkit/internal/text/text-controller-input-font-handler.h>
+#include <dali-toolkit/internal/text/text-controller-input-properties.h>
#include <dali-toolkit/internal/text/text-controller-placeholder-handler.h>
#include <dali-toolkit/internal/text/text-controller-relayouter.h>
#include <dali-toolkit/internal/text/text-controller-text-updater.h>
return mImpl->mOutlineDefaults ? mImpl->mOutlineDefaults->properties : EMPTY_STRING;
}
-void Controller::RelayoutForNewLineSize()
-{
- // relayout all characters
- mImpl->mTextUpdateInfo.mCharacterIndex = 0;
- mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = mImpl->mTextUpdateInfo.mPreviousNumberOfCharacters;
- mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = mImpl->mModel->mLogicalModel->mText.Count();
- mImpl->mOperationsPending = static_cast<OperationsMask>(mImpl->mOperationsPending | LAYOUT);
-
- //remove selection
- if(mImpl->mEventData && mImpl->mEventData->mState == EventData::SELECTING)
- {
- mImpl->ChangeState(EventData::EDITING);
- }
-
- mImpl->RequestRelayout();
-}
-
bool Controller::SetDefaultLineSpacing(float lineSpacing)
{
if(std::fabs(lineSpacing - mImpl->mLayoutEngine.GetDefaultLineSpacing()) > Math::MACHINE_EPSILON_1000)
mImpl->mLayoutEngine.SetDefaultLineSpacing(lineSpacing);
mImpl->mRecalculateNaturalSize = true;
- RelayoutForNewLineSize();
+ mImpl->RelayoutForNewLineSize();
return true;
}
return false;
mImpl->mLayoutEngine.SetDefaultLineSize(lineSize);
mImpl->mRecalculateNaturalSize = true;
- RelayoutForNewLineSize();
+ mImpl->RelayoutForNewLineSize();
return true;
}
return false;
void Controller::SetInputColor(const Vector4& color)
{
- if(mImpl->mEventData)
- {
- mImpl->mEventData->mInputStyle.textColor = color;
- mImpl->mEventData->mInputStyle.isDefaultColor = false;
-
- if(EventData::SELECTING == mImpl->mEventData->mState || EventData::EDITING == mImpl->mEventData->mState || EventData::INACTIVE == mImpl->mEventData->mState)
- {
- if(EventData::SELECTING == mImpl->mEventData->mState)
- {
- const bool handlesCrossed = mImpl->mEventData->mLeftSelectionPosition > mImpl->mEventData->mRightSelectionPosition;
-
- // Get start and end position of selection
- const CharacterIndex startOfSelectedText = handlesCrossed ? mImpl->mEventData->mRightSelectionPosition : mImpl->mEventData->mLeftSelectionPosition;
- const Length lengthOfSelectedText = (handlesCrossed ? mImpl->mEventData->mLeftSelectionPosition : mImpl->mEventData->mRightSelectionPosition) - startOfSelectedText;
-
- // Add the color run.
- const VectorBase::SizeType numberOfRuns = mImpl->mModel->mLogicalModel->mColorRuns.Count();
- mImpl->mModel->mLogicalModel->mColorRuns.Resize(numberOfRuns + 1u);
-
- ColorRun& colorRun = *(mImpl->mModel->mLogicalModel->mColorRuns.Begin() + numberOfRuns);
- colorRun.color = color;
- colorRun.characterRun.characterIndex = startOfSelectedText;
- colorRun.characterRun.numberOfCharacters = lengthOfSelectedText;
-
- mImpl->mTextUpdateInfo.mCharacterIndex = startOfSelectedText;
- mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = lengthOfSelectedText;
- mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = lengthOfSelectedText;
- }
- else
- {
- mImpl->mTextUpdateInfo.mCharacterIndex = 0;
- mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = mImpl->mTextUpdateInfo.mPreviousNumberOfCharacters;
- mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = mImpl->mModel->mLogicalModel->mText.Count();
- }
-
- // Request to relayout.
- mImpl->mOperationsPending = static_cast<OperationsMask>(mImpl->mOperationsPending | COLOR);
- mImpl->RequestRelayout();
- }
- }
+ InputProperties::SetInputColor(*this, color);
}
const Vector4& Controller::GetInputColor() const
{
- // Return event text input color if we have it, otherwise just return the default text's color
- return mImpl->mEventData ? mImpl->mEventData->mInputStyle.textColor : mImpl->mTextColor;
+ return InputProperties::GetInputColor(*this);
}
void Controller::SetInputFontFamily(const std::string& fontFamily)
void Controller::SetInputLineSpacing(float lineSpacing)
{
- if(mImpl->mEventData)
- {
- mImpl->mEventData->mInputStyle.lineSpacing = lineSpacing;
- mImpl->mEventData->mInputStyle.isLineSpacingDefined = true;
- }
+ InputProperties::SetInputLineSpacing(*this, lineSpacing);
}
float Controller::GetInputLineSpacing() const
{
- return mImpl->mEventData ? mImpl->mEventData->mInputStyle.lineSpacing : 0.0f;
+ return InputProperties::GetInputLineSpacing(*this);
}
void Controller::SetInputShadowProperties(const std::string& shadowProperties)
{
- if(mImpl->mEventData)
- {
- mImpl->mEventData->mInputStyle.shadowProperties = shadowProperties;
- }
+ InputProperties::SetInputShadowProperties(*this, shadowProperties);
}
const std::string& Controller::GetInputShadowProperties() const
{
- return mImpl->mEventData ? mImpl->mEventData->mInputStyle.shadowProperties : EMPTY_STRING;
+ return InputProperties::GetInputShadowProperties(*this);
}
void Controller::SetInputUnderlineProperties(const std::string& underlineProperties)
{
- if(mImpl->mEventData)
- {
- mImpl->mEventData->mInputStyle.underlineProperties = underlineProperties;
- }
+ InputProperties::SetInputUnderlineProperties(*this, underlineProperties);
}
const std::string& Controller::GetInputUnderlineProperties() const
{
- return mImpl->mEventData ? mImpl->mEventData->mInputStyle.underlineProperties : EMPTY_STRING;
+ return InputProperties::GetInputUnderlineProperties(*this);
}
void Controller::SetInputEmbossProperties(const std::string& embossProperties)
{
- if(mImpl->mEventData)
- {
- mImpl->mEventData->mInputStyle.embossProperties = embossProperties;
- }
+ InputProperties::SetInputEmbossProperties(*this, embossProperties);
}
const std::string& Controller::GetInputEmbossProperties() const
{
- return mImpl->mEventData ? mImpl->mEventData->mInputStyle.embossProperties : GetDefaultEmbossProperties();
+ return InputProperties::GetInputEmbossProperties(*this);
}
void Controller::SetInputOutlineProperties(const std::string& outlineProperties)
{
- if(mImpl->mEventData)
- {
- mImpl->mEventData->mInputStyle.outlineProperties = outlineProperties;
- }
+ InputProperties::SetInputOutlineProperties(*this, outlineProperties);
}
const std::string& Controller::GetInputOutlineProperties() const
{
- return mImpl->mEventData ? mImpl->mEventData->mInputStyle.outlineProperties : GetDefaultOutlineProperties();
+ return InputProperties::GetInputOutlineProperties(*this);
}
void Controller::SetInputModePassword(bool passwordInput)
{
- if(mImpl->mEventData)
- {
- mImpl->mEventData->mPasswordInput = passwordInput;
- }
+ InputProperties::SetInputModePassword(*this, passwordInput);
}
bool Controller::IsInputModePassword()
{
- return mImpl->mEventData && mImpl->mEventData->mPasswordInput;
+ return InputProperties::IsInputModePassword(*this);
}
void Controller::SetNoTextDoubleTapAction(NoTextTap::Action action)
bool Controller::IsInputStyleChangedSignalsQueueEmpty()
{
- return (NULL == mImpl->mEventData) || (0u == mImpl->mEventData->mInputStyleChangedQueue.Count());
+ return mImpl->IsInputStyleChangedSignalsQueueEmpty();
}
void Controller::ProcessInputStyleChangedSignals()
{
- if(mImpl->mEventData)
- {
- if(mImpl->mEditableControlInterface)
- {
- // Emit the input style changed signal for each mask
- std::for_each(mImpl->mEventData->mInputStyleChangedQueue.begin(),
- mImpl->mEventData->mInputStyleChangedQueue.end(),
- [&](const auto mask) { mImpl->mEditableControlInterface->InputStyleChanged(mask); } );
- }
-
- mImpl->mEventData->mInputStyleChangedQueue.Clear();
- }
+ mImpl->ProcessInputStyleChangedSignals();
}
void Controller::KeyboardFocusGainEvent()
void Controller::SetEditable(bool editable)
{
mImpl->SetEditable(editable);
- if(mImpl->mEventData && mImpl->mEventData->mDecorator)
- {
- mImpl->mEventData->mDecorator->SetEditable(editable);
- }
}
void Controller::ScrollBy(Vector2 scroll)
{
- if(mImpl->mEventData && (fabs(scroll.x) > Math::MACHINE_EPSILON_0 || fabs(scroll.y) > Math::MACHINE_EPSILON_0))
- {
- const Vector2& layoutSize = mImpl->mModel->mVisualModel->GetLayoutSize();
- const Vector2 currentScroll = mImpl->mModel->mScrollPosition;
-
- scroll.x = -scroll.x;
- scroll.y = -scroll.y;
-
- if(fabs(scroll.x) > Math::MACHINE_EPSILON_0)
- {
- mImpl->mModel->mScrollPosition.x += scroll.x;
- mImpl->ClampHorizontalScroll(layoutSize);
- }
-
- if(fabs(scroll.y) > Math::MACHINE_EPSILON_0)
- {
- mImpl->mModel->mScrollPosition.y += scroll.y;
- mImpl->ClampVerticalScroll(layoutSize);
- }
-
- if(mImpl->mModel->mScrollPosition != currentScroll)
- {
- mImpl->mEventData->mDecorator->UpdatePositions(mImpl->mModel->mScrollPosition - currentScroll);
- mImpl->RequestRelayout();
- }
- }
+ mImpl->ScrollBy(scroll);
}
float Controller::GetHorizontalScrollPosition()
{
- // Scroll values are negative internally so we convert them to positive numbers
- return mImpl->mEventData ? -mImpl->mModel->mScrollPosition.x : 0.0f;
+ return mImpl->GetHorizontalScrollPosition();
}
float Controller::GetVerticalScrollPosition()
{
- // Scroll values are negative internally so we convert them to positive numbers
- return mImpl->mEventData ? -mImpl->mModel->mScrollPosition.y : 0.0f;
+ return mImpl->GetVerticalScrollPosition();
}
void Controller::DecorationEvent(HandleType handleType, HandleState state, float x, float y)
*/
void ResetScrollPosition();
- /**
- * @brief fill needed relayout parameters when line size is changed & request relayout.
- */
- void RelayoutForNewLineSize();
-
private: // Private contructors & copy operator.
/**
* @brief Private constructor.
private:
struct EventHandler;
struct InputFontHandler;
+ struct InputProperties;
struct PlaceholderHandler;
struct Relayouter;
struct TextUpdater;